summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/render/graphics.cpp12
-rw-r--r--src/render/graphics.h12
2 files changed, 16 insertions, 8 deletions
diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp
index 3a423aac2..5437e6737 100644
--- a/src/render/graphics.cpp
+++ b/src/render/graphics.cpp
@@ -205,8 +205,8 @@ void Graphics::setScale(int scale)
mWidth = mActualWidth;
mHeight = mActualHeight;
}
- mRect.w = mWidth;
- mRect.h = mHeight;
+ mRect.w = static_cast<RectSize>(mWidth);
+ mRect.h = static_cast<RectSize>(mHeight);
}
int Graphics::getOpenGLFlags() const
@@ -261,8 +261,8 @@ bool Graphics::setOpenGLMode()
int w1 = 0;
int h1 = 0;
SDL_GetWindowSize(mWindow, &w1, &h1);
- mRect.w = w1 / mScale;
- mRect.h = h1 / mScale;
+ mRect.w = static_cast<int32_t>(w1 / mScale);
+ mRect.h = static_cast<int32_t>(h1 / mScale);
mGLContext = SDL_GL_CreateContext(mWindow);
@@ -472,8 +472,8 @@ bool Graphics::resizeScreen(const int width, const int height)
#ifdef USE_SDL2
endDraw();
- mRect.w = width / mScale;
- mRect.h = height / mScale;
+ mRect.w = static_cast<int32_t>(width / mScale);
+ mRect.h = static_cast<int32_t>(height / mScale);
mWidth = width / mScale;
mHeight = height / mScale;
mActualWidth = width;
diff --git a/src/render/graphics.h b/src/render/graphics.h
index 49080f4de..541bb789d 100644
--- a/src/render/graphics.h
+++ b/src/render/graphics.h
@@ -85,6 +85,14 @@
#include "localconsts.h"
+#ifdef USE_SDL2
+#define RectPos int32_t
+#define RectSize int32_t
+#else
+#define RectPos int16_t
+#define RectSize uint16_t
+#endif
+
class Image;
class ImageCollection;
class ImageVertexes;
@@ -165,8 +173,8 @@ class Graphics
const int width, const int height)
{
mWindow = window;
- mRect.w = width;
- mRect.h = height;
+ mRect.w = static_cast<RectSize>(width);
+ mRect.h = static_cast<RectSize>(height);
}
SDL_Window *getWindow() const