aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
blob: aabf79f7276247114b49105e92fd018b2c1a358d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <unistd.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/ioctl.h>
#include <sys/mman.h>

#include "shorthand.h"
#include "ppu.c"
#include "uxn-fast.c"
#include "rom.c"

// static Uxn u;
// static Device *devscreen;
// static Device *devctrl;
// static Device *devmouse;
// static Device *devaudio;

int
main(void) {
    ppu_init();

	// Main loop.
	uint8_t shade = 0;
	size_t counter = 0;
	size_t direction = 1;
	while (true) {
		for (size_t j = 0; j < screen_height; j++) {
			for (size_t i = 0; i < screen_width; i++) {
				framebuffer[j * screen_width + i] = shade;
			}
		}
		counter++;
		if (counter > 10) {
			shade += direction;
			counter = 0;
		}
		if (shade == 0xFF) {
			direction = -1;
		} else if (shade == 0x00) {
			direction = 1;
		}
	}

	return 0;
}