Have the submodules working correctly.

This commit is contained in:
2021-09-30 21:38:01 -07:00
parent 7ce46d3e44
commit 88a75e2ddd
15 changed files with 6950 additions and 48 deletions

View File

@ -4,22 +4,23 @@
# https://opensource.org/licenses/MIT
# Add Sources
file(GLOB_RECURSE SOURCES *.c)
add_library(src STATIC ${SOURCES})
target_include_directories(src PUBLIC ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(src PUBLIC
file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR}/*.c)
add_library(game STATIC ${SRCS})
target_include_directories(game PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(game PUBLIC
glad
cglm
duktape
glad_gl_core_33
stb
)
# Set up flags
target_compile_definitions(src PRIVATE
target_compile_definitions(game PRIVATE
SETTING_PLATFORM_GLFW=1
SETTING_PLATFORM=1
SETTING_PLATFORM_USE_GLAD=1
SETTING_ASSET_PREFIX="../assets/"
SETTING_ASSET_PREFIX="../../../assets/"
SETTING_GAME_NAME="DawnGame"
SETTING_GAME_POKER=1
SETTING_GAME_DAWN=2

View File

@ -19,7 +19,7 @@ void inputInit(input_t *input) {
input->previous = input->inputsB;
// Create the buffer, zero all the values out.
memset(&input->buffer, 0, sizeof(inputval_t)*INPUT_SOURCE_COUNT);
memset(input->buffer, 0, sizeof(inputval_t)*INPUT_SOURCE_COUNT);
}
void inputUpdate(input_t *input) {
@ -66,6 +66,10 @@ void inputUnbind(input_t *input, inputbind_t bind, inputsource_t source) {
listRemove(input->bindMap[bind], (void *)source);
}
void inputStateSet(input_t *input, inputsource_t source, float value) {
input->buffer[source] = value;
}
bool inputIsDown(input_t *input, inputbind_t binding) {
return input->current[binding] != 0;
}

View File

@ -111,6 +111,15 @@ void inputBind(input_t *input, inputbind_t bind, inputsource_t source);
*/
void inputUnbind(input_t *input, inputbind_t bind, inputsource_t source);
/**
* Set the state of an input.
*
* @param input Input to set the state for.
* @param source Source to set.
* @param value Value to set.
*/
void inputStateSet(input_t *input, inputsource_t source, float value);
/**
* Is the current input "down", being pressed, being moved, not in a state
* of rest.

View File

@ -6,13 +6,12 @@
#pragma once
// Static Libs
#include <glad/gl.h>
#include <glad/glad.h>
#include <duktape.h>
#include <cglm/cglm.h>
#include <stb_image.h>
#include <stb_truetype.h>
// Standard Libs
#include <stdio.h>
#include <stdint.h>
@ -25,7 +24,7 @@
#if defined(_WIN32) || defined(_WIN64)
// Windows Fixes
# define strtok_r strtok_s
# define sleep(n) Sleep(n)
# define sleep(n) _sleep(n)
#else
// Unix Fixes
#include <unistd.h>