[Fix] Added EventHistory.cpp and EventHistory.h to VS project.
-- What the hell happened to them?! [Add] Event history box is now translucent.
This commit is contained in:
parent
ae81b99958
commit
3dd248156b
@ -360,6 +360,14 @@
|
|||||||
RelativePath="..\..\..\src\libUnuk\Ui\ButtonToggle.h"
|
RelativePath="..\..\..\src\libUnuk\Ui\ButtonToggle.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\src\libUnuk\UI\EventHistory.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\src\libUnuk\UI\EventHistory.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\src\libUnuk\Ui\Font.cpp"
|
RelativePath="..\..\..\src\libUnuk\Ui\Font.cpp"
|
||||||
>
|
>
|
||||||
|
@ -146,6 +146,8 @@ void Game::HandleInput(void) {
|
|||||||
_ingameMenu.SetStatus(true);
|
_ingameMenu.SetStatus(true);
|
||||||
if(event.key.keysym.sym == SDLK_p)
|
if(event.key.keysym.sym == SDLK_p)
|
||||||
debugEnabled = !debugEnabled;
|
debugEnabled = !debugEnabled;
|
||||||
|
if(event.key.keysym.sym == SDLK_0)
|
||||||
|
_eventHistory.LogEvent("Item gained.");
|
||||||
}
|
}
|
||||||
else if(event.type == SDL_QUIT) {
|
else if(event.type == SDL_QUIT) {
|
||||||
_gameRunning = false;
|
_gameRunning = false;
|
||||||
|
@ -16,16 +16,25 @@ void Rect::SetWidthHeight(int wArg, int hArg) {
|
|||||||
rect.h = (Uint16)hArg;
|
rect.h = (Uint16)hArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Rect::SetRGBA(Uint8 rArg, Uint8 gArg, Uint8 bArg, Uint8 aArg) {
|
||||||
|
r = rArg;
|
||||||
|
g = gArg;
|
||||||
|
b = bArg;
|
||||||
|
a = aArg;
|
||||||
|
}
|
||||||
|
|
||||||
void Rect::SetRGB(Uint8 rArg, Uint8 gArg, Uint8 bArg) {
|
void Rect::SetRGB(Uint8 rArg, Uint8 gArg, Uint8 bArg) {
|
||||||
r = rArg;
|
r = rArg;
|
||||||
g = gArg;
|
g = gArg;
|
||||||
b = bArg;
|
b = bArg;
|
||||||
|
a = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rect::SetRGB(SDL_Color colour) {
|
void Rect::SetRGB(SDL_Color colour) {
|
||||||
r = colour.r;
|
r = colour.r;
|
||||||
g = colour.g;
|
g = colour.g;
|
||||||
b = colour.b;
|
b = colour.b;
|
||||||
|
a = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rect::Draw(void) {
|
void Rect::Draw(void) {
|
||||||
@ -36,7 +45,7 @@ void Rect::Draw(void) {
|
|||||||
offset.w = rect.w;
|
offset.w = rect.w;
|
||||||
offset.h = rect.h;
|
offset.h = rect.h;
|
||||||
|
|
||||||
SDL_FillRect(screen, &offset, SDL_MapRGB(screen->format, r, g, b));
|
SDL_FillRect(screen, &offset, SDL_MapRGBA(screen->format, r, g, b, a));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rect::Draw(int xArg, int yArg) {
|
void Rect::Draw(int xArg, int yArg) {
|
||||||
@ -47,11 +56,11 @@ void Rect::Draw(int xArg, int yArg) {
|
|||||||
offset.w = (Sint16)rect.w;
|
offset.w = (Sint16)rect.w;
|
||||||
offset.h = (Sint16)rect.h;
|
offset.h = (Sint16)rect.h;
|
||||||
|
|
||||||
SDL_FillRect(screen, &offset, SDL_MapRGB(screen->format, r, g, b));
|
SDL_FillRect(screen, &offset, SDL_MapRGBA(screen->format, r, g, b, a));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rect::DrawLiteral(void) {
|
void Rect::DrawLiteral(void) {
|
||||||
SDL_FillRect(screen, &rect, SDL_MapRGB(screen->format, r, g, b));
|
SDL_FillRect(screen, &rect, SDL_MapRGBA(screen->format, r, g, b, a));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rect::DrawLiteral(int xArg, int yArg) {
|
void Rect::DrawLiteral(int xArg, int yArg) {
|
||||||
@ -62,5 +71,5 @@ void Rect::DrawLiteral(int xArg, int yArg) {
|
|||||||
offset.w = rect.w;
|
offset.w = rect.w;
|
||||||
offset.h = rect.h;
|
offset.h = rect.h;
|
||||||
|
|
||||||
SDL_FillRect(screen, &offset, SDL_MapRGB(screen->format, r, g, b));
|
SDL_FillRect(screen, &offset, SDL_MapRGBA(screen->format, r, g, b, a));
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ public:
|
|||||||
void SetXY(int xArg, int yArg);
|
void SetXY(int xArg, int yArg);
|
||||||
void SetWidthHeight(int wArg, int hArg);
|
void SetWidthHeight(int wArg, int hArg);
|
||||||
|
|
||||||
|
void SetRGBA(Uint8 rArg, Uint8 gArg, Uint8 bArg, Uint8 aArg);
|
||||||
void SetRGB(Uint8 rArg, Uint8 gArg, Uint8 bArg);
|
void SetRGB(Uint8 rArg, Uint8 gArg, Uint8 bArg);
|
||||||
void SetRGB(SDL_Color);
|
void SetRGB(SDL_Color);
|
||||||
|
|
||||||
@ -29,6 +30,7 @@ protected:
|
|||||||
Uint8 r;
|
Uint8 r;
|
||||||
Uint8 g;
|
Uint8 g;
|
||||||
Uint8 b;
|
Uint8 b;
|
||||||
|
Uint8 a;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SDL_Rect rect;
|
SDL_Rect rect;
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
|
#include <SDL/SDL.h>
|
||||||
|
#include <SDL/SDL_gfxPrimitives.h>
|
||||||
|
|
||||||
#include "EventHistory.h"
|
#include "EventHistory.h"
|
||||||
#include "../../Unuk/Constants.h"
|
#include "../../Unuk/Constants.h"
|
||||||
|
#include "../../Unuk/Globals.h"
|
||||||
|
|
||||||
const int EventHistory::BOX_WIDTH = 350;
|
const int EventHistory::BOX_WIDTH = 350;
|
||||||
const int EventHistory::BOX_HEIGHT = 130;
|
const int EventHistory::BOX_HEIGHT = 130;
|
||||||
|
|
||||||
EventHistory::EventHistory(void) {
|
EventHistory::EventHistory(void) {
|
||||||
_background.SetXY(SCREEN_WIDTH/2 - BOX_WIDTH/2, 10);
|
_bgx = SCREEN_WIDTH / 2 - BOX_WIDTH / 2;
|
||||||
_background.SetWidthHeight(BOX_WIDTH, BOX_HEIGHT);
|
_bgy = 10;
|
||||||
_background.SetRGB(0, 0, 0);
|
|
||||||
|
|
||||||
_text.SetXY(_background.GetX() + 5, _background.GetY() + 5);
|
_text.SetXY(_bgx + 5, _bgy + 5);
|
||||||
|
|
||||||
_visible = false;
|
_visible = false;
|
||||||
}
|
}
|
||||||
@ -46,6 +49,10 @@ void EventHistory::Render(void) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_background.DrawLiteral();
|
boxRGBA(screen,
|
||||||
|
_bgx, _bgy,
|
||||||
|
_bgx + BOX_WIDTH, _bgy + BOX_HEIGHT,
|
||||||
|
0, 0, 0, 128);
|
||||||
|
|
||||||
_text.RenderLiteral();
|
_text.RenderLiteral();
|
||||||
}
|
}
|
@ -23,6 +23,9 @@ private:
|
|||||||
Timer _timeToVanish;
|
Timer _timeToVanish;
|
||||||
bool _visible;
|
bool _visible;
|
||||||
|
|
||||||
|
int _bgx;
|
||||||
|
int _bgy;
|
||||||
|
|
||||||
static const int BOX_WIDTH;
|
static const int BOX_WIDTH;
|
||||||
static const int BOX_HEIGHT;
|
static const int BOX_HEIGHT;
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user