[Add] Added RGB method in addition to SDL_Color in the text class.

This commit is contained in:
Rtch90 2011-12-07 22:22:23 +00:00
parent a849f94abd
commit 205889c0e5
4 changed files with 33 additions and 1 deletions

View File

@ -24,8 +24,13 @@ MainMenu::MainMenu(void) {
btnExit.SetTextRGB(0, 0, 0);
btnExit.SetText("Exit");
btnExit.SetXY(100, 250);
menuLabel.SetXY(100, 50);
menuLabel.SetTextBlended("MainMenu", "large", 0, 0, 0);
m_background = new Map;
m_background->Load("MainMenu");
camera.x = 0;
camera.y = 0;
}
@ -63,6 +68,8 @@ int MainMenu::HandleInput(void) {
void MainMenu::Render(void) {
m_background->Render();
menuLabel.Render();
btnNewGame.Render();
btnLoadGame.Render();
btnOptions.Render();

View File

@ -1,10 +1,10 @@
#ifndef _MAINMENU_H_
#define _MAINMENU_H_
#include "../Unuk/Constants.h"
#include "ParticleEmitter.h"
#include "Menu.h"
#include "Map.h"
#include "Rect.h"
#include "Text.h"
const int MAIN_MENU_NOTHING = 0;
const int MAIN_MENU_NEW_GAME = 1;
@ -23,6 +23,8 @@ public:
private:
Map* m_background;
Text menuLabel;
Button btnNewGame;
Button btnLoadGame;
Button btnOptions;

View File

@ -74,6 +74,11 @@ int Text::SetTextBlended(string textArg, string size, SDL_Color colour) {
}
}
int Text::SetTextBlended(string textArg, string size, Uint8 r, Uint8 g, Uint8 b) {
SDL_Color f = { r, g, b };
return SetTextBlended(textArg, size, f);
}
int Text::SetTextShaded(string textArg, string size, SDL_Color colour, SDL_Color bgColour) {
m_textContents = textArg;
@ -103,10 +108,24 @@ int Text::SetTextShaded(string textArg, string size, SDL_Color colour, SDL_Color
}
}
int Text::SetTextShaded(string textArg, string size, Uint8 rF, Uint8 gF, Uint8 bF, Uint8 rB, Uint8 gB, Uint8 bB) {
SDL_Color f = { rF, gF, bF };
SDL_Color b = { rB, gB, bB };
return SetTextShaded(textArg, size, f, b);
}
void Text::Render(void) {
ApplySurface(x, y, m_text, screen);
}
void Text::Render(int xArg, int yArg) {
ApplySurface(xArg, yArg, m_text, screen);
}
void Text::RenderLiteral(void) {
ApplySurfaceLiteral(x, y, m_text, screen);
}
void Text::RenderLiteral(int xArg, int yArg) {
ApplySurfaceLiteral(xArg, yArg, m_text, screen);
}

View File

@ -29,10 +29,14 @@ public:
void SetXY(int xArg, int yArg);
int SetTextBlended(string textArg, string size, SDL_Color);
int SetTextBlended(string textArg, string size, Uint8 r, Uint8 g, Uint8 b);
int SetTextShaded(string textArg, string size, SDL_Color, SDL_Color);
int SetTextShaded(string textArg, string size, Uint8 rF, Uint8 gF, Uint8 bF, Uint8 rB, Uint8 gB, Uint8 bB);
void Render(void);
void Render(int xArg, int yArg);
void RenderLiteral(void);
void RenderLiteral(int xArg, int yArg);
private:
int x, y, w, h;