mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-16 21:01:48 +01:00
Added inheritance for the screen system
basic edge detection for tile rendering
This commit is contained in:
@@ -1,6 +1,43 @@
|
||||
#include "FuelScreen.h"
|
||||
|
||||
#include "ScreenManager.h"
|
||||
#include "utils.h"
|
||||
FuelScreen::FuelScreen(const std::string& filePath, Point2f pos, Point2f size, TextureManager* manager): Screen(filePath, pos, size, manager)
|
||||
{
|
||||
Point2f fuelScreenSize = Point2f { 492, 396 };
|
||||
Point2f fuelScreenCenter = Point2f { utils::GetViewport().x / 2 - fuelScreenSize.x / 2, utils::GetViewport().y / 2 - fuelScreenSize.y / 2 };
|
||||
|
||||
Point2f closeButtonOffset = Point2f { 460, 396 - 14 };
|
||||
Point2f closeButtonPos = fuelScreenCenter + closeButtonOffset;
|
||||
closeButtonPos.y -= 18;
|
||||
Button* closeFuelButton = new Button { "gui/close.png", closeButtonPos, Point2f{0,0}, TextureManager::GetInstance() };
|
||||
closeFuelButton->SetOnClick([this]() { ScreenManager::GetInstance()->CloseScreen(); });
|
||||
this->AddButton(closeFuelButton);
|
||||
|
||||
Point2f oneDollarButtonPos = Point2f { 451, 287 };
|
||||
oneDollarButtonPos += fuelScreenCenter;
|
||||
Button* fiveDollarButton = new Button { "gui/fuel/5dollars.png", oneDollarButtonPos , Point2f{0,0}, TextureManager::GetInstance() };
|
||||
this->AddButton(fiveDollarButton);
|
||||
|
||||
Point2f tenDollarButtonPos = oneDollarButtonPos + Point2f { 113, -1 };
|
||||
tenDollarButtonPos += fuelScreenCenter;
|
||||
Button* tenDollarButton = new Button { "gui/fuel/10dollars.png", tenDollarButtonPos, Point2f{0,0}, TextureManager::GetInstance() };
|
||||
this->AddButton(tenDollarButton);
|
||||
|
||||
Point2f twentyFiveDollarButtonPos = oneDollarButtonPos + Point2f { 0, -89 };
|
||||
twentyFiveDollarButtonPos += fuelScreenCenter;
|
||||
Button* twentyFiveDollarButton = new Button { "gui/fuel/25dollars.png", twentyFiveDollarButtonPos, Point2f{0,0}, TextureManager::GetInstance() };
|
||||
this->AddButton(twentyFiveDollarButton);
|
||||
|
||||
Point2f fiftyDollarButtonPos = twentyFiveDollarButtonPos + Point2f { 114, 0 };
|
||||
Button* fiftyDollarButton = new Button { "gui/fuel/50dollars.png", fiftyDollarButtonPos, Point2f{0,0}, TextureManager::GetInstance() };
|
||||
this->AddButton(fiftyDollarButton);
|
||||
|
||||
Point2f fillTankButtonPos = Point2f { 450, 108 };
|
||||
fillTankButtonPos += fuelScreenCenter;
|
||||
Button* fillTankButton = new Button { "gui/fuel/fillTank.png", fillTankButtonPos, Point2f{0,0}, TextureManager::GetInstance() };
|
||||
this->AddButton(fillTankButton);
|
||||
|
||||
}
|
||||
void FuelScreen::Draw() const {
|
||||
Screen::Draw();
|
||||
|
||||
Reference in New Issue
Block a user