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 &&
{
menuaction = MENU_ACTION_HIT;
}
-#endif
}
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(MouseCursor::current())
MouseCursor::current()->set_state(MC_NORMAL);
}
-#endif
}
break;
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);
- 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);
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 */
int SCREEN_WIDTH;
int SCREEN_HEIGHT;
+int PHYSICAL_SCREEN_WIDTH;
+int PHYSICAL_SCREEN_HEIGHT;
+
ScreenManager* g_screen_manager = 0;
TextureManager* texture_manager = 0;
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;
// 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