-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglfw.c
32 lines (26 loc) · 936 Bytes
/
glfw.c
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
#include <vulkan/vulkan.h>
#include <GLFW/glfw3.h>
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
const char** glfw_init(unsigned* count) {
if (!glfwInit())
abort();
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE);
return glfwGetRequiredInstanceExtensions(count);
}
VkResult glfw_create_surface(int x,
int y,
const char* name,
GLFWwindow** win,
VkInstance instance,
VkSurfaceKHR* surface) {
*win = glfwCreateWindow(x, y, "window", 0, 0);
// glfwSetInputMode(*win, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE);
// glfwSetInputMode(glfw, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
return glfwCreateWindowSurface(instance, *win, 0, surface);
}
int glfw_poll(GLFWwindow* win) {
glfwPollEvents();
return !glfwWindowShouldClose(win);
}