summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authordario-loi <loi.1940849@studenti.uniroma1.it>2024-11-24 19:06:09 +0100
committerdario-loi <loi.1940849@studenti.uniroma1.it>2024-11-24 19:17:47 +0100
commite416c072833477d1e50a036414100f7b75d5e1be (patch)
treec0885f1ba0df4493aab803cc9048b812a3f5c920 /example
parent8c86cb24ae3b1cbdbe749f228bc62cbbd5cdedfd (diff)
parent5881f9997a4d1ffeb2fe87d03fad731dd9cb6a03 (diff)
Merge branch 'master' of https://github.com/dario-loi/fbgl
Diffstat (limited to 'example')
-rw-r--r--example/.gitignore2
-rw-r--r--example/CMakeLists.txt39
-rw-r--r--example/empty_example.c6
3 files changed, 20 insertions, 27 deletions
diff --git a/example/.gitignore b/example/.gitignore
index 4b44f82..4a6e1b0 100644
--- a/example/.gitignore
+++ b/example/.gitignore
@@ -1 +1 @@
-build / core.*
+build/core.*
diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
index 837e6e8..3051dfc 100644
--- a/example/CMakeLists.txt
+++ b/example/CMakeLists.txt
@@ -1,31 +1,24 @@
cmake_minimum_required(VERSION 3.21)
- project(fbglExamples C)
+project(fbglExamples C)
- include(../ cmake / folders.cmake)
+include(../cmake/folders.cmake)
- if (PROJECT_IS_TOP_LEVEL) find_package(
- fbgl REQUIRED) endif()
+if(PROJECT_IS_TOP_LEVEL)
+ find_package(fbgl REQUIRED)
+endif()
- add_custom_target(run - examples)
+add_custom_target(run-examples)
- function(add_example NAME) add_executable(
- "${NAME}"
- "${NAME}.c") target_link_libraries("${NAME}" PRIVATE
- fbgl::fbgl)
- target_compile_features("${NAME}" PRIVATE c_std_99) add_custom_target(
- "run_${NAME}" COMMAND
- "${NAME}" VERBATIM)
- add_dependencies(
- "run_${NAME}"
- "${NAME}")
- add_dependencies(
- run -
- examples
- "run_${NAME}") endfunction()
+function(add_example NAME)
+ add_executable("${NAME}" "${NAME}.c")
+ target_link_libraries("${NAME}" PRIVATE fbgl::fbgl)
+ target_compile_features("${NAME}" PRIVATE c_std_99)
+ add_custom_target("run_${NAME}" COMMAND "${NAME}" VERBATIM)
+ add_dependencies("run_${NAME}" "${NAME}")
+ add_dependencies(run-examples "run_${NAME}")
+endfunction()
- add_example(
- empty_example)
+add_example(empty_example)
- add_folders(
- Example)
+add_folders(Example) \ No newline at end of file
diff --git a/example/empty_example.c b/example/empty_example.c
index cbb69c4..8c7d32d 100644
--- a/example/empty_example.c
+++ b/example/empty_example.c
@@ -1,10 +1,10 @@
#define FBGL_IMPLEMENTATION
-//#define FBGL_HIDE_CURSOR
+// #define FBGL_HIDE_CURSOR
#define FBGL_USE_FREETYPE
#include "../fbgl.h"
-#include <stdio.h>
#include <stddef.h>
+#include <stdio.h>
int main()
{
@@ -43,7 +43,7 @@ int main()
fprintf(stdout, "ESC pressed\n");
break;
}
- //fbgl_set_bg(&buffer, i++); // Set background color to
+ // fbgl_set_bg(&buffer, i++); // Set background color to
for (int i = 0x000000; i <= 0xFFFFFF; i++) {
fbgl_set_bg(&buffer, i);
}