aboutsummaryrefslogtreecommitdiffstats
path: root/examples/pugl_print_events.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-01-02 21:09:27 +0100
committerDavid Robillard <d@drobilla.net>2021-01-02 21:09:27 +0100
commit1c365945ed2ebd5b9f54eb0c8c5c1c6d97cad712 (patch)
tree4b77266a9ce3e2a11b59bbd2754869c6ee1d172b /examples/pugl_print_events.c
parenta92a194b4fc64e0cfa4a88a59e261f236414d61c (diff)
downloadpugl-1c365945ed2ebd5b9f54eb0c8c5c1c6d97cad712.tar.gz
pugl-1c365945ed2ebd5b9f54eb0c8c5c1c6d97cad712.tar.bz2
pugl-1c365945ed2ebd5b9f54eb0c8c5c1c6d97cad712.zip
Simplify clang-format configuration and format all code
Diffstat (limited to 'examples/pugl_print_events.c')
-rw-r--r--examples/pugl_print_events.c66
1 files changed, 34 insertions, 32 deletions
diff --git a/examples/pugl_print_events.c b/examples/pugl_print_events.c
index 8f8874b..dfa217e 100644
--- a/examples/pugl_print_events.c
+++ b/examples/pugl_print_events.c
@@ -22,56 +22,58 @@
#include <stdbool.h>
#include <stdio.h>
-typedef struct
-{
- PuglWorld* world;
- PuglView* view;
- int quit;
+typedef struct {
+ PuglWorld* world;
+ PuglView* view;
+ int quit;
} PuglPrintEventsApp;
static PuglStatus
onEvent(PuglView* view, const PuglEvent* event)
{
- PuglPrintEventsApp* app = (PuglPrintEventsApp*)puglGetHandle(view);
+ PuglPrintEventsApp* app = (PuglPrintEventsApp*)puglGetHandle(view);
- printEvent(event, "Event: ", true);
+ printEvent(event, "Event: ", true);
- switch (event->type) {
- case PUGL_CLOSE: app->quit = 1; break;
- default: break;
- }
+ switch (event->type) {
+ case PUGL_CLOSE:
+ app->quit = 1;
+ break;
+ default:
+ break;
+ }
- return PUGL_SUCCESS;
+ return PUGL_SUCCESS;
}
int
main(void)
{
- PuglPrintEventsApp app = {NULL, NULL, 0};
+ PuglPrintEventsApp app = {NULL, NULL, 0};
- app.world = puglNewWorld(PUGL_PROGRAM, 0);
- app.view = puglNewView(app.world);
+ app.world = puglNewWorld(PUGL_PROGRAM, 0);
+ app.view = puglNewView(app.world);
- puglSetClassName(app.world, "Pugl Print Events");
- puglSetWindowTitle(app.view, "Pugl Event Printer");
- puglSetDefaultSize(app.view, 512, 512);
- puglSetBackend(app.view, puglStubBackend());
- puglSetHandle(app.view, &app);
- puglSetEventFunc(app.view, onEvent);
+ puglSetClassName(app.world, "Pugl Print Events");
+ puglSetWindowTitle(app.view, "Pugl Event Printer");
+ puglSetDefaultSize(app.view, 512, 512);
+ puglSetBackend(app.view, puglStubBackend());
+ puglSetHandle(app.view, &app);
+ puglSetEventFunc(app.view, onEvent);
- PuglStatus st = puglRealize(app.view);
- if (st) {
- return logError("Failed to create window (%s)\n", puglStrerror(st));
- }
+ PuglStatus st = puglRealize(app.view);
+ if (st) {
+ return logError("Failed to create window (%s)\n", puglStrerror(st));
+ }
- puglShow(app.view);
+ puglShow(app.view);
- while (!app.quit) {
- puglUpdate(app.world, -1.0);
- }
+ while (!app.quit) {
+ puglUpdate(app.world, -1.0);
+ }
- puglFreeView(app.view);
- puglFreeWorld(app.world);
+ puglFreeView(app.view);
+ puglFreeWorld(app.world);
- return 0;
+ return 0;
}