From: Ryan Flegel Date: Fri, 28 May 2004 22:35:05 +0000 (+0000) Subject: - fixed some resolution related leveditor bugs X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=40d63a950b4b6ea2091c54129e90a37d0ab7cc77;hp=02d4bd62ddab2abcca2f2b18331265468a67c6ce;p=supertux.git - fixed some resolution related leveditor bugs SVN-Revision: 1355 --- diff --git a/src/leveleditor.cpp b/src/leveleditor.cpp index fdc34336c..67182b874 100644 --- a/src/leveleditor.cpp +++ b/src/leveleditor.cpp @@ -785,9 +785,9 @@ void le_drawminimap() int left_offset = (screen->w - 64 - le_world->get_level()->width*mini_tile_width) / 2; int mini_tile_height; - if(screen->h - 64 > le_world->get_level()->height * 4) + if(screen->h > le_world->get_level()->height * 4) mini_tile_height = 4; - else if(screen->h - 64 > le_world->get_level()->height * 2) + else if(screen->h > le_world->get_level()->height * 2) mini_tile_height = 2; else mini_tile_height = 1; @@ -797,24 +797,33 @@ void le_drawminimap() for (int x = 0; x < le_world->get_level()->width; ++x) { - Tile::draw_stretched(left_offset + mini_tile_width*x, y * 4, - mini_tile_width , 4, level->bg_tiles[y * level->width + x]); + Tile::draw_stretched(left_offset + mini_tile_width*x, y * mini_tile_height, + mini_tile_width , mini_tile_height, level->bg_tiles[y * level->width + x]); - Tile::draw_stretched(left_offset + mini_tile_width*x, y * 4, - mini_tile_width , 4, level->ia_tiles[y * level->width + x]); + Tile::draw_stretched(left_offset + mini_tile_width*x, y * mini_tile_height, + mini_tile_width , mini_tile_height, level->ia_tiles[y * level->width + x]); - Tile::draw_stretched(left_offset + mini_tile_width*x, y * 4, - mini_tile_width , 4, level->fg_tiles[y + level->width + x]); + Tile::draw_stretched(left_offset + mini_tile_width*x, y * mini_tile_height, + mini_tile_width , mini_tile_height, level->fg_tiles[y + level->width + x]); } - fillrect(left_offset, 0, le_world->get_level()->width*mini_tile_width, le_world->get_level()->height*mini_tile_height, 200, 200, 200, 128); - - fillrect(left_offset + (pos_x/32)*mini_tile_width, 0, 19*mini_tile_width, 2, 200, 200, 200, 200); - fillrect(left_offset + (pos_x/32)*mini_tile_width, 0, 2, le_world->get_level()->height*mini_tile_height, 200, 200, 200, 200); - fillrect(left_offset + (pos_x/32)*mini_tile_width + 19*mini_tile_width - 2, 0, 2, le_world->get_level()->height*mini_tile_height, 200, 200, 200, 200); - fillrect(left_offset + (pos_x/32)*mini_tile_width, le_world->get_level()->height*mini_tile_height-2, 19*mini_tile_width, 2, 200, 200, 200, 200); - + fillrect(left_offset, 0, + le_world->get_level()->width*mini_tile_width, le_world->get_level()->height*mini_tile_height, + 200, 200, 200, 96); + + fillrect(left_offset + (pos_x/32)*mini_tile_width, (pos_y/32)*mini_tile_height, + (VISIBLE_TILES_X-3)*mini_tile_width, 2, + 200, 200, 200, 200); + fillrect(left_offset + (pos_x/32)*mini_tile_width, (pos_y/32)*mini_tile_height, + 2, (VISIBLE_TILES_Y-1)*mini_tile_height, + 200, 200, 200, 200); + fillrect(left_offset + (pos_x/32)*mini_tile_width + (VISIBLE_TILES_X-3)*mini_tile_width - 2, (pos_y/32)*mini_tile_height, + 2, (VISIBLE_TILES_Y-1)*mini_tile_height, + 200, 200, 200, 200); + fillrect(left_offset + (pos_x/32)*mini_tile_width, (pos_y/32)*mini_tile_height + (VISIBLE_TILES_Y-1)*mini_tile_height - 2, + (VISIBLE_TILES_X-3)*mini_tile_width, 2, + 200, 200, 200, 200); } void le_drawinterface() @@ -1538,6 +1547,9 @@ void le_checkevents() { show_minimap = false; + if (event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_TAB) + show_minimap = true; + le_move_left_bt->event(event); le_move_right_bt->event(event); le_move_up_bt->event(event); @@ -1610,19 +1622,17 @@ void le_checkevents() break; } - /* checking if pos_x and pos_y is within the limits... */ - if(pos_x > (le_world->get_level()->width * 32 + 32*2) - screen->w) - pos_x = (le_world->get_level()->width * 32 + 32*2) - screen->w; - if(pos_x < 0) - pos_x = 0; - - if(pos_y > (le_world->get_level()->height * 32) - screen->h) - pos_y = (le_world->get_level()->height * 32) - screen->h; - if(pos_y < 0) - pos_y = 0; + /* checking if pos_x and pos_y is within the limits... */ + if(pos_x > (le_world->get_level()->width * 32 + 32*2) - screen->w) + pos_x = (le_world->get_level()->width * 32 + 32*2) - screen->w; + if(pos_x < 0) + pos_x = 0; + if(pos_y > (le_world->get_level()->height * 32) - screen->h) + pos_y = (le_world->get_level()->height * 32) - screen->h; + if(pos_y < 0) + pos_y = 0; } - } void le_highlight_selection()