netpanzer-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netPanzer-CVS] netpanzer/src Lib/Log.cpp Lib/View/Desktop.cpp ...


From: Ivo Danihelka
Subject: [netPanzer-CVS] netpanzer/src Lib/Log.cpp Lib/View/Desktop.cpp ...
Date: Sat, 20 Sep 2003 13:52:48 -0400

CVSROOT:        /cvsroot/netpanzer
Module name:    netpanzer
Branch:         
Changes by:     Ivo Danihelka <address@hidden>  03/09/20 13:52:47

Modified files:
        src/Lib        : Log.cpp 
        src/Lib/View   : Desktop.cpp Desktop.hpp View.cpp View.hpp 
        src/NetPanzer/Interfaces: GameManager.cpp MouseInterface.cpp 
        src/NetPanzer/Views/Game: HelpScrollView.cpp HelpScrollView.hpp 
        src/NetPanzer/Views/MainMenu: MainMenuView.cpp 
        src/NetPanzer/Views/MainMenu/Multi: MapSelectionView.cpp 
        src/UILib/SDL  : SDLSound.cpp 

Log message:
        Solved higher resolutions problem in MainMenu

Patches:
Index: netpanzer/src/Lib/Log.cpp
diff -u netpanzer/src/Lib/Log.cpp:1.7 netpanzer/src/Lib/Log.cpp:1.8
--- netpanzer/src/Lib/Log.cpp:1.7       Fri Sep 19 20:05:28 2003
+++ netpanzer/src/Lib/Log.cpp   Sat Sep 20 13:52:45 2003
@@ -24,9 +24,7 @@
 #include <string>
 #include "Log.hpp"
 
-#ifdef DO_LOGGING
 Logger LOGGER;
-#endif
 
 // like syslog levels
 const int Logger::LEVEL_DEBUG = 7;
Index: netpanzer/src/Lib/View/Desktop.cpp
diff -u netpanzer/src/Lib/View/Desktop.cpp:1.11 
netpanzer/src/Lib/View/Desktop.cpp:1.12
--- netpanzer/src/Lib/View/Desktop.cpp:1.11     Tue Sep 16 16:16:10 2003
+++ netpanzer/src/Lib/View/Desktop.cpp  Sat Sep 20 13:52:46 2003
@@ -392,6 +392,19 @@
     }
 } // end Desktop::checkViewPositions
 
+// checkResolution
+//--------------------------------------------------------------------------
+// Purpose: Makes sure all the view are on the position.
+//--------------------------------------------------------------------------
+void Desktop::checkResolution(iXY lastResolution)
+{
+    std::vector<View*>::iterator i;
+    for(i = views.begin(); i != views.end(); i++) {
+        View* view = *i;
+        view->checkResolution(lastResolution);
+    }
+} // end Desktop::checkResolution
+
 // toggleVisibilityNoDoAnything
 //--------------------------------------------------------------------------
 // Purpose: Only changes whether a visibility of the view, no activate or
Index: netpanzer/src/Lib/View/Desktop.hpp
diff -u netpanzer/src/Lib/View/Desktop.hpp:1.5 
netpanzer/src/Lib/View/Desktop.hpp:1.6
--- netpanzer/src/Lib/View/Desktop.hpp:1.5      Tue Sep 16 16:16:10 2003
+++ netpanzer/src/Lib/View/Desktop.hpp  Sat Sep 20 13:52:46 2003
@@ -154,6 +154,7 @@
     }
 
     static void checkViewPositions();
+    static void checkResolution(iXY lastResolution);
 
     static const View *getFocus()
     {
Index: netpanzer/src/Lib/View/View.cpp
diff -u netpanzer/src/Lib/View/View.cpp:1.12 
netpanzer/src/Lib/View/View.cpp:1.13
--- netpanzer/src/Lib/View/View.cpp:1.12        Thu Sep 18 13:44:18 2003
+++ netpanzer/src/Lib/View/View.cpp     Sat Sep 20 13:52:46 2003
@@ -814,8 +814,8 @@
     assert(this != 0);
 
     if (getBordered()) {
-        dest.setTo(    getViewArea(),
-                    iRect(     borderSize,
+        dest.setTo( getViewArea(),
+                    iRect(borderSize,
                            borderSize + moveAreaHeight,
                            getSizeX() - borderSize,
                            getSizeY() - borderSize));
@@ -832,7 +832,7 @@
 Surface View::getClientArea()
 {
     if (getBordered()) {
-        return Surface(        getViewArea(),
+        return Surface( getViewArea(),
                         iXY(borderSize,
                             borderSize + moveAreaHeight),
                         iXY(getSizeX() - borderSize,
@@ -851,7 +851,7 @@
 iRect View::getClientRect() const
 {
     if (getBordered()) {
-        return iRect(  borderSize,
+        return iRect( borderSize,
                       borderSize + moveAreaHeight,
                       getSizeX() - borderSize,
                       getSizeY() - borderSize);
@@ -1662,6 +1662,18 @@
     max.y = min.y + oldSize.y;
 } // end centerAbsolute
 
+// checkResolution
+//---------------------------------------------------------------------------
+// Purpose: Check position after resolution change
+//---------------------------------------------------------------------------
+void View::checkResolution(iXY lastResolution)
+{
+    iXY oldSize = getSize();
+    min.x += (SCREEN_XPIX - lastResolution.x) >> 1;
+    min.y += (SCREEN_YPIX - lastResolution.y) >> 1;
+    max = min + oldSize;
+} // end checkResolution
+
 // RESIZE CLIENT AREA
 //---------------------------------------------------------------------------
 // Purpose: Resize the client area of the window.  The window area will be
@@ -1707,22 +1719,17 @@
 {
     iXY destSize(size);
 
-    if      (destSize.x <= RESIZE_XMINSIZE) {
-        destSize.y = SCREEN_YPIX - min.y;
+    if (destSize.x <= RESIZE_XMINSIZE) {
+        destSize.x = RESIZE_XMINSIZE;
     }
     else if (destSize.x >  SCREEN_XPIX - min.x) {
         destSize.x = SCREEN_XPIX - min.x;
     }
 
-    if      (destSize.y <= RESIZE_YMINSIZE) {
+    if (destSize.y <= RESIZE_YMINSIZE) {
         destSize.y = RESIZE_YMINSIZE;
     } else if (destSize.y >  SCREEN_YPIX - min.y) {
         destSize.y = SCREEN_YPIX - min.y;
-    }
-
-    // Are we already at the desired size?  Then bail.
-    if (size == getSize()) {
-        return;
     }
 
     max = min + destSize;
Index: netpanzer/src/Lib/View/View.hpp
diff -u netpanzer/src/Lib/View/View.hpp:1.5 netpanzer/src/Lib/View/View.hpp:1.6
--- netpanzer/src/Lib/View/View.hpp:1.5 Tue Sep 16 16:16:11 2003
+++ netpanzer/src/Lib/View/View.hpp     Sat Sep 20 13:52:46 2003
@@ -238,6 +238,7 @@
     void showStatus(const char *string);
     void drawStatus(const Surface &dest);
     void centerAbsolute();
+    void checkResolution(iXY lastResolution);
     void toggleView();
     iXY  getScreenToClientPos(const iXY &pos);
     iXY  getScreenToViewPos(const iXY &pos);
Index: netpanzer/src/NetPanzer/Interfaces/GameManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.46 
netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.47
--- netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.46     Fri Sep 19 
20:05:29 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameManager.cpp  Sat Sep 20 13:52:46 2003
@@ -261,6 +261,7 @@
 // ******************************************************************
 void GameManager::setVideoMode()
 {
+    iXY lastResolution(SCREEN_XPIX, SCREEN_YPIX);
     iXY mode_res;
     bool fullscreen = GameConfig::getFullscreen();
 
@@ -290,6 +291,7 @@
     screen.createNoAlloc(mode_res);
     gameView.setSize(mode_res);
 
+    Desktop::checkResolution(lastResolution);
     Desktop::checkViewPositions();
     //ConsoleInterface::setToSurfaceSize( mode_res );
 
@@ -1546,6 +1548,8 @@
     if (once) {
         once = false;
         Desktop::setVisibility("MainView", true);
+        // XXX hack, original resolution was 640x480
+        Desktop::checkResolution(iXY(640, 480));
     }
 
     TimerInterface::start();
Index: netpanzer/src/NetPanzer/Interfaces/MouseInterface.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/MouseInterface.cpp:1.13 
netpanzer/src/NetPanzer/Interfaces/MouseInterface.cpp:1.14
--- netpanzer/src/NetPanzer/Interfaces/MouseInterface.cpp:1.13  Tue Sep 16 
16:16:12 2003
+++ netpanzer/src/NetPanzer/Interfaces/MouseInterface.cpp       Sat Sep 20 
13:52:46 2003
@@ -65,13 +65,14 @@
     const char* cursorpath = "pics/cursors/";
     char** cursorfiles = FileSystem::enumerateFiles(cursorpath);
     for(char** i = cursorfiles; *i != 0; i++) {
-        if(*i[0]=='.')
-            continue;
         Surface* surface = new Surface;
         try {
             std::string filename = cursorpath;
             filename += *i;
-            surface->loadBMP(filename.c_str());
+            if(FileSystem::isDirectory(filename.c_str())) {
+                continue;
+            }
+            
surface->loadBMP(FileSystem::getRealName(filename.c_str()).c_str());
             surface->setOffsetCenter();
             cursors.insert(std::pair<std::string,Surface*> (*i, surface));
         } catch(Exception& e) {
Index: netpanzer/src/NetPanzer/Views/Game/HelpScrollView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/HelpScrollView.cpp:1.8 
netpanzer/src/NetPanzer/Views/Game/HelpScrollView.cpp:1.9
--- netpanzer/src/NetPanzer/Views/Game/HelpScrollView.cpp:1.8   Tue Sep 16 
16:16:12 2003
+++ netpanzer/src/NetPanzer/Views/Game/HelpScrollView.cpp       Sat Sep 20 
13:52:47 2003
@@ -203,18 +203,6 @@
 
 } // end HelpScrollView::insert
 
-// processEvents
-//--------------------------------------------------------------------------
-void HelpScrollView::processEvents()
-{
-    if (Desktop::getVisible("GameView")) {
-        centerAbsolute();
-    } else {
-        moveTo(bodyTextRect.min);
-    }
-
-} // end HelpScrollView::processEvents
-
 // actionPerformed
 //--------------------------------------------------------------------------
 void HelpScrollView::actionPerformed(mMouseEvent me)
@@ -237,10 +225,5 @@
 //--------------------------------------------------------------------------
 void HelpScrollView::doActivate()
 {
-    if (Desktop::getVisible("GameView")) {
-        centerAbsolute();
-    } else {
-        moveTo(bodyTextRect.min);
-    }
-
+    /* empty */
 } // end HelpScrollView::doActivate
Index: netpanzer/src/NetPanzer/Views/Game/HelpScrollView.hpp
diff -u netpanzer/src/NetPanzer/Views/Game/HelpScrollView.hpp:1.3 
netpanzer/src/NetPanzer/Views/Game/HelpScrollView.hpp:1.4
--- netpanzer/src/NetPanzer/Views/Game/HelpScrollView.hpp:1.3   Tue Sep 16 
16:16:12 2003
+++ netpanzer/src/NetPanzer/Views/Game/HelpScrollView.hpp       Sat Sep 20 
13:52:47 2003
@@ -56,7 +56,6 @@
     }
 
     virtual void doDraw(const Surface &windowArea, const Surface &clientArea);
-    virtual void processEvents();
     virtual void actionPerformed(mMouseEvent me);
     virtual void doActivate();
 }
Index: netpanzer/src/NetPanzer/Views/MainMenu/MainMenuView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/MainMenuView.cpp:1.7 
netpanzer/src/NetPanzer/Views/MainMenu/MainMenuView.cpp:1.8
--- netpanzer/src/NetPanzer/Views/MainMenu/MainMenuView.cpp:1.7 Tue Sep 16 
16:16:13 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/MainMenuView.cpp     Sat Sep 20 
13:52:47 2003
@@ -48,7 +48,7 @@
 {
     MenuTemplateView::doDraw(viewArea, clientArea);
 
-    static char        text[] =
+    static char text[] =
         "This is NetPanzer, a massively multiplayer tank battle game.  "
         "This application is free software under the terms of the "
         "Gnu General Public license (GPL). See the COPYING file for details."
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/MapSelectionView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/MapSelectionView.cpp:1.12 
netpanzer/src/NetPanzer/Views/MainMenu/Multi/MapSelectionView.cpp:1.13
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/MapSelectionView.cpp:1.12      
Sat Sep 20 03:52:36 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/MapSelectionView.cpp   Sat Sep 
20 13:52:47 2003
@@ -166,7 +166,8 @@
     mapList.setNum(mapfiles.size());
 
     for (unsigned int i = 0; i < mapfiles.size(); i++) {
-        FILE *fp = fopen(mapfiles[i].c_str(), "rb");
+        FILE *fp =
+            fopen(FileSystem::getRealName(mapfiles[i].c_str()).c_str(), "rb");
         if (fp == 0) {
             LOGGER.warning("cannot open map file '%s'", mapfiles[i].c_str());
             continue;
@@ -185,7 +186,8 @@
                             throw Exception("Map description is too long.");
                     }
         */
-        _splitpath(mapfiles[i].c_str(), 0, 0, mapList[i].name, 0);
+        _splitpath(FileSystem::getRealName(mapfiles[i].c_str()).c_str(),
+                0, 0, mapList[i].name, 0);
         sprintf(mapList[i].description, "%s", netPanzerMapHeader.description);
 
         mapList[i].cells.x = netPanzerMapHeader.x_size;
Index: netpanzer/src/UILib/SDL/SDLSound.cpp
diff -u netpanzer/src/UILib/SDL/SDLSound.cpp:1.11 
netpanzer/src/UILib/SDL/SDLSound.cpp:1.12
--- netpanzer/src/UILib/SDL/SDLSound.cpp:1.11   Thu Sep 18 13:44:18 2003
+++ netpanzer/src/UILib/SDL/SDLSound.cpp        Sat Sep 20 13:52:47 2003
@@ -295,7 +295,7 @@
                   toplay, e.getMessage()));
         }
 #else
-        music = Mix_LoadMUS(toplay);
+        music = Mix_LoadMUS(FileSystem::getRealName(toplay).c_str());
         if (music) {
             if (Mix_PlayMusic(music, 1) == 0) {
                 LOG (("Start playing song '%s'", toplay));




reply via email to

[Prev in Thread] Current Thread [Next in Thread]