[Add] Added RGB method in addition to SDL_Color in the text class.
This commit is contained in:
parent
a849f94abd
commit
205889c0e5
@ -24,8 +24,13 @@ MainMenu::MainMenu(void) {
|
|||||||
btnExit.SetTextRGB(0, 0, 0);
|
btnExit.SetTextRGB(0, 0, 0);
|
||||||
btnExit.SetText("Exit");
|
btnExit.SetText("Exit");
|
||||||
btnExit.SetXY(100, 250);
|
btnExit.SetXY(100, 250);
|
||||||
|
|
||||||
|
menuLabel.SetXY(100, 50);
|
||||||
|
menuLabel.SetTextBlended("MainMenu", "large", 0, 0, 0);
|
||||||
|
|
||||||
m_background = new Map;
|
m_background = new Map;
|
||||||
m_background->Load("MainMenu");
|
m_background->Load("MainMenu");
|
||||||
|
|
||||||
camera.x = 0;
|
camera.x = 0;
|
||||||
camera.y = 0;
|
camera.y = 0;
|
||||||
}
|
}
|
||||||
@ -63,6 +68,8 @@ int MainMenu::HandleInput(void) {
|
|||||||
void MainMenu::Render(void) {
|
void MainMenu::Render(void) {
|
||||||
m_background->Render();
|
m_background->Render();
|
||||||
|
|
||||||
|
menuLabel.Render();
|
||||||
|
|
||||||
btnNewGame.Render();
|
btnNewGame.Render();
|
||||||
btnLoadGame.Render();
|
btnLoadGame.Render();
|
||||||
btnOptions.Render();
|
btnOptions.Render();
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#ifndef _MAINMENU_H_
|
#ifndef _MAINMENU_H_
|
||||||
#define _MAINMENU_H_
|
#define _MAINMENU_H_
|
||||||
#include "../Unuk/Constants.h"
|
#include "../Unuk/Constants.h"
|
||||||
#include "ParticleEmitter.h"
|
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "Map.h"
|
#include "Map.h"
|
||||||
#include "Rect.h"
|
#include "Rect.h"
|
||||||
|
#include "Text.h"
|
||||||
|
|
||||||
const int MAIN_MENU_NOTHING = 0;
|
const int MAIN_MENU_NOTHING = 0;
|
||||||
const int MAIN_MENU_NEW_GAME = 1;
|
const int MAIN_MENU_NEW_GAME = 1;
|
||||||
@ -23,6 +23,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
Map* m_background;
|
Map* m_background;
|
||||||
|
|
||||||
|
Text menuLabel;
|
||||||
|
|
||||||
Button btnNewGame;
|
Button btnNewGame;
|
||||||
Button btnLoadGame;
|
Button btnLoadGame;
|
||||||
Button btnOptions;
|
Button btnOptions;
|
||||||
|
@ -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) {
|
int Text::SetTextShaded(string textArg, string size, SDL_Color colour, SDL_Color bgColour) {
|
||||||
m_textContents = textArg;
|
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) {
|
void Text::Render(void) {
|
||||||
ApplySurface(x, y, m_text, screen);
|
ApplySurface(x, y, m_text, screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Text::Render(int xArg, int yArg) {
|
||||||
|
ApplySurface(xArg, yArg, m_text, screen);
|
||||||
|
}
|
||||||
|
|
||||||
void Text::RenderLiteral(void) {
|
void Text::RenderLiteral(void) {
|
||||||
ApplySurfaceLiteral(x, y, m_text, screen);
|
ApplySurfaceLiteral(x, y, m_text, screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Text::RenderLiteral(int xArg, int yArg) {
|
||||||
|
ApplySurfaceLiteral(xArg, yArg, m_text, screen);
|
||||||
|
}
|
||||||
|
@ -29,10 +29,14 @@ public:
|
|||||||
void SetXY(int xArg, int yArg);
|
void SetXY(int xArg, int yArg);
|
||||||
|
|
||||||
int SetTextBlended(string textArg, string size, SDL_Color);
|
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, 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(void);
|
||||||
|
void Render(int xArg, int yArg);
|
||||||
void RenderLiteral(void);
|
void RenderLiteral(void);
|
||||||
|
void RenderLiteral(int xArg, int yArg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
|
Loading…
Reference in New Issue
Block a user