[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netPanzer-CVS] netpanzer/src/NetPanzer Views/Game/MiniMapView....
From: |
Hankin Chick |
Subject: |
[netPanzer-CVS] netpanzer/src/NetPanzer Views/Game/MiniMapView.... |
Date: |
Mon, 24 Nov 2003 19:21:03 -0500 |
CVSROOT: /cvsroot/netpanzer
Module name: netpanzer
Branch:
Changes by: Hankin Chick <address@hidden> 03/11/24 19:21:03
Modified files:
src/NetPanzer/Views/Game: MiniMapView.cpp MiniMapView.hpp
src/NetPanzer/Interfaces: MiniMapInterface.cpp
Log message:
Putting back the old map, buttons caused memory problems.
Patches:
Index: netpanzer/src/NetPanzer/Interfaces/MiniMapInterface.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/MiniMapInterface.cpp:1.13
netpanzer/src/NetPanzer/Interfaces/MiniMapInterface.cpp:1.14
--- netpanzer/src/NetPanzer/Interfaces/MiniMapInterface.cpp:1.13 Mon Nov
24 08:14:56 2003
+++ netpanzer/src/NetPanzer/Interfaces/MiniMapInterface.cpp Mon Nov 24
19:21:03 2003
@@ -26,7 +26,6 @@
#include "PathScheduler.hpp"
#include "ObjectiveInterface.hpp"
#include "GameConfig.hpp"
-#include "MiniMapView.hpp"
fXY MiniMapInterface::scale_factor;
bool MiniMapInterface::pathing_debug_mode = false;
@@ -89,7 +88,7 @@
while( UnitInterface::unitPositionEnumeration(
&unit_dispostion,&unit_state ) ) {
map_loc.x = int(float(unit_state->location.x) / scale_factor.x);
- map_loc.y = int(float(unit_state->location.y) /
scale_factor.y)+MiniMapView::buttonSize.y;
+ map_loc.y = int(float(unit_state->location.y) / scale_factor.y);
if (gameconfig->radar_unitsize == _mini_map_unit_size_large) {
unitRect = iRect(map_loc, map_loc + iXY(1,1));
@@ -170,8 +169,6 @@
map_rect.min.y = int(float(world_rect.min.y) / scale_factor.y);
map_rect.max.x = int(float(world_rect.max.x) / scale_factor.x);
map_rect.max.y = int(float(world_rect.max.y) / scale_factor.y);
- map_rect.min.y+=MiniMapView::buttonSize.y;
- map_rect.max.y+=MiniMapView::buttonSize.y;
// Removed black borders to the text.
if (gameconfig->radar_objectivedrawmode ==
_mini_map_objective_draw_mode_solid_rect) {
@@ -203,8 +200,6 @@
src.x = int(float(obj_state->location.x) / scale_factor.x);
src.y = int(float(obj_state->location.y) / scale_factor.y);
- src.y+=MiniMapView::buttonSize.y;
- dest.y+=MiniMapView::buttonSize.y;
map_surface.drawLine(src.x, src.y, dest.x, dest.y, color);
}
}
Index: netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp:1.25
netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp:1.26
--- netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp:1.25 Mon Nov 24
08:14:55 2003
+++ netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp Mon Nov 24 19:21:03 2003
@@ -26,17 +26,13 @@
#include "ScreenSurface.hpp"
#include "WorldInputCmdProcessor.hpp"
#include "GameConfig.hpp"
-#include "GameViewGlobals.hpp"
-#include "Util/Log.hpp"
+MiniMapView miniMapView;
float MiniMapView::scaleDelta = 400.0f;
int MiniMapView::decreaseSize = 0;
int MiniMapView::increaseSize = 0;
-iXY MiniMapView::buttonSize(12,12);
-
-MiniMapView miniMapView;
// MiniMapView
//---------------------------------------------------------------------------
@@ -56,27 +52,6 @@
add(CLOSE_VIEW_BUTTON);
add(MINMAX_VIEW_BUTTON);
- iXY pos(1,1);
- scaleDownButton.setLabel("<");
- scaleDownButton.setBounds(iRect(pos, pos + buttonSize));
- add(&scaleDownButton);
- pos.x+=buttonSize.x;
-
- scaleUpButton.setLabel(">");
- scaleUpButton.setBounds(iRect(pos, pos + buttonSize));
- add(&scaleUpButton);
- pos.x+=buttonSize.x;
-
- shadeButton.setLabel("o");
- shadeButton.setBounds(iRect(pos, pos + buttonSize));
- add(&shadeButton);
- pos.x+=buttonSize.x;
-
- dotSizeButton.setLabel(".");
- dotSizeButton.setBounds(iRect(pos, pos + buttonSize));
- add(&dotSizeButton);
- pos.x+=buttonSize.x;
-
resize(100, 100);
} // end MiniMapView::MiniMapView
@@ -88,18 +63,19 @@
miniMap = MiniMapInterface::getMiniMap();
//iXY size = miniMap->getPix();
- iXY size(((const iXY &)gameconfig->minimapsize)+iXY(2,2+buttonSize.y));
+ iXY size(((const iXY &)gameconfig->minimapsize)+iXY(2,2));
resize(size);
if(gameconfig->minimapposition.isDefaultValue()) {
gameconfig->minimapposition = iXY(0, screen->getPix().y - 196);
}
moveTo(gameconfig->minimapposition);
+ checkArea(screen->getPix());
//int xOffset = size.x;
//int yOffset = 0;
- setMapScale();
+ MiniMapInterface::setMapScale(getSize() - iXY(2,2));
checkArea(screen->getPix());
minMapSize = 64;
@@ -138,13 +114,6 @@
Surface *miniMap;
miniMap = MiniMapInterface::getMiniMap();
- iRect r(iXY(0,0), getSize());
- iRect buttonsRect(r);
-
- buttonsRect.max.y=buttonSize.y+1;
- r.min.y+=buttonSize.y;
- bltBlendRect(viewArea,buttonsRect);
-
if (needScale) {
scaleGroupWait += dt;
@@ -152,7 +121,7 @@
miniMapSurface.create(getSize(), getSize().x , 1);
//miniMapSurface.scale(getViewRect().getSize());
-// iRect r(iXY(0, 0), getSize());
+ iRect r(iXY(0, 0), getSize());
miniMapSurface.bltScale(*miniMap, r);
@@ -161,6 +130,7 @@
}
}
+ iRect r(iXY(0,0), getSize());
int mapDrawType=gameconfig->minimapdrawtype;
if (needScale) {
@@ -212,7 +182,7 @@
// Draw the world view box.
iRect boxpos = MiniMapInterface::getWorldWindow();
- boxpos.translate(iXY(1,1+buttonSize.y));
+ boxpos.translate(iXY(1,1));
clientArea.bltLookup(boxpos, Palette::darkGray256.getColorArray());
// Draw the units and such on the minimap.
@@ -222,7 +192,7 @@
// If the mouse is over the client area, then change the cursor.
if (getClientRect().contains(getScreenToClientPos(mouse.getScreenPos()))) {
- if (selectionAnchor && mouse.getScreenPos().y>=buttonSize.y) {
+ if (selectionAnchor) {
// Since we are selecting units, draw the selection box.
clientArea.drawRect(selectionAnchorDownPos, selectionAnchorCurPos,
Color::white);
} else {
@@ -266,9 +236,7 @@
iXY pos(getScreenToClientPos(mouse.getScreenPos()));
//dest.drawRect(pos - size - 1, pos + size - 1, Color::yellow);
- if(pos.y>=buttonSize.y) {
- dest.drawBoxCorners(pos - size - iXY(1,1), iXY(pos.x + size.x - 1,
pos.y + size.y), 5, Color::red);
- }
+ dest.drawBoxCorners(pos - size - iXY(1,1), iXY(pos.x + size.x - 1, pos.y +
size.y), 5, Color::red);
} // end MiniMapView::drawMouseBox
@@ -281,44 +249,15 @@
{
assert(this != 0);
- if(!setViewWindowFromMouse(pos)) {
- GameTemplateView::lMouseDown(pos);
- }
-} // end MiniMapView::lMouseDown
-
-bool MiniMapView::setViewWindowFromMouse(const iXY &pos)
-{
- if (pos.y>=buttonSize.y) {
- if(getClientRect().contains(getScreenToClientPos(mouse.getScreenPos()))
- && !selectionAnchor) {
- setViewWindow(pos-iXY(0,buttonSize.y));
+ if (getClientRect().contains(getScreenToClientPos(mouse.getScreenPos()))) {
+ if (!selectionAnchor) {
+ setViewWindow(pos);
}
- return true;
}
- return false;
-}
+ GameTemplateView::lMouseDown(pos);
-void MiniMapView::actionPerformed(mMouseEvent me)
-{
- assert(this != 0);
-
-
- if (me.getID() == mMouseEvent::MOUSE_EVENT_CLICKED) {
- if (me.getSource(shadeButton)) {
- int newtype=(gameconfig->minimapdrawtype+1)%MAP_DRAW_TYPES_MAX;
- setMapDrawType(newtype);
- } else if (me.getSource(scaleUpButton)) {
- increaseSize = -1;
- } else if (me.getSource(scaleDownButton)) {
- decreaseSize = -1;
- } else if (me.getSource(dotSizeButton)) {
- gameconfig->radar_unitsize =
gameconfig->radar_unitsize==_mini_map_unit_size_large?_mini_map_unit_size_small:_mini_map_unit_size_large;
- }
- }
- GameTemplateView::actionPerformed(me);
-}
-
+} // end MiniMapView::lMouseDown
// rMouseDown
//--------------------------------------------------------------------------
@@ -328,7 +267,7 @@
} // end MiniMapView::rMouseDown
-void MiniMapView::setMapDrawType(int type)
+void MiniMapView::setMapDrawType(MAP_DRAW_TYPES type)
{
gameconfig->minimapdrawtype=type;
}
@@ -370,13 +309,6 @@
} // end MiniMapView::rMouseDrag
-
-void MiniMapView::setMapScale()
-{
- MiniMapInterface::setMapScale(getSize() - iXY(2,2+buttonSize.y));
-}
-
-
// doIncreaseSize
//--------------------------------------------------------------------------
void MiniMapView::doIncreaseSize(int value)
@@ -447,7 +379,7 @@
}
}
- setMapScale();
+ MiniMapInterface::setMapScale(getSize() - iXY(2,2));
needScale = true;
scaleGroupWait = 0.0f;
@@ -474,7 +406,7 @@
resize(iXY(minMapSize, minMapSize));
}
- setMapScale();
+ MiniMapInterface::setMapScale(getSize() - iXY(2,2));
needScale = true;
scaleGroupWait = 0.0f;
@@ -561,8 +493,6 @@
//--------------------------------------------------------------------------
void MiniMapView::lMouseDrag(const iXY &downPos, const iXY &prevPos, const iXY
&newPos)
{
-// lMouseDown(newPos);
- setViewWindowFromMouse(newPos);
+ lMouseDown(newPos);
} // end MiniMapView::lMouseDrag
-
Index: netpanzer/src/NetPanzer/Views/Game/MiniMapView.hpp
diff -u netpanzer/src/NetPanzer/Views/Game/MiniMapView.hpp:1.7
netpanzer/src/NetPanzer/Views/Game/MiniMapView.hpp:1.8
--- netpanzer/src/NetPanzer/Views/Game/MiniMapView.hpp:1.7 Mon Nov 24
08:14:56 2003
+++ netpanzer/src/NetPanzer/Views/Game/MiniMapView.hpp Mon Nov 24 19:21:03 2003
@@ -21,7 +21,6 @@
#include "View.hpp"
#include "2D/Surface.hpp"
#include "GameTemplateView.hpp"
-#include "Button.hpp"
enum MAP_DRAW_TYPES
@@ -34,7 +33,6 @@
MAP_BLEND_GREEN,
MAP_BLACK,
MAP_TRANSPARENT,
- MAP_DRAW_TYPES_MAX
};
//---------------------------------------------------------------------------
@@ -50,10 +48,6 @@
bool selectionAnchor;
iXY selectionAnchorDownPos;
iXY selectionAnchorCurPos;
- Button scaleUpButton;
- Button scaleDownButton;
- Button dotSizeButton;
- Button shadeButton;
void doDecreaseSize(int value);
void doIncreaseSize(int value);
@@ -69,18 +63,14 @@
virtual void lMouseDrag(const iXY &downPos, const iXY &prevPos, const iXY
&newPos);
virtual void rMouseDrag(const iXY &downPos, const iXY &prevPos, const iXY
&newPos);
virtual void rMouseDown(const iXY &pos);
- virtual void actionPerformed(mMouseEvent me);
virtual void mouseMove(const iXY &prevPos, const iXY &newPos);
- void setMapScale();
void drawMouseBox(Surface &dest);
void setViewWindow(const iXY &pos);
- void setMapDrawType(int type);
- bool setViewWindowFromMouse(const iXY &pos);
+ void setMapDrawType(MAP_DRAW_TYPES type);
static float scaleDelta;
- static iXY buttonSize;
static int decreaseSize;
static int increaseSize;