Commit ecffee12 authored by Gerhard Stein's avatar Gerhard Stein

added HUD Code in Galaxy Engine

parent b8367dec
......@@ -115,7 +115,10 @@ void CHUD::CreateBackground()
*/
void CHUD::CreateBackgroundGalaxy()
{
// Draw the HUD Box Galaxy. In Episode 4 it's Sprite 129
CSprite &HUDBox = g_pGfxEngine->getSprite(129);
HUDBox.drawSprite(mp_Background, 0, 0);
}
// Draw a circle on the surface
......@@ -125,9 +128,7 @@ void CHUD::DrawCircle(int x, int y, int width)
Uint8 r,g,b;
CFont &Font = g_pGfxEngine->getFont(0);
//Uint32 bgcolor = Font.getBGColour(false);
Font.getBGColour(false, &r, &g, &b);
//SDL_GetRGB(bgcolor, mp_Background->format, &r, &g, &b);
outline.x = x+4;
outline.y = y;
......@@ -167,9 +168,25 @@ void CHUD::DrawCircle(int x, int y, int width)
}
/**
* \brief This part of the code will render the entire HUD
* \brief This part of the code will render the entire HUD. Galaxy Version
*/
void CHUD::render()
void CHUD::renderGalaxy()
{
// Compute the score that really will be seen
int score, lives, charges;
score = (m_score<999999999) ? m_score : 999999999;
lives = (m_lives<99) ? m_lives : 99;
charges = (m_charges<99) ? m_charges : 99;
SDL_Surface *blitsurface = g_pVideoDriver->getBlitSurface();
// Draw the background
SDL_BlitSurface( mp_Background, NULL, blitsurface, &m_Rect);
}
/**
* \brief This part of the code will render the entire HUD. Vorticon version
*/
void CHUD::renderVorticon()
{
// Compute the score that really will be seen
int score, lives, charges;
......@@ -196,6 +213,19 @@ void CHUD::render()
Font.setFGColour(blitsurface->format, 0x0);
}
/**
* \brief This part of the code will render the entire HUD
*/
void CHUD::render()
{
size_t Episode = g_pBehaviorEngine->getEpisode();
if( Episode>=1 && Episode<=3 )
renderVorticon();
else if( Episode>=4 && Episode<=6 )
renderGalaxy();
}
CHUD::~CHUD() {
if(mp_Background) SDL_FreeSurface(mp_Background);
......
......@@ -28,6 +28,8 @@ private:
void CreateBackground();
void CreateBackgroundGalaxy();
void renderGalaxy();
void renderVorticon();
void DrawCircle(int x, int y, int width);
SDL_Rect m_Rect;
......
......@@ -9,7 +9,7 @@
CInventory::CInventory() :
mp_HUD(m_points, m_lifes, m_bullets)
m_HUD(m_points, m_lifes, m_bullets)
{
reset();
}
......@@ -32,4 +32,9 @@ void CInventory::reset()
m_special.ep4.swimsuit = 0;
}
void CInventory::drawHUD()
{
m_HUD.render();
}
......@@ -17,8 +17,8 @@
class CInventory {
public:
CInventory();
void reset();
void drawHUD();
signed char m_lifes;
unsigned long m_points;
......@@ -49,7 +49,7 @@ public:
}ep6;
}m_special;
CHUD mp_HUD;
CHUD m_HUD;
};
......
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