--- a/src/proto2/Graphics.cc Tue Nov 18 20:00:04 2008 +0000
+++ b/src/proto2/Graphics.cc Tue Nov 18 21:17:14 2008 +0000
@@ -5,7 +5,7 @@
engine(engine),
state(state),
update_timer(GRAPHICS_UPDATE_INTERVAL_MS),
- win(GRAPHICS_WINDOW_TITLE, MAP_DIM_W, MAP_DIM_H),
+ win(GRAPHICS_WINDOW_TITLE, GRAPHICS_RESOLUTION_WIDTH, GRAPHICS_RESOLUTION_HEIGHT),
keyboard(win.get_ic()->get_keyboard()) {
// connect timer signal
@@ -54,6 +54,9 @@
// white background
gc->clear(CL_Color::white);
+ const float factorX = GRAPHICS_RESOLUTION_WIDTH / MAP_WIDTH;
+ const float factorY = GRAPHICS_RESOLUTION_HEIGHT / MAP_HEIGHT;
+
// draw players
for (std::list<Player*>::iterator it = state.player_list.begin(); it != state.player_list.end(); it++) {
Player *p = *it;
@@ -61,8 +64,8 @@
// draw square
gc->fill_rect(
CL_Rect(
- p->getPosition().x - 5, p->getPosition().y - 5,
- p->getPosition().x + 5, p->getPosition().y + 5
+ p->getPosition().x * factorX - 5, p->getPosition().y * factorY - 5,
+ p->getPosition().x * factorX + 5, p->getPosition().y * factorY + 5
), CL_Color::black
);
}