|
@@ -17,17 +17,12 @@ struct SDL_Rect;
|
|
|
struct SDL_Window;
|
|
|
struct SDL_Renderer;
|
|
|
struct SDL_Texture;
|
|
|
-struct SDL_Surface;
|
|
|
-struct SDL_Color;
|
|
|
-
|
|
|
-extern SDL_Window * mainWindow;
|
|
|
-extern SDL_Renderer * mainRenderer;
|
|
|
-extern SDL_Texture * screenTexture;
|
|
|
-extern SDL_Surface * screen, *screen2, *screenBuf;
|
|
|
-
|
|
|
-VCMI_LIB_NAMESPACE_BEGIN
|
|
|
-
|
|
|
-class Rect;
|
|
|
+struct SDL_Surface;
|
|
|
+struct SDL_Color;
|
|
|
+
|
|
|
+VCMI_LIB_NAMESPACE_BEGIN
|
|
|
+
|
|
|
+class Rect;
|
|
|
class Point;
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|
|
@@ -44,45 +39,45 @@ SDL_Rect toSDL(const Rect & rect);
|
|
|
/// creates Color using provided SDL_Color
|
|
|
ColorRGBA fromSDL(const SDL_Color & color);
|
|
|
|
|
|
-/// creates SDL_Color using provided Color
|
|
|
-SDL_Color toSDL(const ColorRGBA & color);
|
|
|
-
|
|
|
-void setColors(SDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors);
|
|
|
-void setAlpha(SDL_Surface * bg, int value);
|
|
|
-
|
|
|
-template<typename IntType>
|
|
|
-std::string makeNumberShort(IntType number, IntType maxLength = 3) //the output is a string containing at most 5 characters [4 if positive] (eg. intead 10000 it gives 10k)
|
|
|
-{
|
|
|
- IntType max = pow(10, maxLength);
|
|
|
- if (std::abs(number) < max)
|
|
|
- return boost::lexical_cast<std::string>(number);
|
|
|
-
|
|
|
- std::string symbols = " kMGTPE";
|
|
|
- auto iter = symbols.begin();
|
|
|
-
|
|
|
- while (number >= max)
|
|
|
- {
|
|
|
- number /= 1000;
|
|
|
- iter++;
|
|
|
-
|
|
|
- assert(iter != symbols.end());//should be enough even for int64
|
|
|
- }
|
|
|
- return boost::lexical_cast<std::string>(number) + *iter;
|
|
|
-}
|
|
|
-
|
|
|
-Rect genRect(const int & hh, const int & ww, const int & xx, const int & yy);
|
|
|
-
|
|
|
-typedef void (*TColorPutter)(uint8_t *&ptr, const uint8_t & R, const uint8_t & G, const uint8_t & B);
|
|
|
-typedef void (*TColorPutterAlpha)(uint8_t *&ptr, const uint8_t & R, const uint8_t & G, const uint8_t & B, const uint8_t & A);
|
|
|
-
|
|
|
- void blitAt(SDL_Surface * src, int x, int y, SDL_Surface * dst=screen);
|
|
|
- void blitAt(SDL_Surface * src, const Rect & pos, SDL_Surface * dst=screen);
|
|
|
-
|
|
|
- void setClipRect(SDL_Surface * src, const Rect & other);
|
|
|
- void getClipRect(SDL_Surface * src, Rect & other);
|
|
|
-
|
|
|
- void blitSurface(SDL_Surface * src, const Rect & srcRect, SDL_Surface * dst, const Point & dest);
|
|
|
- void blitSurface(SDL_Surface * src, SDL_Surface * dst, const Point & dest);
|
|
|
+/// creates SDL_Color using provided Color
|
|
|
+SDL_Color toSDL(const ColorRGBA & color);
|
|
|
+
|
|
|
+void setColors(SDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors);
|
|
|
+void setAlpha(SDL_Surface * bg, int value);
|
|
|
+
|
|
|
+template<typename IntType>
|
|
|
+std::string makeNumberShort(IntType number, IntType maxLength = 3) //the output is a string containing at most 5 characters [4 if positive] (eg. intead 10000 it gives 10k)
|
|
|
+{
|
|
|
+ IntType max = pow(10, maxLength);
|
|
|
+ if (std::abs(number) < max)
|
|
|
+ return boost::lexical_cast<std::string>(number);
|
|
|
+
|
|
|
+ std::string symbols = " kMGTPE";
|
|
|
+ auto iter = symbols.begin();
|
|
|
+
|
|
|
+ while (number >= max)
|
|
|
+ {
|
|
|
+ number /= 1000;
|
|
|
+ iter++;
|
|
|
+
|
|
|
+ assert(iter != symbols.end());//should be enough even for int64
|
|
|
+ }
|
|
|
+ return boost::lexical_cast<std::string>(number) + *iter;
|
|
|
+}
|
|
|
+
|
|
|
+Rect genRect(const int & hh, const int & ww, const int & xx, const int & yy);
|
|
|
+
|
|
|
+typedef void (*TColorPutter)(uint8_t *&ptr, const uint8_t & R, const uint8_t & G, const uint8_t & B);
|
|
|
+typedef void (*TColorPutterAlpha)(uint8_t *&ptr, const uint8_t & R, const uint8_t & G, const uint8_t & B, const uint8_t & A);
|
|
|
+
|
|
|
+ void blitAt(SDL_Surface * src, int x, int y, SDL_Surface * dst);
|
|
|
+ void blitAt(SDL_Surface * src, const Rect & pos, SDL_Surface * dst);
|
|
|
+
|
|
|
+ void setClipRect(SDL_Surface * src, const Rect & other);
|
|
|
+ void getClipRect(SDL_Surface * src, Rect & other);
|
|
|
+
|
|
|
+ void blitSurface(SDL_Surface * src, const Rect & srcRect, SDL_Surface * dst, const Point & dest);
|
|
|
+ void blitSurface(SDL_Surface * src, SDL_Surface * dst, const Point & dest);
|
|
|
|
|
|
void fillSurface(SDL_Surface *dst, const SDL_Color & color);
|
|
|
void fillRect(SDL_Surface *dst, const Rect & dstrect, const SDL_Color & color);
|
|
@@ -114,13 +109,14 @@ typedef void (*TColorPutterAlpha)(uint8_t *&ptr, const uint8_t & R, const uint8_
|
|
|
void drawLine(SDL_Surface * sur, int x1, int y1, int x2, int y2, const SDL_Color & color1, const SDL_Color & color2);
|
|
|
void drawBorder(SDL_Surface * sur, int x, int y, int w, int h, const SDL_Color &color, int depth = 1);
|
|
|
void drawBorder(SDL_Surface * sur, const Rect &r, const SDL_Color &color, int depth = 1);
|
|
|
- void drawDashedBorder(SDL_Surface * sur, const Rect &r, const SDL_Color &color);
|
|
|
- void setPlayerColor(SDL_Surface * sur, PlayerColor player); //sets correct color of flags; -1 for neutral
|
|
|
- std::string processStr(std::string str, std::vector<std::string> & tor); //replaces %s in string
|
|
|
- SDL_Surface * newSurface(int w, int h, SDL_Surface * mod=screen); //creates new surface, with flags/format same as in surface given
|
|
|
- SDL_Surface * copySurface(SDL_Surface * mod); //returns copy of given surface
|
|
|
- template<int bpp>
|
|
|
- SDL_Surface * createSurfaceWithBpp(int width, int height); //create surface with give bits per pixels value
|
|
|
+ void drawDashedBorder(SDL_Surface * sur, const Rect &r, const SDL_Color &color);
|
|
|
+ void setPlayerColor(SDL_Surface * sur, PlayerColor player); //sets correct color of flags; -1 for neutral
|
|
|
+ std::string processStr(std::string str, std::vector<std::string> & tor); //replaces %s in string
|
|
|
+ SDL_Surface * newSurface(int w, int h, SDL_Surface * mod); //creates new surface, with flags/format same as in surface given
|
|
|
+ SDL_Surface * newSurface(int w, int h); //creates new surface, with flags/format same as in screen surface
|
|
|
+ SDL_Surface * copySurface(SDL_Surface * mod); //returns copy of given surface
|
|
|
+ template<int bpp>
|
|
|
+ SDL_Surface * createSurfaceWithBpp(int width, int height); //create surface with give bits per pixels value
|
|
|
void VflipSurf(SDL_Surface * surf); //fluipis given surface by vertical axis
|
|
|
|
|
|
//scale surface to required size.
|