aboutsummaryrefslogtreecommitdiff
path: root/src/example
diff options
context:
space:
mode:
Diffstat (limited to 'src/example')
-rw-r--r--src/example/button.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/example/button.cpp b/src/example/button.cpp
index be236ec..96e6571 100644
--- a/src/example/button.cpp
+++ b/src/example/button.cpp
@@ -1,20 +1,20 @@
-#include <crepe/api/Camera.h>
-#include <crepe/ComponentManager.h>
+#include <SDL2/SDL_timer.h>
+#include <chrono>
#include <crepe/Component.h>
+#include <crepe/ComponentManager.h>
+#include <crepe/api/Animator.h>
+#include <crepe/api/Button.h>
+#include <crepe/api/Camera.h>
#include <crepe/api/Color.h>
+#include <crepe/api/EventManager.h>
#include <crepe/api/GameObject.h>
#include <crepe/api/Sprite.h>
+#include <crepe/api/Texture.h>
#include <crepe/api/Transform.h>
-#include <crepe/system/RenderSystem.h>
-#include <crepe/api/EventManager.h>
-#include <crepe/system/InputSystem.h>
#include <crepe/system/AnimatorSystem.h>
-#include <crepe/api/Button.h>
-#include <crepe/api/Animator.h>
-#include <crepe/api/Texture.h>
-#include <SDL2/SDL_timer.h>
+#include <crepe/system/InputSystem.h>
+#include <crepe/system/RenderSystem.h>
#include <crepe/types.h>
-#include <chrono>
#include <iostream>
using namespace crepe;
using namespace std;
@@ -22,7 +22,7 @@ using namespace std;
int main(int argc, char * argv[]) {
ComponentManager mgr;
RenderSystem sys{mgr};
- EventManager& event_mgr = EventManager::get_instance();
+ EventManager & event_mgr = EventManager::get_instance();
InputSystem input_sys{mgr};
AnimatorSystem asys{mgr};
GameObject camera_obj = mgr.new_object("", "", vec2{0, 0}, 0, 1);
@@ -32,10 +32,8 @@ int main(int argc, char * argv[]) {
auto s2 = Texture("asset/texture/test_ap43.png");
bool button_clicked = false;
auto & sprite2 = button_obj.add_component<Sprite>(
- s2, Color::GREEN, Sprite::FlipSettings{false, false}, 2, 1, 100);
- std::function<void()> on_click = [&]() {
- std::cout << "button clicked" << std::endl;
- };
+ s2, Color::GREEN, Sprite::FlipSettings{false, false}, 2, 1, 100);
+ std::function<void()> on_click = [&]() { std::cout << "button clicked" << std::endl; };
auto & button = button_obj.add_component<Button>(100, 100, on_click, false);
button.active = true;
auto start = std::chrono::steady_clock::now();