vulkan_test2
annotate src/main.c @ 7:20eb42197ab8
clear color ...
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 20 Jun 2018 05:57:34 +0300 |
parents | c31c4115d44a |
children | d34f84bede17 |
rev | line source |
---|---|
nuclear@0 | 1 #include <stdio.h> |
nuclear@4 | 2 #include "wsys.h" |
nuclear@3 | 3 #include "vku.h" |
nuclear@7 | 4 #include "vkgl.h" |
nuclear@0 | 5 |
nuclear@4 | 6 static void display(void); |
nuclear@4 | 7 static void reshape(int x, int y); |
nuclear@4 | 8 static void keyboard(int key, int pressed); |
nuclear@4 | 9 |
nuclear@0 | 10 int main(void) |
nuclear@0 | 11 { |
nuclear@3 | 12 if(vku_create_dev() == -1) { |
nuclear@4 | 13 return 1; |
nuclear@0 | 14 } |
nuclear@0 | 15 |
nuclear@4 | 16 if(wsys_create_window(800, 600) == -1) { |
nuclear@4 | 17 return 1; |
nuclear@4 | 18 } |
nuclear@4 | 19 wsys_set_window_title("Vulkan test 2"); |
nuclear@4 | 20 |
nuclear@4 | 21 wsys_display_callback(display); |
nuclear@4 | 22 wsys_reshape_callback(reshape); |
nuclear@4 | 23 wsys_keyboard_callback(keyboard); |
nuclear@4 | 24 |
nuclear@4 | 25 while(wsys_process_events(WSYS_BLOCKING) != -1); |
nuclear@4 | 26 |
nuclear@4 | 27 wsys_destroy_window(); |
nuclear@3 | 28 vku_cleanup(); |
nuclear@0 | 29 return 0; |
nuclear@0 | 30 } |
nuclear@4 | 31 |
nuclear@4 | 32 static void display(void) |
nuclear@4 | 33 { |
nuclear@7 | 34 vkgl_clear_color(1, 0, 0, 1); |
nuclear@7 | 35 vkgl_clear(VKGL_COLOR_BUFFER_BIT); |
nuclear@7 | 36 |
nuclear@4 | 37 wsys_swap_buffers(); |
nuclear@4 | 38 } |
nuclear@4 | 39 |
nuclear@4 | 40 static void reshape(int x, int y) |
nuclear@4 | 41 { |
nuclear@4 | 42 } |
nuclear@4 | 43 |
nuclear@4 | 44 static void keyboard(int key, int pressed) |
nuclear@4 | 45 { |
nuclear@4 | 46 if(key == 27) { |
nuclear@4 | 47 wsys_quit(); |
nuclear@4 | 48 } |
nuclear@4 | 49 } |