Commit cba20640 authored by Gerhard Stein's avatar Gerhard Stein

some cleanups and encapsulation

parent 06bc5eb4
...@@ -28,6 +28,13 @@ bool CPlayGameGalaxy::loadGameState() ...@@ -28,6 +28,13 @@ bool CPlayGameGalaxy::loadGameState()
// Setup for the ingame // Setup for the ingame
bool CPlayGameGalaxy::init() bool CPlayGameGalaxy::init()
{
loadLevel();
return false;
}
void CPlayGameGalaxy::loadLevel()
{ {
// Load the Level map. We have two modes. Inlevel and game map // Load the Level map. We have two modes. Inlevel and game map
...@@ -37,15 +44,12 @@ bool CPlayGameGalaxy::init() ...@@ -37,15 +44,12 @@ bool CPlayGameGalaxy::init()
m_Map.setTileMap(g_pGfxEngine->getTileMap(0)); m_Map.setTileMap(g_pGfxEngine->getTileMap(0));
m_Map.setScrollSurface(g_pVideoDriver->getScrollSurface()); m_Map.setScrollSurface(g_pVideoDriver->getScrollSurface());
MapLoader.loadMap(m_Map, 0); // Map Level? MapLoader.loadMap(m_Map, m_Level); // Map Level?
//m_Map.drawAll(); //m_Map.drawAll();
m_Map.gotoPos(0, 0); // Coordinates of star sky m_Map.gotoPos(0, 0); // Coordinates of star sky
return false;
} }
// The main ingame process cycle when keen galaxy is up and running // The main ingame process cycle when keen galaxy is up and running
void CPlayGameGalaxy::process() void CPlayGameGalaxy::process()
{ {
...@@ -68,27 +72,37 @@ void CPlayGameGalaxy::processInput() ...@@ -68,27 +72,37 @@ void CPlayGameGalaxy::processInput()
m_endgame = true; m_endgame = true;
} }
if(g_pInput->getPressedCommand(IC_LEFT)) if(g_pInput->getHoldedCommand(IC_LEFT))
{ {
if(m_posx>0) if(m_posx>0)
m_posx--; m_posx--;
} }
else if(g_pInput->getPressedCommand(IC_RIGHT)) else if(g_pInput->getHoldedCommand(IC_RIGHT))
{ {
if(m_posx<m_Map.m_width) if(m_posx<m_Map.m_width)
m_posx++; m_posx++;
} }
if(g_pInput->getPressedCommand(IC_UP)) if(g_pInput->getHoldedCommand(IC_UP))
{ {
if(m_posy>0) if(m_posy>0)
m_posy--; m_posy--;
} }
else if(g_pInput->getPressedCommand(IC_DOWN)) else if(g_pInput->getHoldedCommand(IC_DOWN))
{ {
if(m_posy<m_Map.m_height) if(m_posy<m_Map.m_height)
m_posy++; m_posy++;
} }
if(g_pInput->getPressedCommand(IC_STATUS))
{
if(m_Level < 20)
m_Level++;
else
m_Level = 0;
loadLevel();
}
} }
void CPlayGameGalaxy::processRendering() void CPlayGameGalaxy::processRendering()
...@@ -106,6 +120,7 @@ void CPlayGameGalaxy::processRendering() ...@@ -106,6 +120,7 @@ void CPlayGameGalaxy::processRendering()
} }
g_pGfxEngine->getFont(0).drawFont(g_pVideoDriver->BlitSurface, "Press the arrows to scroll, ESC to quit", 10, 10); g_pGfxEngine->getFont(0).drawFont(g_pVideoDriver->BlitSurface, "Press the arrows to scroll, ESC to quit", 10, 10);
g_pGfxEngine->getFont(0).drawFont(g_pVideoDriver->BlitSurface, "Enter to switch Level", 10, 20);
} }
......
...@@ -22,6 +22,7 @@ public: ...@@ -22,6 +22,7 @@ public:
stOption *p_option); stOption *p_option);
bool loadGameState(); bool loadGameState();
void loadLevel();
bool init(); bool init();
void process(); void process();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment