-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathworld.hpp
53 lines (50 loc) · 1.02 KB
/
world.hpp
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
53
#ifndef WORLD_HPP_INCLUDED
#define WORLD_HPP_INCLUDED
#include <bits/stdc++.h>
#include <SFML/Graphics.hpp>
#include "physX.hpp"
using namespace std;
using namespace sf;
class World{
private:
Texture fg, bg;
Sprite sFG, sBG;
SoundBuffer bgbuff;
Sound bgfx;
public:
void LoadFG(string s){
fg.loadFromFile(s);
fg.setSmooth(true);
sFG.setTexture(fg);
}
void PosFG(int w){
sFG.setPosition(0, w);
}
void PosBG(int v){
sBG.setPosition(v, 0);
}
void LoadBG(string s){
bg.loadFromFile(s);
bg.setSmooth(true);
sBG.setTexture(bg);
}
void LoadSFX(string s){
bgbuff.loadFromFile(s);
bgfx.setBuffer(bgbuff);
bgfx.setLoop(true);
}
void PlaySFX(){
bgfx.play();
}
void setVol(int vol){
bgfx.setVolume(vol);
}
void StopSFX(){
bgfx.stop();
}
void drawTo(RenderWindow& win){
win.draw(sBG);
win.draw(sFG);
}
};
#endif // WORLD_HPP_INCLUDED