Create PlatformUtils.h to handle cross platform compatibility

This commit is contained in:
Jack Christensen 2024-08-12 21:55:08 -04:00
parent 5f415e4f1b
commit dcd82ae202
6 changed files with 18 additions and 3 deletions

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include <windows.h> //#include <windows.h>
#include <GL/glew.h> #include <GL/glew.h>

View File

@ -1,7 +1,6 @@
#ifndef __INITSHADER_H__ #ifndef __INITSHADER_H__
#define __INITSHADER_H__ #define __INITSHADER_H__
#include <windows.h>
#include <GL/GL.h> #include <GL/GL.h>
GLuint InitShader( const char* computeShaderFile); GLuint InitShader( const char* computeShaderFile);

13
include/PlatformUtils.h Normal file
View File

@ -0,0 +1,13 @@
#pragma once
#ifdef _WIN32
#include <windows.h>
#define DEBUG_BREAK() DebugBreak()
#else
#include <csignal>
#define DEBUG_BREAK() raise(SIGTRAP)
#endif
#ifndef APIENTRY
#define APIENTRY
#endif

View File

@ -1,5 +1,6 @@
#include "Callbacks.h" #include "Callbacks.h"
#include "Scene.h" #include "PlatformUtils.h"
#include "scene.h"
#include <glm/glm.hpp> #include <glm/glm.hpp>
void Callbacks::Register(GLFWwindow* window) void Callbacks::Register(GLFWwindow* window)

View File

@ -26,6 +26,7 @@ void RegisterDebugCallback()
#ifdef WIN32 #ifdef WIN32
#include <windows.h>
/* Only run this code on WindowsAPI systems, otherwise use cout */ /* Only run this code on WindowsAPI systems, otherwise use cout */
// C-based callback implementation // C-based callback implementation

View File

@ -23,6 +23,7 @@
//#include "LoadTexture.h" //Functions for creating OpenGL textures from image files //#include "LoadTexture.h" //Functions for creating OpenGL textures from image files
//#include "VideoRecorder.h" //Functions for saving videos //#include "VideoRecorder.h" //Functions for saving videos
#include "DebugCallback.h" #include "DebugCallback.h"
#include "PlatformUtils.h"
static const std::string vertex_shader("shaders/vertex.glsl"); static const std::string vertex_shader("shaders/vertex.glsl");
static const std::string fragment_shader("shaders/fragment.glsl"); static const std::string fragment_shader("shaders/fragment.glsl");