-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
55 lines (46 loc) · 1.17 KB
/
main.cpp
File metadata and controls
55 lines (46 loc) · 1.17 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
55
#include <cpp3ds/Graphics.hpp>
#include <cpp3ds/System.hpp>
#include <cpp3ds/Window.hpp>
// Minimal derived Game class necessary for cpp3ds games
class MyGame: public cpp3ds::Game {
private:
cpp3ds::Text text;
public:
MyGame() {
// Constructor for setting up initial game objects
text.setFillColor(cpp3ds::Color::Green);
text.setCharacterSize(40);
text.setString(_("Hello World"));
}
~MyGame() {
// Destructor called when game exits
}
void update(float delta) {
// Update game state based on frame time delta
text.move(10.f * delta, 0); // Move 10 pixels per second to the right
}
void processEvent(cpp3ds::Event& event) {
// Check for input Events
switch (event.type) {
case cpp3ds::Event::KeyPressed:
if (event.key.code == cpp3ds::Keyboard::Select)
exit(); // Exit game when Select is pressed
break;
default:
break;
}
}
void renderTopScreen(cpp3ds::Window& window) {
window.clear();
window.draw(text);
}
void renderBottomScreen(cpp3ds::Window& window) {
window.clear();
}
};
int main(int argc, char** argv) {
cpp3ds::Console::enable(cpp3ds::BottomScreen); // Console for reading stdout
MyGame game;
game.run();
return 0;
}