aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorpk33 <pk33@pk33.space>2024-11-01 23:51:15 +0100
committerpk33 <pk33@pk33.space>2024-11-01 23:51:15 +0100
commit294b585994da4427ac98a8353ff41aed5f301d54 (patch)
treeaafcd885c1fe28819ef1a511da5e6344411b5597 /src/main.c
parentf0958551b43959174d28b2056f584d2081494e6c (diff)
downloadengine33-294b585994da4427ac98a8353ff41aed5f301d54.tar.gz
Import and fix old code
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..2d345ba
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,54 @@
+#include "display.h"
+#include "clock.h"
+#include "logger.h"
+#include "options.h"
+
+
+int main(int argc, char *argv[])
+{
+ Size fps, FPS;
+ long timeOld, time;
+
+ timeOld = clock_get_us();
+ time = 0;
+ fps = 0;
+ FPS = 0;
+
+ if( logger_init() ) {
+ return EXIT_FAILURE;
+ }
+
+ if( display_init() ) {
+ return EXIT_FAILURE;
+ }
+
+ while(1)
+ {
+ display_vtswitcher_poll(1);
+
+ if( __display.active )
+ {
+ __display.surface.data[10] = GREEN;
+ display_flip();
+ }
+
+
+ time += clock_get_us() - timeOld;
+ timeOld = clock_get_us();
+
+ if(time >= 1000000)
+ {
+ logi("FPS: %d", FPS);
+ FPS = fps;
+ time = 0;
+ fps = 0;
+ }
+ ++fps;
+ }
+
+ display_term();
+ logger_term();
+
+
+ return EXIT_SUCCESS;
+}