1
0

Initial commit

This commit is contained in:
2023-08-29 02:06:18 +00:00
commit 52f1c7056e
10 changed files with 506 additions and 0 deletions

60
src/main.cpp Normal file
View File

@@ -0,0 +1,60 @@
#include <cstdio>
#include <cstdlib>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
#ifdef __SWITCH__
#include <switch.h>
extern "C" void userAppInit() {
socketInitializeDefault();
nxlinkStdio();
appletSetWirelessPriorityMode(AppletWirelessPriorityMode_OptimizedForWlan);
plInitialize(PlServiceType_User);
}
extern "C" void userAppExit() {
plExit();
socketExit();
}
#endif
// Main code
int main(int argc, char* argv[]) {
if (!glfwInit()) return -1;
static int osdShow = 0;
// Create window with graphics context
GLFWwindow* window = glfwCreateWindow(1280, 720, "xPlayer", nullptr, nullptr);
if (!window) {
glfwTerminate();
return -1;
}
glfwSetKeyCallback(window, [](GLFWwindow* window, int key, int scancode, int action, int mods) {
if (action == GLFW_PRESS) {
if (key == GLFW_KEY_ESCAPE)
glfwSetWindowShouldClose(window, 1);
else if (key == GLFW_KEY_ENTER)
osdShow = !osdShow;
}
});
glfwMakeContextCurrent(window);
glfwSwapInterval(1);
glfwSetTime(0);
int fbw = 0, fbh = 0;
// Main loop
while (!glfwWindowShouldClose(window)) {
glfwGetFramebufferSize(window, &fbw, &fbh);
glfwSwapBuffers(window);
glfwWaitEvents();
}
glfwDestroyWindow(window);
glfwTerminate();
return 0;
}