vulkan_test2

annotate src/main.c @ 5:cec4b0e7fce8

created swapchain
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 22 Sep 2017 17:48:18 +0300
parents 68e1c437343f
children 20eb42197ab8
rev   line source
nuclear@0 1 #include <stdio.h>
nuclear@4 2 #include "wsys.h"
nuclear@3 3 #include "vku.h"
nuclear@0 4
nuclear@4 5 static void display(void);
nuclear@4 6 static void reshape(int x, int y);
nuclear@4 7 static void keyboard(int key, int pressed);
nuclear@4 8
nuclear@0 9 int main(void)
nuclear@0 10 {
nuclear@3 11 if(vku_create_dev() == -1) {
nuclear@4 12 return 1;
nuclear@0 13 }
nuclear@0 14
nuclear@4 15 if(wsys_create_window(800, 600) == -1) {
nuclear@4 16 return 1;
nuclear@4 17 }
nuclear@4 18 wsys_set_window_title("Vulkan test 2");
nuclear@4 19
nuclear@4 20 wsys_display_callback(display);
nuclear@4 21 wsys_reshape_callback(reshape);
nuclear@4 22 wsys_keyboard_callback(keyboard);
nuclear@4 23
nuclear@4 24 while(wsys_process_events(WSYS_BLOCKING) != -1);
nuclear@4 25
nuclear@4 26 wsys_destroy_window();
nuclear@3 27 vku_cleanup();
nuclear@0 28 return 0;
nuclear@0 29 }
nuclear@4 30
nuclear@4 31 static void display(void)
nuclear@4 32 {
nuclear@4 33 wsys_swap_buffers();
nuclear@4 34 }
nuclear@4 35
nuclear@4 36 static void reshape(int x, int y)
nuclear@4 37 {
nuclear@4 38 }
nuclear@4 39
nuclear@4 40 static void keyboard(int key, int pressed)
nuclear@4 41 {
nuclear@4 42 if(key == 27) {
nuclear@4 43 wsys_quit();
nuclear@4 44 }
nuclear@4 45 }