Fixed mouse bug on windows, recompiled and added SDL2 and OpenAL for windows

dev
Shariq Shah 9 years ago
parent 145a0977ee
commit e95074a904
  1. 2
      build/linux/makefile
  2. 129
      include/SDL2/SDL_config_windows.h
  3. BIN
      libs/debug/win64_msvc/OpenAL32.lib
  4. BIN
      libs/debug/win64_msvc/OpenAL32.pdb
  5. BIN
      libs/debug/win64_msvc/SDL2.lib
  6. BIN
      libs/release/win64_msvc/OpenAL32.lib
  7. BIN
      libs/release/win64_msvc/SDL2.lib
  8. 6
      orgfile.org
  9. 11
      src/game.c
  10. 14
      src/geometry.c
  11. 2
      src/geometry.h
  12. 6
      src/gui.c
  13. 10
      src/input.h
  14. 5
      src/transform.c

@ -1,5 +1,5 @@
PROJECT_NAME = Symmetry
CC = gcc
CC = clang
SRC_DIR = ../../src
INCLUDE_DIR = ../../include
LIB_DIR_RELEASE = ../../libs/release/linux64_gcc

@ -24,7 +24,6 @@
/* General platform specific identifiers */
#include "SDL_platform.h"
/* C language features */
/* #undef const */
/* #undef inline */
@ -51,26 +50,26 @@
#define HAVE_DXGI_H 1
/* Comment this if you want to build without any C library requirements */
/* #undef HAVE_LIBC */
#define HAVE_LIBC 1
#if HAVE_LIBC
/* Useful headers */
/* #undef HAVE_ALLOCA_H */
/* #undef HAVE_SYS_TYPES_H */
/* #undef HAVE_STDIO_H */
/* #undef STDC_HEADERS */
#define HAVE_STDIO_H 1
#define STDC_HEADERS 1
/* #undef HAVE_STDLIB_H */
#define HAVE_STDARG_H 1
/* #undef HAVE_STDARG_H */
/* #undef HAVE_MALLOC_H */
/* #undef HAVE_MEMORY_H */
/* #undef HAVE_STRING_H */
#define HAVE_STRING_H 1
/* #undef HAVE_STRINGS_H */
/* #undef HAVE_INTTYPES_H */
/* #undef HAVE_STDINT_H */
/* #undef HAVE_CTYPE_H */
/* #undef HAVE_MATH_H */
#define HAVE_CTYPE_H 1
#define HAVE_MATH_H 1
/* #undef HAVE_ICONV_H */
/* #undef HAVE_SIGNAL_H */
#define HAVE_SIGNAL_H 1
/* #undef HAVE_ALTIVEC_H */
/* #undef HAVE_PTHREAD_NP_H */
/* #undef HAVE_LIBUDEV_H */
@ -79,77 +78,77 @@
/* #undef HAVE_FCITX_FRONTEND_H */
/* C library functions */
/* #undef HAVE_MALLOC */
/* #undef HAVE_CALLOC */
/* #undef HAVE_REALLOC */
/* #undef HAVE_FREE */
/* #undef HAVE_ALLOCA */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */
/* #undef HAVE_GETENV */
/* #undef HAVE_SETENV */
/* #undef HAVE_PUTENV */
/* #undef HAVE_UNSETENV */
#endif
/* #undef HAVE_QSORT */
/* #undef HAVE_ABS */
#define HAVE_QSORT 1
#define HAVE_ABS 1
/* #undef HAVE_BCOPY */
/* #undef HAVE_MEMSET */
/* #undef HAVE_MEMCPY */
/* #undef HAVE_MEMMOVE */
/* #undef HAVE_MEMCMP */
/* #undef HAVE_STRLEN */
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
/* #undef HAVE_STRLCPY */
/* #undef HAVE_STRLCAT */
/* #undef HAVE_STRDUP */
/* #undef HAVE__STRREV */
/* #undef HAVE__STRUPR */
/* #undef HAVE__STRLWR */
#define HAVE__STRREV 1
#define HAVE__STRUPR 1
#define HAVE__STRLWR 1
/* #undef HAVE_INDEX */
/* #undef HAVE_RINDEX */
/* #undef HAVE_STRCHR */
/* #undef HAVE_STRRCHR */
/* #undef HAVE_STRSTR */
/* #undef HAVE_ITOA */
/* #undef HAVE__LTOA */
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_ITOA 1
#define HAVE__LTOA 1
/* #undef HAVE__UITOA */
/* #undef HAVE__ULTOA */
/* #undef HAVE_STRTOL */
/* #undef HAVE_STRTOUL */
#define HAVE__ULTOA 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
/* #undef HAVE__I64TOA */
/* #undef HAVE__UI64TOA */
/* #undef HAVE_STRTOLL */
#define HAVE_STRTOLL 1
/* #undef HAVE_STRTOULL */
/* #undef HAVE_STRTOD */
/* #undef HAVE_ATOI */
/* #undef HAVE_ATOF */
/* #undef HAVE_STRCMP */
/* #undef HAVE_STRNCMP */
/* #undef HAVE__STRICMP */
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE__STRICMP 1
/* #undef HAVE_STRCASECMP */
/* #undef HAVE__STRNICMP */
#define HAVE__STRNICMP 1
/* #undef HAVE_STRNCASECMP */
/* #undef HAVE_VSSCANF */
/* #undef HAVE_VSNPRINTF */
/* #undef HAVE_M_PI */
/* #undef HAVE_ATAN */
/* #undef HAVE_ATAN2 */
/* #undef HAVE_ACOS */
/* #undef HAVE_ASIN */
/* #undef HAVE_CEIL */
/* #undef HAVE_COPYSIGN */
/* #undef HAVE_COS */
/* #undef HAVE_COSF */
/* #undef HAVE_FABS */
/* #undef HAVE_FLOOR */
/* #undef HAVE_LOG */
/* #undef HAVE_POW */
/* #undef HAVE_SCALBN */
/* #undef HAVE_SIN */
/* #undef HAVE_SINF */
/* #undef HAVE_SQRT */
/* #undef HAVE_SQRTF */
/* #undef HAVE_TAN */
/* #undef HAVE_TANF */
#define HAVE_M_PI 1
#define HAVE_ATAN 1
#define HAVE_ATAN2 1
#define HAVE_ACOS 1
#define HAVE_ASIN 1
#define HAVE_CEIL 1
#define HAVE_COPYSIGN 1
#define HAVE_COS 1
#define HAVE_COSF 1
#define HAVE_FABS 1
#define HAVE_FLOOR 1
#define HAVE_LOG 1
#define HAVE_POW 1
#define HAVE_SCALBN 1
#define HAVE_SIN 1
#define HAVE_SINF 1
#define HAVE_SQRT 1
#define HAVE_SQRTF 1
#define HAVE_TAN 1
#define HAVE_TANF 1
/* #undef HAVE_FSEEKO */
/* #undef HAVE_FSEEKO64 */
/* #undef HAVE_SIGACTION */
@ -166,8 +165,8 @@
/* #undef HAVE_PTHREAD_SET_NAME_NP */
/* #undef HAVE_SEM_TIMEDWAIT */
#elif __WIN32__
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
/* #undef HAVE_STDARG_H */
/* #undef HAVE_STDDEF_H */
#else
/* We may need some replacement for stdarg.h here */
#include <stdarg.h>
@ -314,18 +313,18 @@
/* #undef SDL_VIDEO_RENDER_D3D11 */
#define SDL_VIDEO_RENDER_OGL 1
/* #undef SDL_VIDEO_RENDER_OGL_ES */
#define SDL_VIDEO_RENDER_OGL_ES2 1
/* #undef SDL_VIDEO_RENDER_OGL_ES2 */
/* #undef SDL_VIDEO_RENDER_DIRECTFB */
/* Enable OpenGL support */
#define SDL_VIDEO_OPENGL 1
/* #undef SDL_VIDEO_OPENGL_ES */
#define SDL_VIDEO_OPENGL_ES2 1
/* #undef SDL_VIDEO_OPENGL_ES2 */
/* #undef SDL_VIDEO_OPENGL_BGL */
/* #undef SDL_VIDEO_OPENGL_CGL */
/* #undef SDL_VIDEO_OPENGL_GLX */
#define SDL_VIDEO_OPENGL_WGL 1
#define SDL_VIDEO_OPENGL_EGL 1
/* #undef SDL_VIDEO_OPENGL_EGL */
/* #undef SDL_VIDEO_OPENGL_OSMESA */
/* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */

Binary file not shown.

Binary file not shown.

@ -92,7 +92,8 @@ All the code in this repository is under GPLv3, see LICENSE for more information
** CANCELED Deferred rendering?
- State "CANCELED" from "TODO" [2017-02-26 Sun 01:49] \\
Sticking with forward rendering for now and focusing on tools etc.
** TODO Fix mouse bugs on windows
** DONE Fix mouse bugs on windows
- State "DONE" from "TODO" [2017-03-25 Sat 17:27]
** TODO Configuration/Settings load/save handling
** DONE Fix mousewheel bugs and gui not responding to mousewheel input
- State "DONE" from "TODO" [2017-03-19 Sun 01:31]
@ -110,8 +111,9 @@ x Font atlas proper cleanup
- Decoupled event handling of gui and input if possible
- Custom rendering for gui
** TODO Allow passsing base path as commandline argument?
** TODO Fix Key release not being reported
** TODO Better handling incase assets folder is not found?
** DONE OpenAL not working in release builds
** DONE OpenAL not working in releasebuilds
- State "DONE" from "TODO" [2017-03-25 Sat 02:06]
** DONE 3d sound using OpenAL
- State "DONE" from "TODO" [2017-03-23 Thu 01:43]

@ -87,6 +87,7 @@ void scene_setup(void)
int turn_up_keys[1] = {KEY_I};
int turn_down_keys[1] = {KEY_K};
int sprint_keys[2] = {KEY_LSHIFT, KEY_RSHIFT};
int recompute_keys[2] = {KEY_F5, KEY_H};
input_map_create("Move_Forward", forward_keys, 2);
input_map_create("Move_Backward", backward_keys, 2);
input_map_create("Move_Up", up_keys, 1);
@ -98,6 +99,7 @@ void scene_setup(void)
input_map_create("Turn_Up", turn_up_keys, 1);
input_map_create("Turn_Down", turn_down_keys, 1);
input_map_create("Sprint", sprint_keys, 2);
input_map_create("Recompute", recompute_keys, 2);
struct Entity* player = scene_add_new("player", "None");
game_state->player_node = player->node;
@ -228,10 +230,15 @@ void debug(float dt)
if(input_map_state_get("Turn_Right", KS_PRESSED)) turn_left_right += turn_speed;
if(input_map_state_get("Turn_Left", KS_PRESSED)) turn_left_right -= turn_speed;
if(input_map_state_get("Recompute", KS_PRESSED))
{
log_message("Regenerating Bounding Volumes");
geom_bounding_volume_generate_all();
}
/* if(input_key_state_get(KEY_TAB, KS_PRESSED)) */
/* if(input_key_state_get(KEY_TAB, KS_PRESSED) && input_key_state_get(KEY_LSHIFT, KS_PRESSED)) input_mouse_mode_set(MM_NORMAL); */
if(input_mousebutton_state_get(MB_RIGHT, KS_PRESSED))
if(input_mousebutton_state_get(MSB_RIGHT, KS_PRESSED))
{
if(input_mouse_mode_get() != MM_RELATIVE) input_mouse_mode_set(MM_RELATIVE);
const double scale = 0.25;
@ -1574,7 +1581,7 @@ void debug_gui(float dt)
}
}
nk_end(ctx);
return !nk_window_is_closed(ctx, "Overview");
//return !nk_window_is_closed(ctx, "Overview");
}

@ -44,7 +44,6 @@ static GLenum* draw_modes;
static int load_from_file(struct Geometry* geometry, const char* filename);
static void create_vao(struct Geometry* geometry);
static struct Geometry* generate_new_index(int* out_new_index);
static void generate_bounding_volume(int geomtry_index);
void geom_init(void)
{
@ -71,9 +70,9 @@ int geom_find(const char* filename)
return index;
}
static void generate_bounding_volume(int geometry_index)
void geom_bounding_volume_generate(int index)
{
struct Geometry* geometry = &geometry_list[geometry_index];
struct Geometry* geometry = &geometry_list[index];
struct Bounding_Box* box = &geometry->bounding_box;
struct Bounding_Sphere* sphere = &geometry->bounding_sphere;
@ -98,6 +97,13 @@ static void generate_bounding_volume(int geometry_index)
vec3 len_vec;
vec3_sub(&len_vec, &box->max, &sphere->center);
sphere->radius = fabsf(vec3_len(&len_vec));
log_message("Radius : %.3f", sphere->radius);
}
void geom_bounding_volume_generate_all(void)
{
for(int i = 0; i < array_len(geometry_list); i++)
geom_bounding_volume_generate(i);
}
static struct Geometry* generate_new_index(int* out_new_index)
@ -134,7 +140,7 @@ int geom_create_from_file(const char* name)
if(load_from_file(new_geo, name))
{
create_vao(new_geo);
generate_bounding_volume(index);
geom_bounding_volume_generate(index);
}
else
{

@ -20,6 +20,8 @@ int geom_find(const char* filename);
void geom_remove(int index);
void geom_cleanup(void);
void geom_render(int index, enum Geometry_Draw_Mode);
void geom_bounding_volume_generate(int index);
void geom_bounding_volume_generate_all(void);
int geom_render_in_frustum(int index,
vec4* frustum,
struct Transform* transform,

@ -314,9 +314,9 @@ void gui_handle_mousebutton_event(int button, int state, int x, int y)
{
int down = state == KS_PRESSED;
struct nk_context *ctx = &gui_state->context;
if(button == MB_LEFT) nk_input_button(ctx, NK_BUTTON_LEFT, x, y, down);
if(button == MB_MIDDLE) nk_input_button(ctx, NK_BUTTON_MIDDLE, x, y, down);
if(button == MB_RIGHT) nk_input_button(ctx, NK_BUTTON_RIGHT, x, y, down);
if(button == MSB_LEFT) nk_input_button(ctx, NK_BUTTON_LEFT, x, y, down);
if(button == MSB_MIDDLE) nk_input_button(ctx, NK_BUTTON_MIDDLE, x, y, down);
if(button == MSB_RIGHT) nk_input_button(ctx, NK_BUTTON_RIGHT, x, y, down);
}
void gui_handle_mousemotion_event(int x, int y, int xrel, int yrel)

@ -22,11 +22,11 @@ enum Mouse_Mode
enum Mouse_Button
{
MB_LEFT = SDL_BUTTON_LEFT,
MB_MIDDLE = SDL_BUTTON_MIDDLE,
MB_RIGHT = SDL_BUTTON_RIGHT,
MB_X1 = SDL_BUTTON_X1,
MB_X2 = SDL_BUTTON_X2
MSB_LEFT = SDL_BUTTON_LEFT,
MSB_MIDDLE = SDL_BUTTON_MIDDLE,
MSB_RIGHT = SDL_BUTTON_RIGHT,
MSB_X1 = SDL_BUTTON_X1,
MSB_X2 = SDL_BUTTON_X2
};
enum Keyboard_Key

@ -169,9 +169,10 @@ void transform_update_transmat(struct Transform* transform)
}
/* Update all children */
if(array_len(entity->children) > 0)
int children = array_len(entity->children);
if(children > 0)
{
for(int i = 0; i < array_len(entity->children); i++)
for(int i = 0; i < children; i++)
{
struct Entity* child = entity_get(entity->children[i]);
struct Transform* child_tran = entity_component_get(child, C_TRANSFORM);

Loading…
Cancel
Save