Mercurial > molko
view src/main.c @ 39:9d1421c09dfb
core: add more utilities to improve code simplicity
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 14 Jan 2020 13:05:45 +0100 |
parents | 798baf7f3ec0 |
children | 3996f873a54b |
line wrap: on
line source
/* * main.c -- Molko's Adventure * * Copyright (c) 2020 David Demelier <markand@malikania.fr> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <stdio.h> #include <stdlib.h> #include "clock.h" #include "error.h" #include "event.h" #include "painter.h" #include "sys.h" #include "window.h" #include "util.h" int main(int argc, char **argv) { (void)argc; (void)argv; struct clock clock; if (!sys_init()) error_fatal(); if (!window_init("Molko's Adventure", 1024, 576)) error_fatal(); clock_start(&clock); for (;;) { /*uint64_t elapsed = clock_elapsed(&clock);*/ union event ev; while (event_poll(&ev)) { switch (ev.type) { case EVENT_QUIT: return 0; default: break; } } painter_clear(); painter_present(); delay(50); } return 0; }