Habe hier nochmal die Framework.hpp und Framework.cpp neu gemacht sieht das schon besser aus ?
Oder sollte ich noch was ändern ? :o
Framework.hpp
|
C-/C++-Quelltext
|
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
|
#pragma once
#include <SFML\Graphics.hpp>
using namespace sf;
using namespace std;
class CFramework {
public:
CFramework (int WindowWidth, int WindowHeight, string Title);
void Run ();
private:
void Update (float ElapsedTime);
void Render ();
void HandleEvents ();
void Quit ();
float GetElapsedTime ();
RenderWindow Window;
Event Event;
Clock Clock;
float ElapsedTime;
bool Running;
};
|
Framework.cpp
|
C-/C++-Quelltext
|
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#include "Framework.hpp"
CFramework::CFramework(int WindowWidth, int WindowHeight, string Title) {
Running = true;
Window.create(VideoMode(WindowWidth, WindowHeight), Title, Style::Titlebar | Style::Close);
}
void CFramework::Run() {
while (Running) {
Update(ElapsedTime);
Render();
HandleEvents();
Quit();
GetElapsedTime();
}
}
void CFramework::Update(float ElapsedTime) {
}
void CFramework::Render() {
Window.clear();
Window.display();
}
void CFramework::HandleEvents() {
while (Window.pollEvent(Event)) {
if (Event.type == Event::Closed) {
Running = false;
}
}
}
void CFramework::Quit() {
if (Running == false) {
Window.close();
}
}
float CFramework::GetElapsedTime() {
ElapsedTime = Clock.getElapsedTime().asSeconds();
Clock.restart();
return ElapsedTime;
}
|
Na einfach einen Member vom entsprechenden Typ machen:
Wollte jetzt die Ball.hpp, .cpp, Enemy.hpp und .cpp fertig machen und dann machen melde mich wenn ich es fertig habe