sokol: studio impl wip

This commit is contained in:
Vadim Grigoruk
2018-09-27 18:25:14 +03:00
parent 9507749ff1
commit f002911f22
5 changed files with 116 additions and 45 deletions

View File

@@ -22,9 +22,9 @@
#include "file_dialog.h"
#include <SDL.h>
#include <tic80_config.h>
#if defined(__WINDOWS__)
#if defined(__TIC_WINDOWS__)
#include <windows.h>
#include <commdlg.h>
@@ -36,7 +36,7 @@ wchar_t* wcscpy(wchar_t *, const wchar_t *);
void file_dialog_load(file_dialog_load_callback callback, void* data)
{
OPENFILENAMEW ofn;
SDL_zero(ofn);
memset(&ofn, 0, sizeof ofn);
wchar_t filename[MAX_PATH];
memset(filename, 0, sizeof(filename));
@@ -83,7 +83,7 @@ void file_dialog_load(file_dialog_load_callback callback, void* data)
void file_dialog_save(file_dialog_save_callback callback, const char* name, const u8* buffer, size_t size, void* data, u32 mode)
{
OPENFILENAMEW ofn;
SDL_zero(ofn);
memset(&ofn, 0, sizeof ofn);
wchar_t filename[MAX_PATH];
mbstowcs(filename, name, MAX_PATH);
@@ -102,7 +102,7 @@ void file_dialog_save(file_dialog_save_callback callback, const char* name, cons
fwrite(buffer, 1, size, file);
fclose(file);
#if !defined(__WINDOWS__)
#if !defined(__TIC_WINDOWS__)
chmod(filename, mode);
#endif
callback(true, data);
@@ -157,7 +157,7 @@ void file_dialog_save(file_dialog_save_callback callback, const char* name, cons
callback(true, data);
}
#elif defined(__LINUX__)
#elif defined(__TIC_LINUX__)
#include <stdlib.h>
#include <string.h>
@@ -267,7 +267,7 @@ void file_dialog_save(file_dialog_save_callback callback, const char* name, cons
callback(false, data);
}
#elif defined(__MACOSX__)
#elif defined(__TIC_MACOSX__)
#include <string.h>
#include <stdio.h>
@@ -345,7 +345,7 @@ void file_dialog_save(file_dialog_save_callback callback, const char* name, cons
callback(false, data);
}
#elif defined(__ANDROID__)
#elif defined(__TIC_ANDROID__)
#include <jni.h>
#include <sys/stat.h>

22
src/ext/sokol_impl.c Normal file
View File

@@ -0,0 +1,22 @@
#define SOKOL_IMPL
#if defined(WIN32)
#ifndef WM_MOUSEHWHEEL
#define WM_MOUSEHWHEEL 0x020E
#endif
#ifndef AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM
#define AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM 0x80000000
#endif
#ifndef AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY
#define AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY 0x08000000
#endif
#endif
#include "sokol_app.h"
#include "sokol_gfx.h"
#include "sokol_time.h"
#include "sokol_audio.h"

6
src/ext/sokol_impl.m Normal file
View File

@@ -0,0 +1,6 @@
#define SOKOL_IMPL
#include "sokol_app.h"
#include "sokol_gfx.h"
#include "sokol_time.h"
#include "sokol_audio.h"

25
src/system/sokol.c Normal file
View File

@@ -0,0 +1,25 @@
#include "sokol_app.h"
#include "sokol_gfx.h"
#include "sokol_time.h"
#include "sokol_audio.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <tic80.h>
sapp_desc sokol_main(int argc, char* argv[])
{
return (sapp_desc) {0};
// .init_cb = app_init,
// .frame_cb = app_frame,
// .event_cb = app_input,
// .cleanup_cb = app_cleanup,
// .width = 3 * TIC80_FULLWIDTH,
// .height = 3 * TIC80_FULLHEIGHT,
// .window_title = "TIC-80 with Sokol renderer",
// .ios_keyboard_resizes_canvas = true
// };
}