Skip to content

Commit

Permalink
Update main.c
Browse files Browse the repository at this point in the history
  • Loading branch information
CardealRusso authored Oct 19, 2024
1 parent de8b61b commit ee2933d
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions examples/mousebuttons-c/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,17 @@
#define W 320
#define H 240

/* ============================================================
* Mouse buttons states example:
* - Opens a window
* - Starts a loop
* - Print current state of mouse buttons (clicked and holding)
* only if there's a change
* - Closes a window
* ============================================================ */
static int run() {
struct fenster f = {
.title = "Mouse Buttons",
.width = W,
.height = H,
};
struct fenster f = {.title = "Mouse Buttons",.width = W,.height = H,};
fenster_open(&f);
while (fenster_loop(&f) == 0) {
printf("Click: L:%d R:%d M:%d SU:%d SD:%d | \n",
f.mclick[0], f.mclick[1], f.mclick[2], f.mclick[3], f.mclick[4]);
fenster_sync(&f, 60);
for (int i = 0; i < f.width; i++) {
for (int j = 0; j < f.height; j++) {
fenster_pixel(&f, i, j) = rand();
}
}
printf("Click: L:%d R:%d M:%d SU:%d SD:%d | \n",f.mclick[0], f.mclick[1], f.mclick[2], f.mclick[3], f.mclick[4]);
fenster_sync(&f, 60);
}

fenster_close(&f);
Expand Down

0 comments on commit ee2933d

Please sign in to comment.