OpenClonk
C4TextureShape.h
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 1998-2000, Matthes Bender
5  * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
6  * Copyright (c) 2009-2016, The OpenClonk Team and contributors
7  *
8  * Distributed under the terms of the ISC license; see accompanying file
9  * "COPYING" for details.
10  *
11  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
12  * See accompanying file "TRADEMARK" for details.
13  *
14  * To redistribute this file separately, substitute the full license texts
15  * for the above references.
16  */
17 
18 /* Textures used by the landscape */
19 
20 #ifndef INC_C4TextureShape
21 #define INC_C4TextureShape
22 
23 #include "graphics/CSurface8.h"
24 
25 // Custom texture drawing shape for Map2Landscape zooming
27 {
28 private:
29  enum { Shape_None = 0xff }; // special value in data surface: No shape defined here.
30  CSurface8 data;
31  int32_t num_shapes{0};
32  std::vector<bool> shape_border_x, shape_border_y; // whether shapes are touching horizontal/vertical borders
33  std::vector<int32_t> shape_pixnum; // number of pixels
34 public:
35  C4TextureShape() : data() {}
36  ~C4TextureShape() = default;
37 
38  void Clear();
39  bool Load(C4Group &group, const char *filename, int32_t base_tex_wdt, int32_t base_tex_hgt);
40 
41  int32_t GetWidth() const { return data.Wdt; }
42  int32_t GetHeight() const { return data.Hgt; }
43  // Poly range used to ensure update range in editor mode is large enough
44  // not calculated on loading for now. Just assume something reasonably safe
45  int32_t GetMaxPolyWidth() const { return GetWidth() / 4; }
46  int32_t GetMaxPolyHeight() const { return GetHeight() / 4; }
47 
48  void Draw(const CSurface8 &sfcMap, const CSurface8 &sfcMapBkg, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, uint8_t iTexture, int32_t iOffX, int32_t iOffY, int32_t MapZoom, int32_t min_overlap_ratio);
49 };
50 
51 #endif
void Draw(const CSurface8 &sfcMap, const CSurface8 &sfcMapBkg, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, uint8_t iTexture, int32_t iOffX, int32_t iOffY, int32_t MapZoom, int32_t min_overlap_ratio)
bool Load(C4Group &group, const char *filename, int32_t base_tex_wdt, int32_t base_tex_hgt)
int32_t GetWidth() const
int32_t GetMaxPolyHeight() const
int32_t GetHeight() const
int32_t GetMaxPolyWidth() const
~C4TextureShape()=default
int Wdt
Definition: CSurface8.h:28
int Hgt
Definition: CSurface8.h:28