-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSelectScreen.cpp
More file actions
33 lines (26 loc) · 936 Bytes
/
Copy pathSelectScreen.cpp
File metadata and controls
33 lines (26 loc) · 936 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "SelectScreen.h"
#include "SelectUIPanel.h"
#include "SelectInputHandler.h"
using namespace std;
using namespace sf;
SelectScreen::SelectScreen(ScreenManagerRemoteControl* smrc, Vector2i res)
{
auto suip = make_unique<SelectUIPanel>(res);
auto sih = make_shared<SelectInputHandler>();
addPanel(std::move(suip), smrc, sih);
m_ScreenManagerRemoteControl = smrc;
m_BackgroundTexture.loadFromFile("graphics/background.png");
m_BackgroundSprite.setTexture(m_BackgroundTexture);
auto textureSize = m_BackgroundSprite.getTexture()->getSize();
m_BackgroundSprite.setScale(
float(m_View.getSize().x) / textureSize.x,
float(m_View.getSize().y / textureSize.y)
);
}
void SelectScreen::draw(RenderWindow& window)
{
window.setView(m_View); // change to this screen's view to draw
window.draw(m_BackgroundSprite);
// Draw the UI Panel view(s)
Screen::draw(window);
}