-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoyaumeView.cpp
More file actions
52 lines (44 loc) · 1.4 KB
/
RoyaumeView.cpp
File metadata and controls
52 lines (44 loc) · 1.4 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "RoyaumeView.h"
#include "Modeles.h"
#include "Vues.h"
#include "ZoneView.h"
RoyaumeView::RoyaumeView(sf::RenderWindow& window) :
Vue(window), m_zoneChargee(-1)
{
// Vues::loadFromFile(m_tex_caseNavigable, RESSOURCES "test.png");
// Vues::loadFromFile(m_tex_caseNonNavigable, RESSOURCES "test2.png");
}
RoyaumeView::~RoyaumeView()
{
//dtor
}
sf::Vector2u RoyaumeView::getTailleDecor() const
{
return m_texPremierPlan.getSize();
}
void RoyaumeView::update(sf::Time deltaTemps)
{
int zoneCourante = Modeles::m_royaume.m_zoneCourante;
if(zoneCourante != m_zoneChargee)
{
m_zoneChargee = zoneCourante;
ZoneView& zview = Vues::m_zoneViews.at(zoneCourante);
Vues::loadFromFile(m_texPremierPlan, zview.m_dossier + "/premierPlan.png");
Vues::loadFromFile(m_texDernierPlan, zview.m_dossier + "/dernierPlan.png");
m_spritePremierPlan.setTexture(m_texPremierPlan);
m_spriteDernierPlan.setTexture(m_texDernierPlan);
sf::Vector2u tailleDecor = getTailleDecor();
sf::Vector2u tailleParch = Vues::m_textureParchemin.getSize();
Vues::m_spriteEffetParchemin.setScale(
tailleDecor.x * 1.2 / tailleParch.x,
tailleDecor.y * 1.2 / tailleParch.y);
}
}
void RoyaumeView::draw() const
{
m_window.draw(m_spriteDernierPlan);
}
void RoyaumeView::drawPremierPlan() const
{
m_window.draw(m_spritePremierPlan);
}