projects
/
supertux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
417c6a1
)
Added PHYSICAL_SCREEN_WIDTH global variable, little ugly, but should do for now,...
author
Ingo Ruhnke
<grumbel@gmail.com>
Thu, 31 Jul 2014 02:37:42 +0000
(
04:37
+0200)
committer
Ingo Ruhnke
<grumbel@gmail.com>
Thu, 31 Jul 2014 02:37:42 +0000
(
04:37
+0200)
src/gui/menu.cpp
patch
|
blob
|
history
src/gui/mousecursor.cpp
patch
|
blob
|
history
src/supertux/globals.cpp
patch
|
blob
|
history
src/supertux/globals.hpp
patch
|
blob
|
history
src/supertux/main.cpp
patch
|
blob
|
history
diff --git
a/src/gui/menu.cpp
b/src/gui/menu.cpp
index
a777972
..
3ff034b
100644
(file)
--- a/
src/gui/menu.cpp
+++ b/
src/gui/menu.cpp
@@
-770,9
+770,8
@@
Menu::event(const SDL_Event& event)
case SDL_MOUSEBUTTONDOWN:
if(event.button.button == SDL_BUTTON_LEFT)
{
case SDL_MOUSEBUTTONDOWN:
if(event.button.button == SDL_BUTTON_LEFT)
{
-#ifdef OLD_SDL1
- int x = int(event.motion.x * float(SCREEN_WIDTH)/g_screen->w);
- int y = int(event.motion.y * float(SCREEN_HEIGHT)/g_screen->h);
+ int x = int(event.motion.x * float(SCREEN_WIDTH) / PHYSICAL_SCREEN_WIDTH);
+ int y = int(event.motion.y * float(SCREEN_HEIGHT) / PHYSICAL_SCREEN_WIDTH);
if(x > pos.x - get_width()/2 &&
x < pos.x + get_width()/2 &&
if(x > pos.x - get_width()/2 &&
x < pos.x + get_width()/2 &&
@@
-781,15
+780,13
@@
Menu::event(const SDL_Event& event)
{
menuaction = MENU_ACTION_HIT;
}
{
menuaction = MENU_ACTION_HIT;
}
-#endif
}
break;
case SDL_MOUSEMOTION:
{
}
break;
case SDL_MOUSEMOTION:
{
-#ifdef OLD_SDL1
- float x = event.motion.x * SCREEN_WIDTH/g_screen->w;
- float y = event.motion.y * SCREEN_HEIGHT/g_screen->h;
+ float x = event.motion.x * SCREEN_WIDTH / PHYSICAL_SCREEN_WIDTH;
+ float y = event.motion.y * SCREEN_HEIGHT / PHYSICAL_SCREEN_HEIGHT;
if(x > pos.x - get_width()/2 &&
x < pos.x + get_width()/2 &&
if(x > pos.x - get_width()/2 &&
x < pos.x + get_width()/2 &&
@@
-813,7
+810,6
@@
Menu::event(const SDL_Event& event)
if(MouseCursor::current())
MouseCursor::current()->set_state(MC_NORMAL);
}
if(MouseCursor::current())
MouseCursor::current()->set_state(MC_NORMAL);
}
-#endif
}
break;
}
break;
diff --git
a/src/gui/mousecursor.cpp
b/src/gui/mousecursor.cpp
index
8bfdfa0
..
74cc075
100644
(file)
--- a/
src/gui/mousecursor.cpp
+++ b/
src/gui/mousecursor.cpp
@@
-57,15
+57,14
@@
void MouseCursor::set_mid(int x, int y)
void MouseCursor::draw(DrawingContext& context)
{
void MouseCursor::draw(DrawingContext& context)
{
-#ifdef OLD_SDL1
if(cur_state == MC_HIDE)
return;
int x,y,w,h;
Uint8 ispressed = SDL_GetMouseState(&x,&y);
if(cur_state == MC_HIDE)
return;
int x,y,w,h;
Uint8 ispressed = SDL_GetMouseState(&x,&y);
- x = int(x * float(SCREEN_WIDTH)
/g_screen->w
);
- y = int(y * float(SCREEN_HEIGHT)
/g_screen->h
);
+ x = int(x * float(SCREEN_WIDTH)
/ PHYSICAL_SCREEN_WIDTH
);
+ y = int(y * float(SCREEN_HEIGHT)
/ PHYSICAL_SCREEN_HEIGHT
);
w = (int) cursor->get_width();
h = (int) (cursor->get_height() / MC_STATES_NB);
w = (int) cursor->get_width();
h = (int) (cursor->get_height() / MC_STATES_NB);
@@
-81,7
+80,6
@@
void MouseCursor::draw(DrawingContext& context)
context.draw_surface_part(cursor, Vector(0, h*cur_state),
Vector(w, h), Vector(x-mid_x, y-mid_y), LAYER_GUI+100);
context.draw_surface_part(cursor, Vector(0, h*cur_state),
Vector(w, h), Vector(x-mid_x, y-mid_y), LAYER_GUI+100);
-#endif
}
/* EOF */
}
/* EOF */
diff --git
a/src/supertux/globals.cpp
b/src/supertux/globals.cpp
index
207c119
..
6b27112
100644
(file)
--- a/
src/supertux/globals.cpp
+++ b/
src/supertux/globals.cpp
@@
-23,6
+23,9
@@
tinygettext::DictionaryManager* dictionary_manager = 0;
int SCREEN_WIDTH;
int SCREEN_HEIGHT;
int SCREEN_WIDTH;
int SCREEN_HEIGHT;
+int PHYSICAL_SCREEN_WIDTH;
+int PHYSICAL_SCREEN_HEIGHT;
+
ScreenManager* g_screen_manager = 0;
TextureManager* texture_manager = 0;
ScreenManager* g_screen_manager = 0;
TextureManager* texture_manager = 0;
diff --git
a/src/supertux/globals.hpp
b/src/supertux/globals.hpp
index
8902619
..
6962ef0
100644
(file)
--- a/
src/supertux/globals.hpp
+++ b/
src/supertux/globals.hpp
@@
-39,6
+39,9
@@
extern int SCREEN_WIDTH;
shrink or scale things) */
extern int SCREEN_HEIGHT;
shrink or scale things) */
extern int SCREEN_HEIGHT;
+extern int PHYSICAL_SCREEN_WIDTH;
+extern int PHYSICAL_SCREEN_HEIGHT;
+
// global variables
extern JoystickKeyboardController* g_jk_controller;
// global variables
extern JoystickKeyboardController* g_jk_controller;
diff --git
a/src/supertux/main.cpp
b/src/supertux/main.cpp
index
d36c823
..
beb0c0b
100644
(file)
--- a/
src/supertux/main.cpp
+++ b/
src/supertux/main.cpp
@@
-466,7
+466,10
@@
Main::init_video()
// FIXME: Add something here
SCREEN_WIDTH = 800;
SCREEN_HEIGHT = 600;
// FIXME: Add something here
SCREEN_WIDTH = 800;
SCREEN_HEIGHT = 600;
-
+
+ PHYSICAL_SCREEN_WIDTH = SCREEN_WIDTH;
+ PHYSICAL_SCREEN_HEIGHT = SCREEN_HEIGHT;
+
context_pointer->init_renderer();
#ifdef OLD_SDL1
context_pointer->init_renderer();
#ifdef OLD_SDL1