Added file copy and delete to platform api and edited genie.lua to enable compiling with msys2

dev
Shariq Shah 8 years ago
parent 868b160930
commit b8def31393
  1. 26
      build/genie.lua
  2. 2
      src/common/common.h
  3. 6
      src/game/main.c
  4. 6
      src/game/platform.c
  5. 26
      src/libsymmetry/game.c
  6. 6
      src/libsymmetry/input.h

@ -6,16 +6,18 @@ solution "Symmetry"
includedirs {"../include/"} includedirs {"../include/"}
configuration {"linux"} configuration {"linux"}
postbuildcommands {"ln -fs /mnt/Dev/Projects/symmetry/assets debug/"} postbuildcommands {"ln -fs " .. os.getcwd() .. "/../assets debug/assets"}
postbuildcommands {"ln -fs /mnt/Dev/Projects/symmetry/assets release/"} postbuildcommands {"ln -fs " .. os.getcwd() .. "/../assets release/assets"}
buildoptions {"-Wall", "-std=c99"} buildoptions {"-Wall", "-std=c99"}
configuration {"windows", "gmake"}
postbuildcommands {"ln -fs " .. os.getcwd() .. "/../assets debug/assets"}
postbuildcommands {"ln -fs " .. os.getcwd() .. "/../assets release/assets"}
buildoptions {"-Wall", "-std=c99"}
configuration {"windows"}
configuration {"windows", "vs2017 or qbs"}
includedirs {"../third_party/windows/SDL2-2.0.5/include/", "../third_party/windows/OpenAL/include/"} includedirs {"../third_party/windows/SDL2-2.0.5/include/", "../third_party/windows/OpenAL/include/"}
-- postbuildcommands {"mklink /D debug\\assets ..\\..\\..\\assets"}
-- postbuildcommands {"mklink /D release\\assets ..\\..\\..\\assets"}
local sdl_lib_dir = "../third_party/windows/SDL2-2.0.5/lib/x64/" local sdl_lib_dir = "../third_party/windows/SDL2-2.0.5/lib/x64/"
local openal_lib_dir = "../third_party/windows/OpenAL/lib/" local openal_lib_dir = "../third_party/windows/OpenAL/lib/"
@ -23,7 +25,7 @@ solution "Symmetry"
defines {"_CRT_SECURE_NO_WARNINGS"} defines {"_CRT_SECURE_NO_WARNINGS"}
flags {"NoIncrementalLink", "NoEditAndContinue"} flags {"NoIncrementalLink", "NoEditAndContinue"}
configuration "Debug" configuration "Debug"
if (_ACTION ~= nil and _ACTION ~= "postbuild_copy") then if (_ACTION ~= nil and _ACTION ~= "postbuild_copy") then
os.mkdir(_ACTION .. "/debug") os.mkdir(_ACTION .. "/debug")
targetdir (_ACTION .. "/debug") targetdir (_ACTION .. "/debug")
@ -31,7 +33,7 @@ solution "Symmetry"
defines { "DEBUG" } defines { "DEBUG" }
flags { "Symbols" } flags { "Symbols" }
configuration "Release" configuration "Release"
if (_ACTION ~= nil and _ACTION ~= "postbuild_copy") then if (_ACTION ~= nil and _ACTION ~= "postbuild_copy") then
os.mkdir(_ACTION .. "/release") os.mkdir(_ACTION .. "/release")
targetdir (_ACTION .. "/release") targetdir (_ACTION .. "/release")
@ -54,7 +56,12 @@ solution "Symmetry"
linkoptions {"`pkg-config --libs sdl2 openal`"} linkoptions {"`pkg-config --libs sdl2 openal`"}
links {"m"} links {"m"}
configuration "windows" configuration {"windows", "gmake"}
buildoptions {"`pkg-config --cflags-only-I sdl2 openal`"}
linkoptions {"`pkg-config --libs sdl2 openal`"}
links {"m"}
configuration {"windows", "vs2017 or qbs"}
libdirs { sdl_lib_dir, openal_lib_dir } libdirs { sdl_lib_dir, openal_lib_dir }
links {"SDL2", "OpenAL32"} links {"SDL2", "OpenAL32"}
@ -116,5 +123,8 @@ solution "Symmetry"
defines {"GAME_LIB"} defines {"GAME_LIB"}
files { "../src/common/**.c", "../src/common/**.h", "../src/libsymmetry/**.h", "../src/libsymmetry/**.c" } files { "../src/common/**.c", "../src/common/**.h", "../src/libsymmetry/**.h", "../src/libsymmetry/**.c" }
configuration {"windows", "gmake"}
buildoptions {"`pkg-config --cflags-only-I sdl2`"}
configuration "Debug" configuration "Debug"
defines {"GL_DEBUG_CONTEXT", "AL_DEBUG"} defines {"GL_DEBUG_CONTEXT", "AL_DEBUG"}

@ -74,6 +74,8 @@ struct File_Api
{ {
char* (*read)(const int directory_type, const char* path, const char* mode, long* file_size); char* (*read)(const int directory_type, const char* path, const char* mode, long* file_size);
FILE* (*open)(const int directory_type, const char* path, const char* mode); FILE* (*open)(const int directory_type, const char* path, const char* mode);
bool (*copy)(const int directory_type, const char* source, const char* destination);
bool (*delete)(const int directory_type, const char* filename);
}; };
struct Config_Api struct Config_Api

@ -89,8 +89,10 @@ int main(int argc, char** args)
}, },
.file = .file =
{ {
.read = &io_file_read, .read = &io_file_read,
.open = &io_file_open .open = &io_file_open,
.copy = &io_file_copy,
.delete = &io_file_delete
}, },
.config = .config =
{ {

@ -4,11 +4,7 @@
#include "../common/hashmap.h" #include "../common/hashmap.h"
#include "../common/string_utils.h" #include "../common/string_utils.h"
#if defined(_MSC_VER) #include <SDL.h>
#include <SDL.h>
#else
#include <SDL2/SDL.h>
#endif
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>

@ -29,8 +29,10 @@
#include "../common/common.h" #include "../common/common.h"
#define UNUSED(a) (void)a #define UNUSED(a) (void)a
//#define MIN(a,b) ((a) < (b) ? (a) : (b)) #ifndef _MSC_VER
//#define MAX(a,b) ((a) < (b) ? (b) : (a)) #define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MAX(a,b) ((a) < (b) ? (b) : (a))
#endif
#define LEN(a) (sizeof(a)/sizeof(a)[0]) #define LEN(a) (sizeof(a)/sizeof(a)[0])
@ -125,16 +127,16 @@ void scene_setup(void)
vec3 scale = {1, 1, 1}; vec3 scale = {1, 1, 1};
transform_scale(new_ent, &scale); transform_scale(new_ent, &scale);
struct Entity* sound_ent = scene_add_as_child("Sound_ENT", ET_SOUND_SOURCE, new_ent->id); /* struct Entity* sound_ent = scene_add_as_child("Sound_ENT", ET_SOUND_SOURCE, new_ent->id); */
struct Sound_Source* sound_source = &sound_ent->sound_source; /* struct Sound_Source* sound_source = &sound_ent->sound_source; */
platform->sound.source_create(true, 1, &sound_source->source_handle, &sound_source->buffer_handles[0]); /* platform->sound.source_create(true, 1, &sound_source->source_handle, &sound_source->buffer_handles[0]); */
platform->sound.source_load_wav(sound_source->source_handle, /* platform->sound.source_load_wav(sound_source->source_handle, */
sound_source->buffer_handles[0], /* sound_source->buffer_handles[0], */
"BigExplosion.wav"); /* "BigExplosion.wav"); */
//sound_source_relative_set(source, true); /* //sound_source_relative_set(source, true); */
platform->sound.source_volume_set(sound_source->source_handle, 1.f); /* platform->sound.source_volume_set(sound_source->source_handle, 1.f); */
platform->sound.source_loop_set(sound_source->source_handle, true); /* platform->sound.source_loop_set(sound_source->source_handle, true); */
platform->sound.source_play(sound_source->source_handle); /* platform->sound.source_play(sound_source->source_handle); */
int parent_node = new_ent->id; int parent_node = new_ent->id;
int num_suz = 10; int num_suz = 10;

@ -4,11 +4,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "../common/num_types.h" #include "../common/num_types.h"
#if defined(_MSC_VER) #include <SDL.h>
#include <SDL.h>
#else
#include <SDL2/SDL.h>
#endif
struct Key_Combination struct Key_Combination
{ {

Loading…
Cancel
Save