diff -r a33a1bc041bb src/GameGUI.cpp --- a/src/GameGUI.cpp Tue Oct 21 19:14:00 2008 +1300 +++ b/src/GameGUI.cpp Sat Oct 25 18:44:39 2008 -0400 @@ -62,7 +62,7 @@ #define TYPING_INPUT_BASE_INC 7 #define TYPING_INPUT_MAX_POS 46 -#define YPOS_BASE_DEFAULT 160 +#define YPOS_BASE_DEFAULT 190 #define YPOS_BASE_BUILDING YPOS_BASE_DEFAULT #define YPOS_BASE_FLAG YPOS_BASE_DEFAULT #define YPOS_BASE_STAT YPOS_BASE_DEFAULT @@ -134,7 +134,15 @@ void InGameTextInput::onAction(Widget *s GameGUI::GameGUI() : keyboardManager(GameGUIShortcuts), game(this), toolManager(game, brush, defaultAssign, ghostManager), - minimap(globalContainer->runNoX, (globalContainer->runNoX ? 0 : globalContainer->gfx->getW()-RIGHT_MENU_WIDTH), 0, RIGHT_MENU_WIDTH, 128, (RIGHT_MENU_WIDTH-100)/2, 14, Minimap::HideFOW), + minimap(globalContainer->runNoX, + RIGHT_MENU_WIDTH, // width of the menu + globalContainer->gfx->getW(), // width of the screen + 20, // x offset + 5, // y offset + 128, // width + 128, //height + Minimap::HideFOW), // minimap mode + ghostManager(game) { } @@ -1956,7 +1964,8 @@ void GameGUI::handleMenuClick(int mx, in moveParticles(oldViewportX, viewportX, oldViewportY, viewportY); } } - else if (my<128+32) + // Check if one of the panel buttons has been clicked + else if (mygfx->getW()-RIGHT_MENU_WIDTH; - y=((i / numberPerLine)*46)+128+32; + y=((i / numberPerLine)*46)+YPOS_BASE_BUILDING; globalContainer->gfx->setClipRect(x, y, 64, 46); Sprite *buildingSprite; @@ -2542,7 +2551,7 @@ void GameGUI::drawChoice(int pos, std::v globalContainer->gfx->setClipRect(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH, 128, RIGHT_MENU_WIDTH, globalContainer->gfx->getH()-128); - // draw selection if needed + // draw building selection if needed if (selectionMode == TOOL_SELECTION) { int sw; @@ -2551,10 +2560,10 @@ void GameGUI::drawChoice(int pos, std::v else sw = globalContainer->gamegui->getW(23); - + assert(sel>=0); int x=((sel % numberPerLine)*width)+globalContainer->gfx->getW()-RIGHT_MENU_WIDTH; - int y=((sel / numberPerLine)*46)+128+32; + int y=((sel / numberPerLine)*46)+YPOS_BASE_BUILDING; int decX = (width - sw) / 2; @@ -3500,17 +3509,17 @@ void GameGUI::drawPanel(void) // draw menu background, black if low speed graphics, transparent otherwise if (globalContainer->settings.optionFlags & GlobalContainer::OPTION_LOW_SPEED_GFX) - globalContainer->gfx->drawFilledRect(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH, 128, RIGHT_MENU_WIDTH, globalContainer->gfx->getH()-128, 0, 0, 0); - else - globalContainer->gfx->drawFilledRect(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH, 128, RIGHT_MENU_WIDTH, globalContainer->gfx->getH()-128, 0, 0, 40, 180); + globalContainer->gfx->drawFilledRect(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH, 133, RIGHT_MENU_WIDTH, globalContainer->gfx->getH()-128, 0, 0, 0); + else + globalContainer->gfx->drawFilledRect(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH, 133, RIGHT_MENU_WIDTH, globalContainer->gfx->getH()-128, 0, 0, 40, 180); if(hilights.find(HilightRightSidePanel) != hilights.end()) { arrowPositions.push_back(HilightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36, globalContainer->gfx->getH()/2, 38)); } - // draw the buttons in the panel - drawPanelButtons(128); + // draw the panel selection buttons + drawPanelButtons(YPOS_BASE_DEFAULT-32); if (selectionMode==BUILDING_SELECTION) { diff -r a33a1bc041bb src/MapEdit.cpp --- a/src/MapEdit.cpp Tue Oct 21 19:14:00 2008 +1300 +++ b/src/MapEdit.cpp Sat Oct 25 18:44:39 2008 -0400 @@ -810,7 +810,15 @@ void Checkbox::handleClick(int relMouseX MapEdit::MapEdit() - : game(NULL, this), keyboardManager(MapEditShortcuts), minimap(globalContainer->runNoX, globalContainer->gfx->getW()-RIGHT_MENU_WIDTH, 0, RIGHT_MENU_WIDTH, 128, RIGHT_MENU_OFFSET+14,14, Minimap::ShowFOW) + : game(NULL, this), keyboardManager(MapEditShortcuts), + minimap(globalContainer->runNoX, + RIGHT_MENU_WIDTH, // menu width + globalContainer->gfx->getW(), // game width + 20, // x offset + 5, // y offset + 128, // width + 128, // height + Minimap::ShowFOW) { doQuit=false; doFullQuit=false; @@ -839,10 +847,10 @@ MapEdit::MapEdit() int decX = RIGHT_MENU_OFFSET; panelMode=AddBuildings; - buildingView = new PanelIcon(*this, widgetRectangle(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+decX, 128, 32, 32), "any", "building view icon", "switch to building view", 0, AddBuildings); - flagsView = new PanelIcon(*this, widgetRectangle(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+32+decX, 128, 32, 32), "any", "flag view icon", "switch to flag view", 28, AddFlagsAndZones); - terrainView = new PanelIcon(*this, widgetRectangle(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+64+decX, 128, 32, 32), "any", "terrain view icon", "switch to terrain view", 31, Terrain); - teamsView = new PanelIcon(*this, widgetRectangle(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+96+decX, 128, 32, 32), "any", "teams view icon", "switch to teams view", 33, Teams); + buildingView = new PanelIcon(*this, widgetRectangle(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+decX, 136, 32, 32), "any", "building view icon", "switch to building view", 0, AddBuildings); + flagsView = new PanelIcon(*this, widgetRectangle(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+32+decX, 136, 32, 32), "any", "flag view icon", "switch to flag view", 28, AddFlagsAndZones); + terrainView = new PanelIcon(*this, widgetRectangle(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+64+decX, 136, 32, 32), "any", "terrain view icon", "switch to terrain view", 31, Terrain); + teamsView = new PanelIcon(*this, widgetRectangle(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+96+decX, 136, 32, 32), "any", "teams view icon", "switch to teams view", 33, Teams); menuIcon = new MenuIcon(*this, widgetRectangle(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-32+decX, 0, 32, 32), "any", "menu icon", "open menu screen"); addWidget(buildingView); addWidget(flagsView); @@ -1186,9 +1194,9 @@ int MapEdit::run(void) minimap.setGame(game); globalContainer->gfx->setClipRect(); - drawMenu(); drawMap(0, 0, globalContainer->gfx->getW()-RIGHT_MENU_WIDTH, globalContainer->gfx->getH(), true, true); drawMiniMap(); + drawMenu(); if(game.gameHeader.getNumberOfPlayers() == 0) @@ -1398,7 +1406,7 @@ void MapEdit::drawMenu(void) void MapEdit::drawMenu(void) { int menuStartW=globalContainer->gfx->getW()-RIGHT_MENU_WIDTH; - int yposition=128; + int yposition=133; if (globalContainer->settings.optionFlags & GlobalContainer::OPTION_LOW_SPEED_GFX) globalContainer->gfx->drawFilledRect(menuStartW, yposition, RIGHT_MENU_WIDTH, globalContainer->gfx->getH()-128, 0, 0, 0); diff -r a33a1bc041bb src/Minimap.cpp --- a/src/Minimap.cpp Tue Oct 21 19:14:00 2008 +1300 +++ b/src/Minimap.cpp Sat Oct 25 18:44:39 2008 -0400 @@ -30,13 +30,13 @@ using namespace GAGCore; -Minimap::Minimap(bool nox, int px, int py, int sizew, int sizeh, int leftborder, int topborder, MinimapMode minimap_mode) - : noX(nox), px(px), py(py), sizew(sizew), sizeh(sizeh), leftborder(leftborder), topborder(topborder), minimap_mode(minimap_mode) +Minimap::Minimap(bool nox, int menuWidth, int gameWidth, int xOffset, int yOffset, int width, int height, MinimapMode minimapMode) + : noX(nox), menuWidth(menuWidth), gameWidth(gameWidth), xOffset(xOffset), yOffset(yOffset), width(width), height(height), minimapMode(minimapMode) { if (nox) return; update_row = -1; - surface=new DrawableSurface(sizew - leftborder * 2, sizeh - topborder * 2); + surface=new DrawableSurface(width, height); } @@ -59,6 +59,7 @@ void Minimap::draw(int localteam, int vi { if (noX) return; + // Compute the position of the minimap if it needs to be scaled computeMinimapPositioning(); Uint8 borderR; @@ -80,14 +81,24 @@ void Minimap::draw(int localteam, int vi borderB = 40; borderA = 180; } - globalContainer->gfx->drawFilledRect(px, py, sizew, topborder, borderR, borderG, borderB, borderA); - globalContainer->gfx->drawFilledRect(px, py + sizeh - topborder, sizew, topborder, borderR, borderG, borderB, borderA); - globalContainer->gfx->drawFilledRect(px, py + topborder, leftborder, sizeh - topborder*2, borderR, borderG, borderB, borderA); - globalContainer->gfx->drawFilledRect(px + sizew - leftborder, py + topborder, leftborder, sizeh-topborder*2, borderR, borderG, borderB, borderA); + // Fill the 4 sides of the menu around the minimap with the color above + // left side + globalContainer->gfx->drawFilledRect(gameWidth-menuWidth, 0, xOffset, height+yOffset, borderR, borderG, borderB, borderA); + // right side + globalContainer->gfx->drawFilledRect(gameWidth-menuWidth+xOffset+width, 0, menuWidth-xOffset-width, height+yOffset, borderR, borderG, borderB, borderA); + // top side + globalContainer->gfx->drawFilledRect(gameWidth-menuWidth+xOffset, 0, width, yOffset, borderR, borderG, borderB, borderA); + // bottom side not needed, because the menu draws up to it + //globalContainer->gfx->drawFilledRect(gameWidth-menuWidth+xOffset, yOffset+height, width, 0, borderR, borderG, borderB, borderA); - ///Draw a 1 pixel hilight arround the minimap - globalContainer->gfx->drawRect(px + leftborder - 1, py + topborder - 1, sizew - leftborder * 2 + 2, sizeh - topborder * 2 + 2, 200, 200, 200); - + ///Draw a 1 pixel border arround the minimap + globalContainer->gfx->drawRect(gameWidth-menuWidth+xOffset-1, + yOffset-1, + width+2, + height+2, + 200, 200, 200); + + // calculate the offset for the viewport square offset_x = game->teams[localteam]->startPosX - game->map.getW() / 2; offset_y = game->teams[localteam]->startPosY - game->map.getH() / 2; @@ -97,7 +108,7 @@ void Minimap::draw(int localteam, int vi //Render the colorMap and blit the surface if(update_row == -1) { - surface->drawFilledRect(0, 0, sizew - leftborder * 2, sizeh - topborder * 2, 0,0,0,Color::ALPHA_OPAQUE); + surface->drawFilledRect(0, 0, width, height, 0, 0, 0, Color::ALPHA_OPAQUE); update_row = 0; refreshPixelRows(0, mini_h, localteam); } @@ -112,7 +123,7 @@ void Minimap::draw(int localteam, int vi line_row = update_row; } //Draw the surface - globalContainer->gfx->drawSurface(px + leftborder, py + topborder, surface); + globalContainer->gfx->drawSurface(gameWidth-menuWidth+xOffset, yOffset, surface); //Draw the viewport square, taking into account that it may //wrap arround the sides of the minimap @@ -143,7 +154,7 @@ void Minimap::draw(int localteam, int vi globalContainer->gfx->drawPixel(endx, endy, 255, 255, 255); ///Draw the line that shows where the minimap is currently updating - if(minimap_mode == HideFOW) + if(minimapMode == HideFOW) globalContainer->gfx->drawHorzLine(mini_x, mini_y + line_row , mini_w, 100, 100, 100); } @@ -195,26 +206,30 @@ void Minimap::computeMinimapPositioning( void Minimap::computeMinimapPositioning() { if (noX) return; - - int msizew = sizew - leftborder*2; - int msizeh = sizeh - topborder*2; + if(game->map.getW() > game->map.getH()) { - mini_w = msizew; - mini_h = (game->map.getH() * msizeh) / game->map.getW(); + // If the width is greater than the height, normal width but shrink the height + mini_w = width; + mini_h = (game->map.getH()*height) / game->map.getW(); + // Once the minimap has been scaled, center it on the minimap mini_offset_x = 0; - mini_offset_y = (msizeh - mini_h)/2; - mini_x = px + leftborder + mini_offset_x; - mini_y = py + topborder + mini_offset_y; + mini_offset_y = (height-mini_h)/2; + // Now set the position of it on the whole screen + mini_x = gameWidth-menuWidth+xOffset+mini_offset_x; + mini_y = yOffset + mini_offset_y; } else { - mini_w = (game->map.getW() * msizew) / game->map.getH(); - mini_h = msizeh; - mini_offset_x = (msizew - mini_w)/2; + // Height is greater than width + mini_w = (game->map.getW()*width) / game->map.getH(); + mini_h = height; + // Center it.. + mini_offset_x = (width - mini_w)/2; mini_offset_y = 0; - mini_x = px + leftborder + mini_offset_x; - mini_y = py + topborder + mini_offset_y; + // And set the position for the screen! + mini_x = gameWidth-menuWidth+xOffset+mini_offset_x; + mini_y = yOffset + mini_offset_y; } } @@ -272,7 +287,7 @@ void Minimap::computeColors(int row, int const int dMy = ((game->map.getH())<<16) / (mini_h); const int decSPX=offset_x<<16, decSPY=offset_y<<16; - bool useMapDiscovered = minimap_mode == ShowFOW; + bool useMapDiscovered = minimapMode == ShowFOW; const int dy = row; for (int dx=0; dx