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. 22
      build/genie.lua
  2. 2
      src/common/common.h
  3. 4
      src/game/main.c
  4. 4
      src/game/platform.c
  5. 26
      src/libsymmetry/game.c
  6. 4
      src/libsymmetry/input.h

@ -6,16 +6,18 @@ solution "Symmetry"
includedirs {"../include/"}
configuration {"linux"}
postbuildcommands {"ln -fs /mnt/Dev/Projects/symmetry/assets debug/"}
postbuildcommands {"ln -fs /mnt/Dev/Projects/symmetry/assets release/"}
postbuildcommands {"ln -fs " .. os.getcwd() .. "/../assets debug/assets"}
postbuildcommands {"ln -fs " .. os.getcwd() .. "/../assets release/assets"}
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/"}
-- 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 openal_lib_dir = "../third_party/windows/OpenAL/lib/"
@ -54,7 +56,12 @@ solution "Symmetry"
linkoptions {"`pkg-config --libs sdl2 openal`"}
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 }
links {"SDL2", "OpenAL32"}
@ -116,5 +123,8 @@ solution "Symmetry"
defines {"GAME_LIB"}
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"
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);
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

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

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

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

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

Loading…
Cancel
Save