added some opengl files TODO: fix up using glew as optional
This commit is contained in:
parent
c614c679a9
commit
d170a64a41
24 changed files with 164 additions and 93 deletions
|
|
@ -72,43 +72,19 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/archeus_sdl2.cmake)
|
||||||
sdl2_check_and_init_needed(ARCHEUS_STD_FLAGS ARCHEUS_STD_SOURCES ${ARCHEUS_STD_WINDOW_BACKEND} ${ARCHEUS_STD_INPUT_BACKEND} ${ARCHEUS_STD_GRAPHICS_BACKEND})
|
sdl2_check_and_init_needed(ARCHEUS_STD_FLAGS ARCHEUS_STD_SOURCES ${ARCHEUS_STD_WINDOW_BACKEND} ${ARCHEUS_STD_INPUT_BACKEND} ${ARCHEUS_STD_GRAPHICS_BACKEND})
|
||||||
|
|
||||||
# ~ OPENGL ~ #
|
# ~ OPENGL ~ #
|
||||||
if(ARCHEUS_STD_GRAPHICS_BACKEND STREQUAL OPENGL)
|
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/archeus_opengl.cmake)
|
||||||
string(APPEND ARCHEUS_STD_FLAGS "-DARC_OPENGL ")
|
opengl_check_and_init_needed(ARCHEUS_STD_FLAGS ARCHEUS_STD_SOURCES ${ARCHEUS_STD_GRAPHICS_BACKEND})
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ARCHEUS_STD_GLFW)
|
# ~ GLFW ~ #
|
||||||
string(APPEND ARCHEUS_STD_FLAGS "-DARC_GLFW ")
|
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/archeus_glfw.cmake)
|
||||||
endif()
|
glfw_check_and_init_needed(ARCHEUS_STD_FLAGS ARCHEUS_STD_SOURCES ${ARCHEUS_STD_WINDOW_BACKEND} ${ARCHEUS_STD_INPUT_BACKEND})
|
||||||
|
|
||||||
if(ARCHEUS_STD_GLEW)
|
#if(ARCHEUS_STD_GLEW)
|
||||||
string(APPEND ARCHEUS_STD_FLAGS "-DARC_GLEW ")
|
# string(APPEND ARCHEUS_STD_FLAGS "-DARC_GLEW ")
|
||||||
endif()
|
#endif()
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS ${ARCHEUS_STD_FLAGS})
|
set(CMAKE_C_FLAGS ${ARCHEUS_STD_FLAGS})
|
||||||
|
|
||||||
set(ARCHEUS_STD_OPENGL_SOURCES
|
|
||||||
src/graphics/opengl/config.c
|
|
||||||
src/graphics/opengl/line.c
|
|
||||||
src/graphics/opengl/rectangle.c
|
|
||||||
src/graphics/opengl/renderer.c
|
|
||||||
src/graphics/opengl/sprite.c
|
|
||||||
src/graphics/opengl/spritesheet.c
|
|
||||||
src/graphics/opengl/window.c
|
|
||||||
)
|
|
||||||
|
|
||||||
set(ARCHEUS_STD_GLFW_SOURCES
|
|
||||||
src/input/glfw/keyboard.c
|
|
||||||
src/input/glfw/mouse.c
|
|
||||||
)
|
|
||||||
|
|
||||||
if(ARCHEUS_STD_OPENGL)
|
|
||||||
list(APPEND ARCHEUS_STD_SOURCES ${ARCHEUS_STD_OPENGL_SOURCES})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ARCHEUS_STD_GLFW)
|
|
||||||
list(APPEND ARCHEUS_STD_SOURCES ${ARCHEUS_STD_GLFW_SOURCES})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WIN32 AND NOT MSVC)
|
if(WIN32 AND NOT MSVC)
|
||||||
add_library(archeus_std STATIC ${ARCHEUS_STD_SOURCES})
|
add_library(archeus_std STATIC ${ARCHEUS_STD_SOURCES})
|
||||||
else()
|
else()
|
||||||
|
|
|
||||||
26
cmake/archeus_glfw.cmake
Normal file
26
cmake/archeus_glfw.cmake
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
set(ARCHEUS_STD_GLFW_WINDOW_SOURCES
|
||||||
|
src/graphics/glfw/config.c
|
||||||
|
src/graphics/glfw/renderer.c
|
||||||
|
src/graphics/glfw/window.c
|
||||||
|
)
|
||||||
|
|
||||||
|
set(ARCHEUS_STD_GLFW_INPUT_SOURCES
|
||||||
|
src/input/glfw/keyboard.c
|
||||||
|
src/input/glfw/mouse.c
|
||||||
|
)
|
||||||
|
|
||||||
|
function(glfw_check_and_init_needed _ARCHEUS_STD_FLAGS _ARCHEUS_STD_SOURCES ARCHEUS_STD_WINDOW_BACKEND ARCHEUS_STD_INPUT_BACKEND)
|
||||||
|
#add matching files for the selected backends
|
||||||
|
if(${ARCHEUS_STD_WINDOW_BACKEND} STREQUAL "GLFW")
|
||||||
|
string(APPEND ${_ARCHEUS_STD_FLAGS} "-lglfw -DARC_GLFW_WINDOW ")
|
||||||
|
list(APPEND ${_ARCHEUS_STD_SOURCES} ${ARCHEUS_STD_GLFW_WINDOW_SOURCES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(${ARCHEUS_STD_INPUT_BACKEND} STREQUAL "GLFW")
|
||||||
|
string(APPEND ${_ARCHEUS_STD_FLAGS} "-lglfw -lGLEW -DARC_GLFW_INPUT ")
|
||||||
|
list(APPEND ${_ARCHEUS_STD_SOURCES} ${ARCHEUS_STD_GLFW_INPUT_SOURCES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(${_ARCHEUS_STD_FLAGS} ${${_ARCHEUS_STD_FLAGS}} PARENT_SCOPE)
|
||||||
|
set(${_ARCHEUS_STD_SOURCES} ${${_ARCHEUS_STD_SOURCES}} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
set(ARCHEUS_STD_NONE_WINDOW_SOURCES
|
set(ARCHEUS_STD_NONE_WINDOW_SOURCES
|
||||||
|
src/graphics/none/window.c
|
||||||
)
|
)
|
||||||
|
|
||||||
set(ARCHEUS_STD_NONE_INPUT_SOURCES
|
set(ARCHEUS_STD_NONE_INPUT_SOURCES
|
||||||
|
|
@ -16,7 +17,6 @@ set(ARCHEUS_STD_NONE_GRAPHICS_SOURCES
|
||||||
src/graphics/none/sprite.c
|
src/graphics/none/sprite.c
|
||||||
src/graphics/none/spritesheet.c
|
src/graphics/none/spritesheet.c
|
||||||
src/graphics/none/text.c
|
src/graphics/none/text.c
|
||||||
src/graphics/none/window.c
|
|
||||||
)
|
)
|
||||||
|
|
||||||
function(none_check_and_init_needed _ARCHEUS_STD_FLAGS _ARCHEUS_STD_SOURCES ARCHEUS_STD_WINDOW_BACKEND ARCHEUS_STD_INPUT_BACKEND ARCHEUS_STD_GRAPHICS_BACKEND)
|
function(none_check_and_init_needed _ARCHEUS_STD_FLAGS _ARCHEUS_STD_SOURCES ARCHEUS_STD_WINDOW_BACKEND ARCHEUS_STD_INPUT_BACKEND ARCHEUS_STD_GRAPHICS_BACKEND)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
set(ARCHEUS_STD_OPENGL_GRAPHICS_SOURCES
|
||||||
|
src/graphics/opengl/circle.c
|
||||||
|
src/graphics/opengl/line.c
|
||||||
|
src/graphics/opengl/obround.c
|
||||||
|
src/graphics/opengl/rectangle.c
|
||||||
|
src/graphics/opengl/sprite.c
|
||||||
|
src/graphics/opengl/spritesheet.c
|
||||||
|
src/graphics/opengl/text.c
|
||||||
|
)
|
||||||
|
|
||||||
|
function(opengl_check_and_init_needed _ARCHEUS_STD_FLAGS _ARCHEUS_STD_SOURCES ARCHEUS_STD_GRAPHICS_BACKEND)
|
||||||
|
#add matching files for the selected backends
|
||||||
|
if(${ARCHEUS_STD_GRAPHICS_BACKEND} STREQUAL "OPENGL")
|
||||||
|
string(APPEND ${_ARCHEUS_STD_FLAGS} "-lGL -DARC_OPENGL_GRAPHICS ")
|
||||||
|
list(APPEND ${_ARCHEUS_STD_SOURCES} ${ARCHEUS_STD_OPENGL_GRAPHICS_SOURCES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(${_ARCHEUS_STD_FLAGS} ${${_ARCHEUS_STD_FLAGS}} PARENT_SCOPE)
|
||||||
|
set(${_ARCHEUS_STD_SOURCES} ${${_ARCHEUS_STD_SOURCES}} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
@ -1,27 +1,21 @@
|
||||||
#ifndef ARC_OPENGL_RENDERER_H_
|
#ifndef ARC_OPENGL_RENDERER_H_
|
||||||
#define ARC_OPENGL_RENDERER_H_
|
#define ARC_OPENGL_RENDERER_H_
|
||||||
|
|
||||||
#ifdef ARC_OPENGL
|
|
||||||
|
|
||||||
#ifdef ARC_GLEW
|
|
||||||
#define GLEW_STATIC
|
#define GLEW_STATIC
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#endif // !ARC_GLEW
|
|
||||||
|
|
||||||
#ifdef ARC_GLFW
|
#ifdef ARC_GLFW_WINDOW
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "arc/graphics/renderer.h"
|
#include "arc/graphics/renderer.h"
|
||||||
#include "arc/graphics/window.h"
|
#include "arc/graphics/window.h"
|
||||||
|
|
||||||
#ifdef ARC_GLFW
|
|
||||||
typedef struct ARC_RendererType {
|
typedef struct ARC_RendererType {
|
||||||
GLFWwindow *window;
|
GLFWwindow *window;
|
||||||
} ARC_RendererType;
|
} ARC_RendererType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief struct for info needed to create opengl renderer
|
* @brief struct for info needed to create glfw renderer
|
||||||
*
|
*
|
||||||
* @note this is what needs to be passed into the data parameter for ARC_Renderer_Create
|
* @note this is what needs to be passed into the data parameter for ARC_Renderer_Create
|
||||||
*/
|
*/
|
||||||
|
|
@ -29,8 +23,6 @@ struct ARC_RenderInfo {
|
||||||
GLFWwindow *window;
|
GLFWwindow *window;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !ARC_GLFW
|
#endif // !ARC_GLFW_WINDOW
|
||||||
|
|
||||||
#endif // !ARC_OPENGL
|
|
||||||
|
|
||||||
#endif // !ARC_OPENGL_RENDERER_H_
|
#endif // !ARC_OPENGL_RENDERER_H_
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
#ifndef ARC_OPENGL_WINDOW_H_
|
#ifndef ARC_OPENGL_WINDOW_H_
|
||||||
#define ARC_OPENGL_WINDOW_H_
|
#define ARC_OPENGL_WINDOW_H_
|
||||||
|
|
||||||
#ifdef ARC_GLFW
|
#ifdef ARC_GLFW_WINDOW
|
||||||
|
|
||||||
#ifdef ARC_GLEW
|
|
||||||
#define GLEW_STATIC
|
#define GLEW_STATIC
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#endif // !ARC_GLEW
|
|
||||||
|
|
||||||
#include "arc/graphics/window.h"
|
#include "arc/graphics/window.h"
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
@ -24,6 +22,6 @@ struct ARC_WindowInfo {
|
||||||
int h;
|
int h;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !ARC_GLFW
|
#endif // !ARC_GLFW_WINDOW
|
||||||
|
|
||||||
#endif // !ARC_GLFW_WINDOW_H_
|
#endif // !ARC_GLFW_WINDOW_H_
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
#ifndef ARC_OPENGL_SPRITE_H_
|
#ifndef ARC_OPENGL_SPRITE_H_
|
||||||
#define ARC_OPENGL_SPRITE_H_
|
#define ARC_OPENGL_SPRITE_H_
|
||||||
|
|
||||||
#ifdef ARC_OPENGL
|
#ifdef ARC_OPENGL_GRAPHICS
|
||||||
|
|
||||||
#include "arc/graphics/sprite.h"
|
#include "arc/graphics/sprite.h"
|
||||||
|
|
||||||
struct ARC_Sprite {
|
struct ARC_Sprite {
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !ARC_OPENGL
|
#endif // !ARC_OPENGL_GRAPHICS
|
||||||
|
|
||||||
#endif // !ARC_OPENGL_SPRITE_H_
|
#endif // !ARC_OPENGL_SPRITE_H_
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
#ifndef ARC_OPENGL_SPRITESHEET_H_
|
#ifndef ARC_OPENGL_SPRITESHEET_H_
|
||||||
#define ARC_OPENGL_SPRITESHEET_H_
|
#define ARC_OPENGL_SPRITESHEET_H_
|
||||||
|
|
||||||
#ifdef ARC_OPENGL
|
#ifdef ARC_OPENGL_GRAPHICS
|
||||||
|
|
||||||
#include "arc/graphics/spritesheet.h"
|
#include "arc/graphics/spritesheet.h"
|
||||||
|
|
||||||
struct ARC_Spritesheet {
|
struct ARC_Spritesheet {
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !ARC_OPENGL
|
#endif // !ARC_OPENGL_GRAPHICS
|
||||||
|
|
||||||
#endif // !ARC_OPENGL_SPRITESHEET_H_
|
#endif // !ARC_OPENGL_SPRITESHEET_H_
|
||||||
|
|
|
||||||
14
include/arc/graphics/opengl/text.h
Normal file
14
include/arc/graphics/opengl/text.h
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef ARC_OPENGL_TEXT_H_
|
||||||
|
#define ARC_OPENGL_TEXT_H_
|
||||||
|
|
||||||
|
#include "arc/std/string.h"
|
||||||
|
#include "arc/graphics/color.h"
|
||||||
|
#include "arc/math/rectangle.h"
|
||||||
|
|
||||||
|
#ifdef ARC_OPENGL_GRAPHICS
|
||||||
|
|
||||||
|
typedef struct ARC_Text {} ARC_Text;
|
||||||
|
|
||||||
|
#endif // !ARC_OPENGL_GRAPHICS
|
||||||
|
|
||||||
|
#endif // !ARC_OPENGL_TEXT_H_
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef ARC_GLFW_KEYBOARD_H_
|
#ifndef ARC_GLFW_KEYBOARD_H_
|
||||||
#define ARC_GLFW_KEYBOARD_H_
|
#define ARC_GLFW_KEYBOARD_H_
|
||||||
|
|
||||||
#ifdef ARC_GLFW
|
#ifdef ARC_GLFW_INPUT
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
#include "arc/input/keyboard.h"
|
#include "arc/input/keyboard.h"
|
||||||
|
|
||||||
|
|
@ -16,6 +16,6 @@ struct ARC_KeyboardInfo {
|
||||||
GLFWwindow *window;
|
GLFWwindow *window;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !ARC_GLFW
|
#endif // !ARC_GLFW_INPUT
|
||||||
|
|
||||||
#endif // !ARC_GLFW_KEYBOARD_H_
|
#endif // !ARC_GLFW_KEYBOARD_H_
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef ARC_GLFW_MOUSE_H_
|
#ifndef ARC_GLFW_MOUSE_H_
|
||||||
#define ARC_GLFW_MOUSE_H_
|
#define ARC_GLFW_MOUSE_H_
|
||||||
|
|
||||||
#ifdef ARC_GLFW
|
#ifdef ARC_GLFW_INPUT
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
#include "arc/input/mouse.h"
|
#include "arc/input/mouse.h"
|
||||||
#include "arc/math/point.h"
|
#include "arc/math/point.h"
|
||||||
|
|
@ -20,6 +20,6 @@ struct ARC_MouseInfo {
|
||||||
GLFWwindow *window;
|
GLFWwindow *window;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !ARC_GLFW
|
#endif // !ARC_GLFW_INPUT
|
||||||
|
|
||||||
#endif // !ARC_GLFW_MOUSE_H_
|
#endif // !ARC_GLFW_MOUSE_H_
|
||||||
|
|
@ -22,14 +22,12 @@
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <SDL_video.h>
|
#include <SDL_video.h>
|
||||||
#include <SDL2/SDL_ttf.h>
|
#include <SDL2/SDL_ttf.h>
|
||||||
#elif ARC_OPENGL
|
#endif
|
||||||
#include "arc/graphics/opengl/window.h"
|
|
||||||
#include "arc/graphics/opengl/renderer.h"
|
#include "arc/graphics/glfw/window.h"
|
||||||
#ifdef ARC_GLFW
|
#include "arc/graphics/glfw/renderer.h"
|
||||||
#include "arc/input/glfw/mouse.h"
|
#include "arc/input/glfw/mouse.h"
|
||||||
#include "arc/input/glfw/keyboard.h"
|
#include "arc/input/glfw/keyboard.h"
|
||||||
#endif // ARC_GLFW
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void ARC_EngineData_Create(ARC_EngineData **data, ARC_Handler_CleanDataFn cleanfn, ARC_Point windowSize){
|
void ARC_EngineData_Create(ARC_EngineData **data, ARC_Handler_CleanDataFn cleanfn, ARC_Point windowSize){
|
||||||
*data = (ARC_EngineData *)malloc(sizeof(ARC_EngineData));
|
*data = (ARC_EngineData *)malloc(sizeof(ARC_EngineData));
|
||||||
|
|
@ -52,7 +50,7 @@ void ARC_EngineData_Create(ARC_EngineData **data, ARC_Handler_CleanDataFn cleanf
|
||||||
|
|
||||||
#ifdef ARC_SDL
|
#ifdef ARC_SDL
|
||||||
windowInfo = (ARC_WindowInfo){ "title", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, (*data)->windowSize.x, (*data)->windowSize.y, 0 };
|
windowInfo = (ARC_WindowInfo){ "title", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, (*data)->windowSize.x, (*data)->windowSize.y, 0 };
|
||||||
#elif ARC_GLFW
|
#elif ARC_GLFW_WINDOW
|
||||||
windowInfo = (ARC_WindowInfo){ "title", (*data)->windowSize.x, (*data)->windowSize.y };
|
windowInfo = (ARC_WindowInfo){ "title", (*data)->windowSize.x, (*data)->windowSize.y };
|
||||||
#endif // ARC_SDL
|
#endif // ARC_SDL
|
||||||
|
|
||||||
|
|
@ -64,7 +62,7 @@ void ARC_EngineData_Create(ARC_EngineData **data, ARC_Handler_CleanDataFn cleanf
|
||||||
|
|
||||||
#ifdef ARC_SDL
|
#ifdef ARC_SDL
|
||||||
renderInfo = (ARC_RenderInfo){ (SDL_Window *)(*data)->window, -1, SDL_RENDERER_ACCELERATED };
|
renderInfo = (ARC_RenderInfo){ (SDL_Window *)(*data)->window, -1, SDL_RENDERER_ACCELERATED };
|
||||||
#elif ARC_GLFW
|
#elif ARC_GLFW_WINDOW
|
||||||
renderInfo = (ARC_RenderInfo){ (GLFWwindow *)(*data)->window };
|
renderInfo = (ARC_RenderInfo){ (GLFWwindow *)(*data)->window };
|
||||||
#endif // ARC_SDL
|
#endif // ARC_SDL
|
||||||
|
|
||||||
|
|
@ -122,7 +120,7 @@ void ARC_Engine_Run(ARC_EngineData *data){
|
||||||
|
|
||||||
SDL_PollEvent(data->mouse->event);
|
SDL_PollEvent(data->mouse->event);
|
||||||
if(event->type == SDL_QUIT){ data->running = 1; }
|
if(event->type == SDL_QUIT){ data->running = 1; }
|
||||||
#elif ARC_GLFW
|
#elif ARC_GLFW_WINDOW
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
data->running = glfwWindowShouldClose((GLFWwindow *)data->window);
|
data->running = glfwWindowShouldClose((GLFWwindow *)data->window);
|
||||||
#endif // ARC_SDL
|
#endif // ARC_SDL
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
#ifdef ARC_OPENGL
|
#ifdef ARC_GLFW_WINDOW
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "arc/std/config.h"
|
#include "arc/std/config.h"
|
||||||
#include "arc/std/string.h"
|
#include "arc/std/string.h"
|
||||||
#include "arc/std/errno.h"
|
#include "arc/std/errno.h"
|
||||||
|
|
||||||
#include "arc/graphics/opengl/renderer.h"
|
#include "arc/graphics/glfw/renderer.h"
|
||||||
|
|
||||||
|
|
||||||
void ARC_GraphicsConfig_Init(ARC_Config *config, ARC_Renderer *renderer){
|
void ARC_GraphicsConfig_Init(ARC_Config *config, ARC_Renderer *renderer){
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ARC_OPENGL
|
#endif // ARC_OPENGL_GRAPHICS
|
||||||
|
|
@ -1,15 +1,13 @@
|
||||||
#ifdef ARC_OPENGL
|
#ifdef ARC_GLFW_WINDOW
|
||||||
#include "arc/graphics/renderer.h"
|
#include "arc/graphics/renderer.h"
|
||||||
#include "arc/graphics/opengl/renderer.h"
|
#include "arc/graphics/glfw/renderer.h"
|
||||||
|
|
||||||
#ifdef ARC_GLEW
|
// #ifdef ARC_GLEW
|
||||||
#define GLEW_STATIC
|
#define GLEW_STATIC
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#endif // ARC_GLEW
|
// #endif // ARC_GLEW
|
||||||
|
|
||||||
#ifdef ARC_GLFW
|
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "arc/graphics/window.h"
|
#include "arc/graphics/window.h"
|
||||||
#include "arc/std/errno.h"
|
#include "arc/std/errno.h"
|
||||||
|
|
@ -22,18 +20,17 @@ void ARC_Renderer_Create(ARC_Renderer **renderer, ARC_RenderInfo *info){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ARC_GLFW
|
// #ifdef ARC_GLEW
|
||||||
*renderer = (ARC_Renderer *)malloc(sizeof(ARC_Renderer));
|
*renderer = (ARC_Renderer *)malloc(sizeof(ARC_Renderer));
|
||||||
(*renderer)->window = info->window;
|
(*renderer)->window = info->window;
|
||||||
|
|
||||||
|
|
||||||
glewExperimental = GL_TRUE;
|
glewExperimental = GL_TRUE;
|
||||||
if(glewInit() != GLEW_OK){
|
if(glewInit() != GLEW_OK){
|
||||||
ARC_DEBUG_ERR("ARC_Renderer_Create(**renderer, info), GLEW failed to init");
|
ARC_DEBUG_ERR("ARC_Renderer_Create(**renderer, info), GLEW failed to init");
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
arc_errno = ARC_ERRNO_INIT;
|
arc_errno = ARC_ERRNO_INIT;
|
||||||
}
|
}
|
||||||
#endif // ARC_GLEW
|
// #endif // ARC_GLEW
|
||||||
|
|
||||||
glClearColor(0.23f, 0.38f, 0.47f, 1.0f);
|
glClearColor(0.23f, 0.38f, 0.47f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
@ -47,9 +44,9 @@ void ARC_Renderer_Clear(ARC_Renderer *renderer){
|
||||||
}
|
}
|
||||||
|
|
||||||
void ARC_Renderer_Render(ARC_Renderer *renderer){
|
void ARC_Renderer_Render(ARC_Renderer *renderer){
|
||||||
#ifdef ARC_GLFW
|
// #ifdef ARC_GLEW
|
||||||
glfwSwapBuffers(renderer->window);
|
glfwSwapBuffers(renderer->window);
|
||||||
#endif // ARC_GLEW
|
// #endif // ARC_GLEW
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //ARC_SDL
|
#endif //ARC_SDL
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#ifdef ARC_GLFW
|
#ifdef ARC_GLFW_WINDOW
|
||||||
#include "arc/graphics/window.h"
|
#include "arc/graphics/window.h"
|
||||||
#include "arc/graphics/opengl/window.h"
|
#include "arc/graphics/glfw/window.h"
|
||||||
|
|
||||||
#include "arc/std/errno.h"
|
#include "arc/std/errno.h"
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
10
src/graphics/opengl/circle.c
Normal file
10
src/graphics/opengl/circle.c
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
#ifdef ARC_OPENGL_GRAPHICS
|
||||||
|
|
||||||
|
#include "arc/graphics/circle.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void ARC_Circle_Render(ARC_Circle *circle, ARC_Renderer *renderer, ARC_Color *color){
|
||||||
|
printf("OpenGL Backend Selected\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !ARC_OPENGL_GRAPHICS
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
#ifdef ARC_OPENGL
|
#ifdef ARC_OPENGL_GRAPHICS
|
||||||
#include "arc/graphics/line.h"
|
#include "arc/graphics/line.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
void ARC_Line_Render(int32_t *x1, int32_t *y1, int32_t *x2, int32_t *y2, ARC_Renderer *renderer, ARC_Color *color){
|
void ARC_Line_Render(int32_t *x1, int32_t *y1, int32_t *x2, int32_t *y2, ARC_Renderer *renderer, ARC_Color *color){
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ARC_OPENGL
|
#endif // ARC_OPENGL_GRAPHICS
|
||||||
14
src/graphics/opengl/obround.c
Normal file
14
src/graphics/opengl/obround.c
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
#ifdef ARC_OPENGL_GRAPHICS
|
||||||
|
|
||||||
|
#include "arc/graphics/obround.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void ARC_Obround_Render(ARC_Obround *obround, ARC_Renderer *renderer, ARC_Color *color){
|
||||||
|
printf("OpenGL Backend Selected\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void ARC_FObround_Render(ARC_FObround *obround, ARC_Renderer *renderer, ARC_Color *color){
|
||||||
|
printf("OpenGL Backend Selected\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // ARC_OPENGL_GRAPHICS
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifdef ARC_OPENGL
|
#ifdef ARC_OPENGL_GRAPHICS
|
||||||
#include "arc/graphics/rectangle.h"
|
#include "arc/graphics/rectangle.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
@ -8,4 +8,4 @@ void ARC_Rect_Render(ARC_Rect *rect, ARC_Renderer *renderer, ARC_Color *color){
|
||||||
void ARC_Rect_RenderFill(ARC_Rect *rect, ARC_Renderer *renderer, ARC_Color *color){
|
void ARC_Rect_RenderFill(ARC_Rect *rect, ARC_Renderer *renderer, ARC_Color *color){
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ARC_OPENGL
|
#endif // ARC_OPENGL_GRAPHICS
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifdef ARC_OPENGL
|
#ifdef ARC_OPENGL_GRAPHICS
|
||||||
#include "arc/graphics/sprite.h"
|
#include "arc/graphics/sprite.h"
|
||||||
#include "arc/math/point.h"
|
#include "arc/math/point.h"
|
||||||
#include "arc/math/rectangle.h"
|
#include "arc/math/rectangle.h"
|
||||||
|
|
@ -26,4 +26,4 @@ ARC_Rect *ARC_Sprite_GetBounds(ARC_Sprite *sprite){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ARC_OPENGL
|
#endif // ARC_OPENGL_GRAPHICS
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifdef ARC_OPENGL
|
#ifdef ARC_OPENGL_GRAPHICS
|
||||||
#include "arc/graphics/spritesheet.h"
|
#include "arc/graphics/spritesheet.h"
|
||||||
#include "arc/math/point.h"
|
#include "arc/math/point.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
@ -14,4 +14,4 @@ uint32_t *ARC_Spritesheet_GetTileSize(ARC_Spritesheet *spritesheet){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ARC_OPENGL
|
#endif // ARC_OPENGL_GRAPHICS
|
||||||
26
src/graphics/opengl/text.c
Normal file
26
src/graphics/opengl/text.c
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
#ifdef ARC_OPENGL_GRAPHICS
|
||||||
|
|
||||||
|
#include "arc/graphics/text.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void ARC_Text_Create(ARC_Text **text, ARC_String *path, int32_t size, ARC_Color color){
|
||||||
|
printf("OpenGL Backend Selected\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void ARC_Text_Destroy(ARC_Text *font){
|
||||||
|
printf("OpenGL Backend Selected\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void ARC_Text_SetString(ARC_Text *text, ARC_Renderer *renderer, ARC_String *string){
|
||||||
|
printf("OpenGL Backend Selected\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void ARC_Text_Render(ARC_Text *text, ARC_Renderer *renderer){
|
||||||
|
printf("OpenGL Backend Selected\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void ARC_Text_SetPos(ARC_Text *text, ARC_Point pos){
|
||||||
|
printf("OpenGL Backend Selected\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !ARC_OPENGL_GRAPHICS
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifdef ARC_GLFW
|
#ifdef ARC_GLFW_INPUT
|
||||||
#include "arc/input/glfw/keyboard.h"
|
#include "arc/input/glfw/keyboard.h"
|
||||||
#include "arc/input/keyboard.h"
|
#include "arc/input/keyboard.h"
|
||||||
#include "arc/math/point.h"
|
#include "arc/math/point.h"
|
||||||
|
|
@ -19,4 +19,4 @@ ARC_KeyboardState ARC_Keyboard_GetState(ARC_Keyboard *keyboard, enum ARC_Keyboar
|
||||||
return ARC_KEY_NONE;
|
return ARC_KEY_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ARC_GLFW
|
#endif // ARC_GLFW_INPUT
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifdef ARC_GLFW
|
#ifdef ARC_GLFW_INPUT
|
||||||
#include "arc/input/glfw/mouse.h"
|
#include "arc/input/glfw/mouse.h"
|
||||||
#include "arc/input/mouse.h"
|
#include "arc/input/mouse.h"
|
||||||
#include "arc/math/point.h"
|
#include "arc/math/point.h"
|
||||||
|
|
@ -30,4 +30,4 @@ int32_t *ARC_Mouse_GetScrollY(ARC_Mouse *mouse){
|
||||||
return mouse->scrollY;
|
return mouse->scrollY;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ARC_SDL
|
#endif // ARC_SDL_INPUT
|
||||||
Loading…
Add table
Add a link
Reference in a new issue