Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/cheat.cc b/cheat.cc
- index de111c8..6f052c3 100644
- --- a/cheat.cc
- +++ b/cheat.cc
- @@ -841,7 +841,12 @@ void Cheat::cursor_teleport(void) const {
- int x, y;
- SDL_GetMouseState(&x, &y);
- +#if SDL_VERSION_ATLEAST(2, 0, 0) && defined(MACOSX)
- + gwin->get_win()->screen_to_game_hdpi(x, y, gwin->get_fastmouse(), x, y);
- +#else
- gwin->get_win()->screen_to_game(x, y, gwin->get_fastmouse(), x, y);
- +#endif
- +
- Tile_coord t(gwin->get_scrolltx() + x / c_tilesize,
- gwin->get_scrollty() + y / c_tilesize, 0);
- t.fixme();
- diff --git a/imagewin/imagewin.cc b/imagewin/imagewin.cc
- index de53848..8cd67ce 100644
- --- a/imagewin/imagewin.cc
- +++ b/imagewin/imagewin.cc
- @@ -104,6 +104,9 @@ int Image_window::desktop_depth = 0;
- int Image_window::windowed_8 = 0;
- int Image_window::windowed_16 = 0;
- int Image_window::windowed_32 = 0;
- +#if SDL_VERSION_ATLEAST(2, 0, 0) && defined(MACOSX)
- +float Image_window::nativescale = 1.0;
- +#endif
- const int Image_window::guard_band = 4;
- @@ -696,6 +699,9 @@ bool Image_window::create_scale_surfaces(int w, int h, int bpp) {
- h=dh;
- Resolution res = { w, h, false, false, false};
- p_resolutions[(w << 16) | h] = res;
- + int sw;
- + SDL_GetWindowSize(screen_window, &sw, 0);
- + nativescale = dw / sw;
- #endif
- //high resolution fullscreen needs this to make the whole screen available
- SDL_RenderSetLogicalSize(screen_renderer, w, h);
- diff --git a/imagewin/imagewin.h b/imagewin/imagewin.h
- index b19fe9e..4bd1544 100644
- --- a/imagewin/imagewin.h
- +++ b/imagewin/imagewin.h
- @@ -293,6 +293,9 @@ class Image_window {
- static int windowed_8;
- static int windowed_16;
- static int windowed_32;
- +#if SDL_VERSION_ATLEAST(2, 0, 0) && defined(MACOSX)
- + static float nativescale;
- +#endif
- public:
- #if SDL_VERSION_ATLEAST(2, 0, 0)
- @@ -334,6 +337,17 @@ class Image_window {
- gy = (sy * inter_height) / (scale * get_display_height()) + get_start_y();
- }
- }
- +#if SDL_VERSION_ATLEAST(2, 0, 0) && defined(MACOSX)
- + void screen_to_game_hdpi(int sx, int sy, bool fast, int &gx, int &gy) {
- + if (fast) {
- + gx = sx + get_start_x();
- + gy = sy + get_start_y();
- + } else {
- + gx = ((sx * inter_width) / (scale * get_display_width()) + get_start_x()) * nativescale;
- + gy = ((sy * inter_height) / (scale * get_display_height()) + get_start_y()) * nativescale;
- + }
- + }
- +#endif
- void game_to_screen(int gx, int gy, bool fast, int &sx, int &sy) {
- if (fast) {
- sx = gx - get_start_x();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement