-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPrototypeScene.h
More file actions
54 lines (43 loc) · 1.3 KB
/
PrototypeScene.h
File metadata and controls
54 lines (43 loc) · 1.3 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
53
54
// The demo scene
// Our example scene is made by deriving a class from our library’s Scene class.
// In order to do so, we overload Scene’s update and draw functions as well as
// adding any GameObject-derived classes that we want to include in the scene.
// For our example we have a background, ship, alien ship, asteroid, sun, and
// many planets, all stored as data members of Prototype Scene. Each of these
// is an instantiation of a class, derived from FarOut’s GameObject class which
// is itself derived from SFML’s Drawable and Transformable classes.
#ifndef PROTO
#define PROTO
#include "AlienShip.h"
#include "Ship.h"
#include "PlanetarySystem.h"
#include "Asteroid.h"
const int SYSTEMOBJECTS = 13;
// Stars that go on almost forever
class Background : public GameObject {
public:
Background();
void update(sf::Time dt);
void draw(sf::RenderTarget& target, sf::RenderStates states)const;
private:
sf::Texture texture;
sf::Sprite sprite;
};
class PrototypeScene : public Scene {
public:
PrototypeScene();
~PrototypeScene();
void update(sf::Time dt);
void draw(sf::RenderWindow& window);
sf::Vector2f getCenter();
private:
Background bg;
Ship ship;
AlienShip* alien;
Star* sun;
Planet** planetarySystemObjects;
Asteroid asteroid;
sf::Vector2f center;
sf::View view;
};
#endif