main
Dominik Madarász 2023-11-05 16:30:11 +01:00
parent 7c84c3b7a4
commit 97973d344f
139 changed files with 18125 additions and 5083 deletions

View File

@ -410,6 +410,51 @@ if "%1"=="back" (
exit /b
)
if "%1"=="fwk_mir" (
rd/q/s _fwk
rd/q/s ..\_fwk
mkdir ..\_fwk
setlocal enabledelayedexpansion
xcopy /y/E "*" "..\_fwk"
move "..\_fwk" _fwk
for %%f in ("engine\split\v4k*") do (
set "filename=%%~nf"
set "newname=fwk!filename:v4k=!%%~xf"
echo Copying and renaming "%%f" to "_fwk\engine\split\!newname!"
copy "%%f" "_fwk\engine\split\!newname!"
)
for %%f in (_fwk\engine\split\*) do (
set "filename=%%~nxf"
if /i not "!filename:~0,4!"=="3rd_" (
echo Processing: %%f
tools\fwkren.exe %%f from
) else (
echo Skipping %%f
)
)
for %%f in (_fwk\demos\*.c) do (
set "filename=%%~nxf"
echo Processing: %%f
tools\fwkren.exe %%f from
)
for %%f in (_fwk\tools\*) do (
set "filename=%%~nxf"
echo Processing: %%f
tools\fwkren.exe %%f from
)
for %%f in (_fwk\tools\editor\*.c) do (
set "filename=%%~nxf"
echo Processing: %%f
tools\fwkren.exe %%f from
)
tools\fwkren.exe _fwk\tools\cook.ini from
echo All done.
endlocal
exit /b
)
rem copy demos to root folder. local changes are preserved
rem echo n | copy /-y demos\*.c 1> nul 2> nul
@ -757,10 +802,10 @@ if "!v4k!"=="yes" (
rem editor
if "!editor!"=="yes" (
set edit=-DCOOK_ON_DEMAND -DUI_LESSER_SPACING -DUI_ICONS_SMALL
if "!vis!"=="yes" echo !cc! !o! editor.exe tools\editor\editor.c !edit! !import! !args!
!echo! editor && !cc! !o! editor.exe tools\editor\editor.c !edit! !import! !args! || set rc=1
set edit=-DCOOK_ON_DEMAND
!echo! editor3 && !cc! !o! editor3.exe tools\editor\editor3.c !edit! -Iengine/joint !args! || set rc=1
set edit=-DUI_LESSER_SPACING -DUI_ICONS_SMALL !edit!
!echo! editor && !cc! !o! editor.exe tools\editor\editor.c !edit! !import! !args! || set rc=1
rem if "!cc!"=="cl" (
rem set plug_export=/LD

View File

@ -1130,6 +1130,7 @@ ffi.cdef([[
//lcpp INF [0000] vec3: macro name but used as C declaration in: int gizmo(vec3 *pos, vec3 *rot, vec3 *sca);
//lcpp INF [0000] vec3: macro name but used as C declaration in: int gizmo(vec3 *pos, vec3 *rot, vec3 *sca);
//lcpp INF [0000] vec3: macro name but used as C declaration in: int gizmo(vec3 *pos, vec3 *rot, vec3 *sca);
//lcpp INF [0000] map: macro name but used as C declaration in:typedef struct { map base; struct { pair p; char* key; char* val; } tmp, *ptr; char** tmpval; int (*typed_cmp)(char*, char*); uint64_t (*typed_hash)(char*); } * ini_t;
//lcpp INF [0000] vec2: macro name but used as C declaration in:API vec2 font_xy();
//lcpp INF [0000] vec2: macro name but used as C declaration in:STATIC vec2 font_xy();
//lcpp INF [0000] vec2: macro name but used as C declaration in: vec2 font_xy();
@ -1142,7 +1143,6 @@ ffi.cdef([[
//lcpp INF [0000] vec2: macro name but used as C declaration in:API vec2 font_highlight(const char *text, const void *colors);
//lcpp INF [0000] vec2: macro name but used as C declaration in:STATIC vec2 font_highlight(const char *text, const void *colors);
//lcpp INF [0000] vec2: macro name but used as C declaration in: vec2 font_highlight(const char *text, const void *colors);
//lcpp INF [0000] map: macro name but used as C declaration in:typedef struct { map base; struct { pair p; char* key; char* val; } tmp, *ptr; char** tmpval; int (*typed_cmp)(char*, char*); uint64_t (*typed_hash)(char*); } * ini_t;
//lcpp INF [0000] vec2: macro name but used as C declaration in:API vec2 input2( int vk );
//lcpp INF [0000] vec2: macro name but used as C declaration in:STATIC vec2 input2( int vk );
//lcpp INF [0000] vec2: macro name but used as C declaration in: vec2 input2( int vk );
@ -1508,6 +1508,9 @@ ffi.cdef([[
//lcpp INF [0000] vec3: macro name but used as C declaration in:STATIC void light_dir(light_t* l, vec3 dir);
//lcpp INF [0000] vec3: macro name but used as C declaration in: void light_dir(light_t* l, vec3 dir);
//lcpp INF [0000] vec2i: macro name but used as C declaration in:vec2i* entries;
//lcpp INF [0000] test: macro name but used as C declaration in:API int (test)(const char *file, int line, const char *expr, bool result);
//lcpp INF [0000] test: macro name but used as C declaration in:STATIC int (test)(const char *file, int line, const char *expr, bool result);
//lcpp INF [0000] test: macro name but used as C declaration in: int (test)(const char *file, int line, const char *expr, bool result);
//lcpp INF [0000] vec3i: macro name but used as C declaration in:typedef vec3i guid;
//lcpp INF [0000] vec3: macro name but used as C declaration in:vec3 v;
//lcpp INF [0000] vec3: macro name but used as C declaration in:vec3 result;
@ -1522,9 +1525,6 @@ ffi.cdef([[
//lcpp INF [0000] vec3: macro name but used as C declaration in:API vec3 curve_eval(curve_t *c, float dt, unsigned *color);
//lcpp INF [0000] vec3: macro name but used as C declaration in:STATIC vec3 curve_eval(curve_t *c, float dt, unsigned *color);
//lcpp INF [0000] vec3: macro name but used as C declaration in: vec3 curve_eval(curve_t *c, float dt, unsigned *color);
//lcpp INF [0000] test: macro name but used as C declaration in:API int (test)(const char *file, int line, const char *expr, bool result);
//lcpp INF [0000] test: macro name but used as C declaration in:STATIC int (test)(const char *file, int line, const char *expr, bool result);
//lcpp INF [0000] test: macro name but used as C declaration in: int (test)(const char *file, int line, const char *expr, bool result);
//lcpp INF [0000] vec2: macro name but used as C declaration in:API vec2 ui_get_dims();
//lcpp INF [0000] vec2: macro name but used as C declaration in:STATIC vec2 ui_get_dims();
//lcpp INF [0000] vec2: macro name but used as C declaration in: vec2 ui_get_dims();
@ -2117,6 +2117,11 @@ typedef union json_t { char* s; double f; int64_t i; uintptr_t p; union json_t*
void script_bind_function(const char *c_name, void *c_function);
void script_call(const char *lua_function);
bool script_tests();
enum {
SCRIPT_LUA = 1,
SCRIPT_DEBUGGER = 2,
};
void *script_init_env(unsigned flags);
vec3 editor_pick(float mouse_x, float mouse_y);
char* editor_path(const char *path);
float* engine_getf(const char *key);
@ -2139,38 +2144,6 @@ typedef union json_t { char* s; double f; int64_t i; uintptr_t p; union json_t*
char* kit_translate2( const char *id, const char *langcode_iso639_1 );
void kit_locale( const char *langcode_iso639_1 );
char* kit_translate( const char *id );
enum FONT_FLAGS {
FONT_512 =0,
FONT_1024 =1,
FONT_2048 =2,
FONT_4096 =4,
FONT_NO_OVERSAMPLE =0,
FONT_OVERSAMPLE_X =8,
FONT_OVERSAMPLE_Y =16,
FONT_ASCII =2048,
FONT_AR =4096,
FONT_ZH =8192,
FONT_EL =16384,
FONT_EM =32768,
FONT_EU =65536,
FONT_HE =131072,
FONT_JP =262144,
FONT_KR =524288,
FONT_RU =1048576,
FONT_TH =2097152,
FONT_VI =4194304,
FONT_CJK = FONT_ZH|FONT_JP|FONT_KR,
};
void font_face(const char *face_tag, const char *filename_ttf, float font_size, unsigned flags);
void font_face_from_mem(const char *tag, const void *ttf_buffer, unsigned ttf_len, float font_size, unsigned flags);
void font_scales(const char *face_tag, float h1, float h2, float h3, float h4, float h5, float h6);
void font_color(const char *color_tag, uint32_t color);
vec2 font_xy();
void font_goto(float x, float y);
vec2 font_print(const char *text);
vec2 font_rect(const char *text);
void* font_colorize(const char *text, const char *comma_types, const char *comma_keywords);
vec2 font_highlight(const char *text, const void *colors);
char** file_list( const char *pathmasks );
bool file_write( const char *file, const void *ptr, int len );
bool file_append( const char *file, const void *ptr, int len );
@ -2218,6 +2191,38 @@ typedef struct { map base; struct { pair p; char* key; char* val; } tmp, *ptr; c
ini_t ini_from_mem(const char *data);
void ini_destroy(ini_t);
bool ini_write(const char *filename, const char *section, const char *key, const char *value);
enum FONT_FLAGS {
FONT_512 =0,
FONT_1024 =1,
FONT_2048 =2,
FONT_4096 =4,
FONT_NO_OVERSAMPLE =0,
FONT_OVERSAMPLE_X =8,
FONT_OVERSAMPLE_Y =16,
FONT_ASCII =2048,
FONT_AR =4096,
FONT_ZH =8192,
FONT_EL =16384,
FONT_EM =32768,
FONT_EU =65536,
FONT_HE =131072,
FONT_JP =262144,
FONT_KR =524288,
FONT_RU =1048576,
FONT_TH =2097152,
FONT_VI =4194304,
FONT_CJK = FONT_ZH|FONT_JP|FONT_KR,
};
void font_face(const char *face_tag, const char *filename_ttf, float font_size, unsigned flags);
void font_face_from_mem(const char *tag, const void *ttf_buffer, unsigned ttf_len, float font_size, unsigned flags);
void font_scales(const char *face_tag, float h1, float h2, float h3, float h4, float h5, float h6);
void font_color(const char *color_tag, uint32_t color);
vec2 font_xy();
void font_goto(float x, float y);
vec2 font_print(const char *text);
vec2 font_rect(const char *text);
void* font_colorize(const char *text, const char *comma_types, const char *comma_keywords);
vec2 font_highlight(const char *text, const void *colors);
int input_use( int controller_id );
float input( int vk );
vec2 input2( int vk );
@ -2605,6 +2610,7 @@ TEXTURE_RGBA = IMAGE_RGBA,
TEXTURE_FLIP = IMAGE_FLIP,
TEXTURE_SRGB = 1 << 24,
TEXTURE_BGR = 1 << 25,
TEXTURE_BGRA = TEXTURE_BGR,
TEXTURE_ARRAY = 1 << 26,
};
typedef struct texture_t {
@ -3128,6 +3134,51 @@ vec2i* entries;
} quarks_db;
unsigned quark_intern( quarks_db*, const char *string );
const char *quark_string( quarks_db*, unsigned key );
void* thread( int (*thread_func)(void* user_data), void* user_data );
void thread_destroy( void *thd );
int argc();
char* argv(int);
int flag(const char *commalist);
const char* option(const char *commalist, const char *defaults);
int optioni(const char *commalist, int defaults);
float optionf(const char *commalist, float defaults);
void tty_attach();
void tty_detach();
void tty_color(unsigned color);
void tty_reset();
const char* app_exec(const char *command);
int app_spawn(const char *command);
int app_cores();
int app_battery();
const char* app_name();
const char* app_path();
const char* app_cache();
const char* app_temp();
const char* app_cmdline();
void app_beep();
void app_hang();
void app_crash();
void app_singleton(const char *guid);
bool app_open(const char *folder_file_or_url);
const char* app_loadfile();
const char* app_savefile();
char* callstack( int traces );
int callstackf( FILE *fp, int traces );
void die(const char *message);
void alert(const char *message);
void hexdump( const void *ptr, unsigned len );
void hexdumpf( FILE *fp, const void *ptr, unsigned len, int width );
void breakpoint();
bool has_debugger();
void trap_install(void);
const char *trap_name(int signal);
void trap_on_ignore(int signal);
void trap_on_quit(int signal);
void trap_on_abort(int signal);
void trap_on_debug(int signal);
int (PANIC)(const char *error, const char *file, int line);
int (PRINTF)(const char *text, const char *stack, const char *file, int line, const char *function);
int (test)(const char *file, int line, const char *expr, bool result);
uint64_t date();
uint64_t date_epoch();
char* date_string();
@ -3229,54 +3280,9 @@ int* indices;
} curve_t;
curve_t curve();
void curve_add(curve_t *c, vec3 p);
void curve_finish(curve_t *c, int num_points);
void curve_end(curve_t *c, int num_points);
vec3 curve_eval(curve_t *c, float dt, unsigned *color);
void curve_destroy(curve_t *c);
void* thread( int (*thread_func)(void* user_data), void* user_data );
void thread_destroy( void *thd );
int argc();
char* argv(int);
int flag(const char *commalist);
const char* option(const char *commalist, const char *defaults);
int optioni(const char *commalist, int defaults);
float optionf(const char *commalist, float defaults);
void tty_attach();
void tty_detach();
void tty_color(unsigned color);
void tty_reset();
const char* app_exec(const char *command);
int app_spawn(const char *command);
int app_cores();
int app_battery();
const char* app_name();
const char* app_path();
const char* app_cache();
const char* app_temp();
const char* app_cmdline();
void app_beep();
void app_hang();
void app_crash();
void app_singleton(const char *guid);
bool app_open(const char *folder_file_or_url);
const char* app_loadfile();
const char* app_savefile();
char* callstack( int traces );
int callstackf( FILE *fp, int traces );
void die(const char *message);
void alert(const char *message);
void hexdump( const void *ptr, unsigned len );
void hexdumpf( FILE *fp, const void *ptr, unsigned len, int width );
void breakpoint();
bool has_debugger();
void trap_install(void);
const char *trap_name(int signal);
void trap_on_ignore(int signal);
void trap_on_quit(int signal);
void trap_on_abort(int signal);
void trap_on_debug(int signal);
int (PANIC)(const char *error, const char *file, int line);
int (PRINTF)(const char *text, const char *stack, const char *file, int line, const char *function);
int (test)(const char *file, int line, const char *expr, bool result);
enum PANEL_FLAGS {
PANEL_OPEN = 1,
};
@ -3438,13 +3444,15 @@ enum CURSOR_SHAPES {
CURSOR_NONE,
CURSOR_HW_ARROW,
CURSOR_HW_IBEAM,
CURSOR_HW_CROSS,
CURSOR_HW_HAND,
CURSOR_HW_HDRAG,
CURSOR_HW_VDRAG,
CURSOR_HW_HAND,
CURSOR_HW_CROSS,
CURSOR_SW_AUTO,
};
void window_cursor_shape(unsigned shape);
const char *window_clipboard();
void window_setclipboard(const char *text);
]])
local _M = {}
function _M.vec2(x,y)

View File

@ -17,5 +17,8 @@ void main() {
}
}
FRAGCOLOR = vec4(border_color.rgb, outline * border_color.a); // mix(texel, border_color, outline * border_color.a);
}
if( outline == 0.0 )
discard;
FRAGCOLOR = vec4(border_color.rgb, outline * border_color.a);
}

File diff suppressed because it is too large Load Diff

View File

@ -1491,8 +1491,12 @@ struct dir {
// ---
#if !defined(S_ISDIR)
# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#ifndef S_ISDIR
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#endif
#ifndef S_ISREG
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
#endif
int dir_yield(dir *d, const char *pathfile, char *name, int namelen) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -25275,6 +25275,7 @@ nk_selectable_text(struct nk_context *ctx, const char *str, int len,
state = nk_widget(&bounds, ctx);
if (!state) return 0;
in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
return nk_do_selectable(&ctx->last_widget_state, &win->buffer, bounds,
str, len, align, value, &style->selectable, in, style->font);
}

View File

@ -0,0 +1,400 @@
// file browser for nuklear, based on https://github.com/vurtun/nuklear/blob/master/example/file_browser.c (public domain)
// - rlyeh, public domain
//
// changelog:
// - ported to FWK api
// - namespaced symbols
// - diverse win32 fixes
// - adaptive cols/rows
// - removed nk_begin()/nk_end() pairs
// - dangling nk_group_begin/end() pairs
// - simplified file<->media_group concept
// - minor cosmetics
#ifdef _WIN32
#include <direct.h> // _getcwd()
#else
#include <unistd.h> // getcwd()
#include <pwd.h> // getpwuid()
#endif
#if 1
#define BROWSER_PRINTF(...) do {} while(0)
#else
#define BROWSER_PRINTF printf
#endif
enum browser_groups {
BROWSER_FOLDER,
BROWSER_HOME,
BROWSER_DESKTOP,
BROWSER_COMPUTER,
BROWSER_PROJECT,
BROWSER_MAXFOLDERS,
BROWSER_MAXTYPES = 64,
};
struct browser_media_group {
unsigned icon;
const char *extensions;
};
struct browser_media {
int font;
int icon_sheet;
struct nk_image custom_folders[BROWSER_MAXFOLDERS];
struct nk_image custom_files[BROWSER_MAXTYPES];
struct browser_media_group group[BROWSER_MAXTYPES];
} media = {0};
void browser_config_dir(struct nk_image icon, unsigned counter) {
if( counter < BROWSER_MAXFOLDERS ) {
media.custom_folders[ counter ] = icon;
}
}
void browser_config_type(struct nk_image icon, const char *extensions) {
static int counter = 0;
if( counter < BROWSER_MAXTYPES ) {
media.custom_files[ counter ] = icon;
media.group[ counter ].icon = counter;
media.group[ counter ].extensions = extensions;
++counter;
}
}
#define BROWSER_MAX_PATH 512
struct browser {
/* path */
char file[BROWSER_MAX_PATH]; // selection
char directory[BROWSER_MAX_PATH]; // current cwd while browsing
char home[BROWSER_MAX_PATH];
char desktop[BROWSER_MAX_PATH];
char computer[BROWSER_MAX_PATH];
char project[BROWSER_MAX_PATH]; // cwd when first invoked
/* directory content */
array(char*) files;
array(char*) directories;
size_t file_count;
size_t dir_count;
/* view mode */
bool listing;
float zooming;
};
static struct nk_image* media_icon_for_file(const char *file) {
/* extract extension .xxx from file */
char *ext = strrchr(file, '.');
if( ext && strlen(ext) < 16 ) {
char ext_dot[16+1];
snprintf(ext_dot, 16, "%s.", ext);
/* check for all file definition of all groups for fitting extension. skip first group (default) */
for (int i = 1; i < BROWSER_MAXTYPES && media.group[i].extensions; ++i) {
if( strstri(media.group[i].extensions, ext_dot) ) {
return &media.custom_files[ media.group[i].icon ];
}
}
}
// return first (default) group
return &media.custom_files[0];
}
static void browser_reload_directory_content(struct browser *browser, const char *path) {
if(path[0] == '\0') path = va("./");
if(!strend(path, "/")) path = va("%s/", path);
for(int i = 0; i < array_count(browser->files); ++i) FREE(browser->files[i]);
for(int i = 0; i < array_count(browser->directories); ++i) FREE(browser->directories[i]);
array_resize(browser->files, 0);
array_resize(browser->directories, 0);
BROWSER_PRINTF("searching at %s\n", path);
const char **list = file_list(path, "*");
for( int i = 0; list[i]; ++i ) {
char *absolute = file_pathabs(ifndef(win32, list[i], va("%s/%s", path, list[i]))); // ../dir/./file.ext -> c:/prj/dir/file.ext
BROWSER_PRINTF("%s->%s %d->", list[i], absolute, file_directory(absolute) );
if( file_directory(absolute) ) {
// remove last '/' if present. ok to overwrite absolute var, file_*() API returns writeable strings.
char *dir = absolute; if( dir[ strlen(dir) - 1 ] == '/' ) dir[ strlen(dir) - 1 ] = '\0';
dir = file_name(dir); // /home/rlyeh/prj/fwk/art -> art
BROWSER_PRINTF("%s\n", dir);
if( dir[0] != '.' ) // skip special files, folders and internal files like .git or .art.zip
array_push(browser->directories, STRDUP(dir));
} else {
const char *fname = file_name(absolute);
BROWSER_PRINTF("%s\n", fname);
if( fname[0] != '.' ) // skip special files, folders and internal files like .git or .art.zip
array_push(browser->files, STRDUP(fname));
}
}
browser->file_count = array_count(browser->files);
browser->dir_count = array_count(browser->directories);
}
static void browser_chdir_and_reload_directory_content(struct browser *browser, const char *path) {
if( path != browser->directory ) strncpy(browser->directory, path, BROWSER_MAX_PATH);
browser_reload_directory_content(browser, path);
}
static void browser_init(struct browser *browser) {
memset(browser, 0, sizeof(*browser));
{
/* load files and sub-directory list */
const char *home = getenv("HOME");
#ifdef _WIN32
if (!home) home = getenv("USERPROFILE");
#else
if (!home) home = getpwuid(getuid())->pw_dir;
#endif
snprintf(browser->home, BROWSER_MAX_PATH, "%s/", home);
snprintf(browser->desktop, BROWSER_MAX_PATH, "%s/Desktop/", home);
snprintf(browser->computer, BROWSER_MAX_PATH, "%s", ifdef(win32, va("%.*s", 3, getenv("windir")), "/"));
{
ifdef(win32, _getcwd, getcwd)(browser->project, sizeof(browser->project) - 1); // -1 == room for '/'
strcat(browser->project, "/");
}
BROWSER_PRINTF("%s\n", browser->home);
BROWSER_PRINTF("%s\n", browser->desktop);
BROWSER_PRINTF("%s\n", browser->computer);
BROWSER_PRINTF("%s\n", browser->project);
browser_chdir_and_reload_directory_content(browser, browser->project);
}
}
static void browser_free(struct browser *browser) {
for(int i = 0; i < array_count(browser->files); ++i) FREE(browser->files[i]);
for(int i = 0; i < array_count(browser->directories); ++i) FREE(browser->directories[i]);
array_free(browser->files);
array_free(browser->directories);
memset(browser, 0, sizeof(*browser));
}
static int browser_run(struct nk_context *ctx, struct browser *browser, int windowed, struct nk_rect total_space) {
int clicked = 0;
static float ratio[] = {0.25f, NK_UNDEFINED};
float spacing_x = ctx->style.window.spacing.x;
/* output path directory selector in the menubar */
ctx->style.window.spacing.x = 0;
if( windowed ) nk_menubar_begin(ctx);
{
char *d = browser->directory;
#ifdef _WIN32
char *begin = d;
#else
char *begin = d + 1;
#endif
nk_layout_row_template_begin(ctx, 25);
nk_layout_row_template_push_variable(ctx, 40);
nk_layout_row_template_push_variable(ctx, 40);
nk_layout_row_template_push_variable(ctx, 40);
nk_layout_row_template_end(ctx);
if (nk_button_label(ctx, !browser->listing ? ICON_MD_LIST : ICON_MD_GRID_VIEW)) {
browser->listing ^= 1;
}
while (*d++) {
if (*d == '/') {
*d = '\0';
if (nk_button_label(ctx, va("%s" ICON_MD_ARROW_RIGHT, file_name(begin)))) {
*d++ = '/'; *d = '\0';
browser_chdir_and_reload_directory_content(browser, browser->directory);
break;
}
*d = '/';
begin = d + 1;
}
}
}
if( windowed ) nk_menubar_end(ctx);
ctx->style.window.spacing.x = spacing_x;
if(nk_window_has_focus(ctx))
browser->zooming = clampf( browser->zooming + input_diff(MOUSE_W) * 0.1, 1, 3);
bool compact = 0, tiny = browser->listing; // compact, no left panel. tiny, no large icons
size_t cols = total_space.w / (100 * browser->zooming);
int icon_height = (67 * browser->zooming) * (tiny ? 0.33 : 1.); // icon height (96) + button padding (??). originally: 135
/**/ if( tiny ) cols = (int)cols+1.5, cols /= 2, compact = total_space.w < 500; // cols <= 2;
else cols = (int)cols+1, compact = total_space.w < 500; // cols <= 5;
if( cols < 1 ) cols=1;
/* window layout */
nk_layout_row(ctx, NK_DYNAMIC, total_space.h, compact ? 1 : 2, compact ? ratio+1 : ratio);
if( !compact )
if( nk_group_begin(ctx, "Special", NK_WINDOW_NO_SCROLLBAR) ) {
nk_layout_row_dynamic(ctx, 40, 1);
if (nk_button_image_label(ctx,media.custom_folders[BROWSER_HOME],"Home",NK_TEXT_RIGHT))
browser_chdir_and_reload_directory_content(browser, browser->home);
if (nk_button_image_label(ctx,media.custom_folders[BROWSER_DESKTOP],"Desktop",NK_TEXT_RIGHT))
browser_chdir_and_reload_directory_content(browser, browser->desktop);
if (nk_button_image_label(ctx,media.custom_folders[BROWSER_COMPUTER],"Computer",NK_TEXT_RIGHT))
browser_chdir_and_reload_directory_content(browser, browser->computer);
if (nk_button_image_label(ctx,media.custom_folders[BROWSER_PROJECT],"Project",NK_TEXT_RIGHT))
browser_chdir_and_reload_directory_content(browser, browser->project);
nk_group_end(ctx);
}
/* output directory content window */
if(nk_group_begin(ctx, "Content", windowed ? NK_WINDOW_NO_SCROLLBAR : 0)) {
int index = -1;
size_t i = 0, j = 0, k = 0;
size_t rows = 0;
size_t count = browser->dir_count + browser->file_count;
rows = count / cols;
for (i = 0; i <= rows; i += 1) {
if(!tiny)
{size_t n = j + cols;
nk_layout_row_dynamic(ctx, icon_height, (int)cols);
for (; j < count && j < n; ++j) {
/* draw one row of icons */
if (j < browser->dir_count) {
/* draw and execute directory buttons */
if (nk_button_image(ctx,media.custom_folders[BROWSER_FOLDER]))
index = (int)j;
} else {
/* draw and execute files buttons */
struct nk_image *icon;
size_t fileIndex = ((size_t)j - browser->dir_count);
icon = media_icon_for_file(browser->files[fileIndex]);
if (nk_button_image(ctx, *icon)) {
snprintf(browser->file, BROWSER_MAX_PATH, "%s%s", browser->directory, browser->files[fileIndex]);
clicked = 1;
}
}
}}
if(!tiny)
{size_t n = k + cols;
nk_layout_row_dynamic(ctx, 20, (int)cols);
for (; k < count && k < n; k++) {
/* draw one row of labels */
if (k < browser->dir_count) {
nk_label(ctx, browser->directories[k], NK_TEXT_CENTERED);
} else {
size_t t = k-browser->dir_count;
nk_label(ctx,browser->files[t],NK_TEXT_CENTERED);
}
}}
if(tiny)
{size_t n = j + cols;
nk_layout_row_dynamic(ctx, icon_height, (int)cols);
for (; j < count && j < n; ++j) {
/* draw one row of icons */
if (j < browser->dir_count) {
/* draw and execute directory buttons */
if (nk_button_image_label(ctx,media.custom_folders[BROWSER_FOLDER], browser->directories[j],NK_TEXT_RIGHT))
index = (int)j;
} else {
/* draw and execute files buttons */
struct nk_image *icon;
size_t fileIndex = ((size_t)j - browser->dir_count);
icon = media_icon_for_file(browser->files[fileIndex]);
size_t t = j-browser->dir_count;
if (nk_button_image_label(ctx, *icon, browser->files[t],NK_TEXT_RIGHT)) {
snprintf(browser->file, BROWSER_MAX_PATH, "%s%s", browser->directory, browser->files[fileIndex]);
clicked = 1;
}
}
#if 0
bool has_focus = nk_window_has_focus(ctx); // @fixme: move out of loop
bool has_popups = ui_popups(); // @fixme: move out of loop
if( !has_popups && has_focus ) {
struct nk_rect bounds = nk_widget_bounds(ctx);
if (nk_input_is_mouse_hovering_rect(&ctx->input, bounds) ) {
char *name = j < browser->dir_count ? browser->directories[j] : browser->files[j-browser->dir_count];
char fullpath[PATH_MAX];
snprintf(fullpath, PATH_MAX, "%s%s", browser->directory, name);
struct stat t = {0};
if( stat( fullpath, &t ) != -1 ) {
char tooltip[256];
snprintf(tooltip, 256,
"Path: %s\n"
"Type: %lld\n" // file type and mode
"Size: %lld\n" // file size
"Owner: %lld\n" // user ID of file owner
"Modified: %s (%lld)", // last modification date
name, (int64_t)t.st_mode, (int64_t)t.st_size, (int64_t)t.st_uid, ctime(&t.st_mtime), (int64_t)t.st_mtime
);
nk_tooltip(ctx, tooltip);
}
}
}
#endif
}}
}
if (index != -1) {
BROWSER_PRINTF("%s + %s = ", browser->directory, browser->directories[index]);
size_t n = strlen(browser->directory);
snprintf(browser->directory + n, BROWSER_MAX_PATH - n, "%s/", browser->directories[index]);
BROWSER_PRINTF("%s\n", browser->directory);
browser_chdir_and_reload_directory_content(browser, browser->directory);
}
nk_group_end(ctx);
}
return clicked;
}
static struct nk_image icon_load(const char *filename) {
texture_t t = texture(filename, 0);
return nk_image_id((int)t.id);
}
static struct nk_image icon_load_rect(unsigned id, unsigned w, unsigned h, unsigned wcell, unsigned hcell, unsigned col, unsigned row) {
return nk_subimage_id((int)id, w, h, (struct nk_rect){ wcell * col, hcell * row, wcell, hcell });
}
/* demo:
struct browser browser = {0};
browser_init(&browser);
browser_config_dir(nk_image, BROWSER_HOME);
browser_config_dir(nk_image, BROWSER_PROJECT);
// [...]
browser_config_type(nk_image, ".ext1.ext2.ext3.");
browser_config_type(nk_image, ".ext1.ext2.ext3.");
browser_config_type(nk_image, ".ext1.ext2.ext3.");
// [...]
[...]
if( nk_begin(ctx, "window", ...) ) {
struct nk_rect total_space = nk_window_get_content_region(ctx);
if( browser_run(ctx, &browser, 0, total_space) ) {
puts( browser->directory );
puts( browser->file );
}
}
nk_end();
*/

View File

@ -1328,7 +1328,7 @@ STBI_EXTERN __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int
#if defined(_WIN32) && defined(STBI_WINDOWS_UTF8)
STBIDEF int stbi_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input)
{
return WideCharToMultiByte(65001 /* UTF8 */, 0, input, -1, buffer, (int) bufferlen, NULL, NULL);
return WideCharToMultiByte(65001 /* UTF8 */, 0, input, -1, buffer, (int) bufferlen, NULL, NULL);
}
#endif
@ -1345,8 +1345,8 @@ static FILE *stbi__fopen(char const *filename, char const *mode)
return 0;
#if defined(_MSC_VER) && _MSC_VER >= 1400
if (0 != _wfopen_s(&f, wFilename, wMode))
f = 0;
if (0 != _wfopen_s(&f, wFilename, wMode))
f = 0;
#else
f = _wfopen(wFilename, wMode);
#endif
@ -3436,8 +3436,8 @@ static int stbi__decode_jpeg_image(stbi__jpeg *j)
m = stbi__get_marker(j);
} else {
if (!stbi__process_marker(j, m)) return 1;
m = stbi__get_marker(j);
}
m = stbi__get_marker(j);
}
}
if (j->progressive)
stbi__jpeg_finish(j);
@ -5330,7 +5330,7 @@ static int stbi__png_is16(stbi__context *s)
stbi__png p;
p.s = s;
if (!stbi__png_info_raw(&p, NULL, NULL, NULL))
return 0;
return 0;
if (p.depth != 16) {
stbi__rewind(p.s);
return 0;
@ -5574,7 +5574,7 @@ static void *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req
// negative, and guarantees that info.offset >= bytes_read_so_far > 0. this in turn
// ensures the number computed in the second half of the test can't overflow.
if (info.offset < bytes_read_so_far || info.offset - bytes_read_so_far > extra_data_limit) {
return stbi__errpuc("bad offset", "Corrupt BMP");
return stbi__errpuc("bad offset", "Corrupt BMP");
} else {
stbi__skip(s, info.offset - bytes_read_so_far);
}
@ -7339,7 +7339,7 @@ static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp)
info.all_a = 255;
p = stbi__bmp_parse_header(s, &info);
if (p == NULL) {
stbi__rewind( s );
stbi__rewind( s );
return 0;
}
if (x) *x = s->img_x;
@ -7532,7 +7532,7 @@ static void *stbi__pnm_load(stbi__context *s, int *x, int *y, int *comp, int req
if (ri->bits_per_channel == 16) {
out = (stbi_uc *) stbi__convert_format16((stbi__uint16 *) out, s->img_n, req_comp, s->img_x, s->img_y);
} else {
out = stbi__convert_format(out, s->img_n, req_comp, s->img_x, s->img_y);
out = stbi__convert_format(out, s->img_n, req_comp, s->img_x, s->img_y);
}
if (out == NULL) return out; // stbi__convert_format frees input on failure
}

View File

@ -493,11 +493,11 @@ static int stbi_write_bmp_core(stbi__write_context *s, int x, int y, int comp, c
{
if (comp != 4) {
// write RGB bitmap
int pad = (-x*3) & 3;
return stbiw__outfile(s,-1,-1,x,y,comp,1,(void *) data,0,pad,
"11 4 22 4" "4 44 22 444444",
'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header
40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header
int pad = (-x*3) & 3;
return stbiw__outfile(s,-1,-1,x,y,comp,1,(void *) data,0,pad,
"11 4 22 4" "4 44 22 444444",
'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header
40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header
} else {
// RGBA bitmaps need a v4 header
// use BI_BITFIELDS mode with 32bpp and alpha mask

View File

@ -2594,14 +2594,14 @@ static void imdct_step3_inner_s_loop_ld654(int n, float *e, int i_off, float *A,
float k00,k11;
float l00,l11;
k00 = z[-0] - z[-8];
k11 = z[-1] - z[-9];
k00 = z[-0] - z[ -8];
k11 = z[-1] - z[ -9];
l00 = z[-2] - z[-10];
l11 = z[-3] - z[-11];
z[-0] = z[-0] + z[-8];
z[-1] = z[-1] + z[-9];
z[ -2] = z[ -2] + z[-10];
z[ -3] = z[ -3] + z[-11];
z[ -0] = z[-0] + z[ -8];
z[ -1] = z[-1] + z[ -9];
z[ -2] = z[-2] + z[-10];
z[ -3] = z[-3] + z[-11];
z[ -8] = k00;
z[ -9] = k11;
z[-10] = (l00+l11) * A2;
@ -3661,7 +3661,7 @@ static int start_decoder(vorb *f)
f->comment_list = NULL;
if (f->comment_list_length > 0)
{
f->comment_list = (char**)setup_malloc(f, sizeof(char*) * (f->comment_list_length));
f->comment_list = (char**) setup_malloc(f, sizeof(char*) * (f->comment_list_length));
if (f->comment_list == NULL) return error(f, VORBIS_outofmem);
}

View File

@ -98,18 +98,6 @@
#include "v4k"
#endif
#define do_threadlock(mutexptr) \
for( int init_ = !!(mutexptr) || (thread_mutex_init( (mutexptr) = CALLOC(1, sizeof(thread_mutex_t)) ), 1); init_; init_ = 0) \
for( int lock_ = (thread_mutex_lock( mutexptr ), 1); lock_; lock_ = (thread_mutex_unlock( mutexptr ), 0) )
API void *ui_handle();
#define ui_push_hspace(px) \
(int xx = px; xx; xx = 0) \
for(struct nk_context *ctx = (struct nk_context*)ui_handle(); ctx; ctx = 0 ) \
for(struct nk_panel *layout = ui_ctx->current->layout; layout; ) \
for( xx = (layout->at_x += px, layout->bounds.w -= px, 0); layout; layout->at_x -= px, layout->bounds.w += px, layout = 0 )
//-----------------------------------------------------------------------------
// C files
@ -160,10 +148,10 @@ API void *ui_handle();
{{FILE:v4k_scene.c}}
{{FILE:v4k_time.c}}
{{FILE:v4k_system.c}}
{{FILE:v4k_time.c}}
{{FILE:v4k_profile.c}}
{{FILE:v4k_video.c}}

View File

@ -118,10 +118,10 @@ extern "C" {
{{FILE:v4k_editor.h}}
{{FILE:v4k_font.h}}
{{FILE:v4k_file.h}}
{{FILE:v4k_font.h}}
{{FILE:v4k_input.h}}
{{FILE:v4k_memory.h}}
@ -146,10 +146,10 @@ extern "C" {
{{FILE:v4k_string.h}}
{{FILE:v4k_time.h}}
{{FILE:v4k_system.h}}
{{FILE:v4k_time.h}}
{{FILE:v4k_ui.h}}
{{FILE:v4k_video.h}}
@ -170,7 +170,7 @@ extern "C" {
#include <emscripten/html5.h>
#define gladLoadGL(func) (glewExperimental = true, glewInit() == GLEW_OK)
#else
#if is(win32) /*&& is(tcc)*/ // && WITH_DLL
#if is(win32) /*&& is(tcc)*/ // && ENABLE_DLL
#ifdef GLAD_API_CALL
#undef GLAD_API_CALL
#endif

View File

@ -24,6 +24,7 @@
#define JO_MPEG_COMPONENTS 3 // jo_mpeg
#define JSON5_C // json5
#define LUA_IMPL // lua544
#define LUA_USE_POPEN 1 // for lite editor
#define MINIAUDIO_IMPLEMENTATION // miniaudio
#define MA_NO_FLAC // miniaudio
#define NK_GLFW_GL3_IMPLEMENTATION // nuklear
@ -52,7 +53,7 @@
#define BQ_WEBSOCKET_IMPLEMENTATION // websocket
#define XML_C // xml
#ifdef __APPLE__
#define MA_NO_RUNTIME_LINKING // miniaudio
#define MA_NO_RUNTIME_LINKING // miniaudio osx
#define _GLFW_COCOA // glfw osx
#elif defined _WIN32
#define _GLFW_WIN32 // glfw win32
@ -101,7 +102,6 @@ errno_t fopen_s(
);
#endif
//---
{{FILE:3rd_glfw3.h}}
#undef timeGetTime
@ -171,18 +171,28 @@ static char *ui_filter = 0;
#undef g
{{FILE:3rd_polychop.h}}
#define expr expr2 // 3rd_lua.h
#define EVAL_EXTEND_CONSTANTS \
for( int vk = input_enum(id), *once = &vk; once; once = 0) \
if( vk >= 0 ) push(ev, vk);
#define EVAL_EXTEND_FUNCTIONS \
/**/ if(!strcmp(id, "input") && nargs ==1) push(ev, input(pop(ev))); \
else if(!strcmp(id, "down") && nargs ==1) push(ev, input_down(pop(ev))); \
else if(!strcmp(id, "held") && nargs ==1) push(ev, input_held(pop(ev))); \
else if(!strcmp(id, "up") && nargs ==1) push(ev, input_up(pop(ev))); \
else if(!strcmp(id, "idle") && nargs ==1) push(ev, input_idle(pop(ev)));
{{FILE:3rd_eval.h}}
// #define SQLITE_OMIT_LOAD_EXTENSION
// #define SQLITE_CORE 1
// #define SQLITE_DEBUG 1
// #define Token SQToken
// #define Table SQTable
// #define rehash sqlite3__rehash
// #undef NB
//{{FILE/*:*/3rd_sqlite3.c}}
// #undef Token
// #undef Table
// #undef rehash
// #undef NB
// #undef threadid
{{FILE:3rd_luadebugger.h}}
//#define SQLITE_OMIT_LOAD_EXTENSION
//#define SQLITE_CORE 1
//#define SQLITE_DEBUG 1
//#define Token SQToken
//#define Table SQTable
//#define rehash sqlite3__rehash
//#undef NB
//{ {FILE:3rd_sqlite3.c}}
//#undef Token
//#undef Table
//#undef rehash
//#undef NB
//#undef threadid
#endif // V4K_3RD

View File

@ -343,7 +343,7 @@ int pathfind_astar(int width, int height, const unsigned* map, vec2i src, vec2i
#error ASTAR_POS_INDEX(p) should specify macro to map position to index
#endif
#ifndef ASTAR_MAX_INDEX
#ifndef ASTAR_MAX_INDEX
#error ASTAR_MAX_INDEX should specify max count of indices the position can map to
#endif
@ -434,7 +434,7 @@ int pathfind_astar(int width, int height, const unsigned* map, vec2i src, vec2i
i = p; \
p = (i - 1) / 2; \
} \
} while (0)
} while (0)
#define ASTAR_HEAP_POP() \
do { \
@ -625,7 +625,7 @@ int pathfind_astar(int width, int height, const unsigned* map, vec2i src, vec2i
// [ ] CompareKeys(keyVar1, operator < <= > >= == !=, keyVar2)
// [ ] SetTags(names=blank,cooldownTime=inf,bIsCooldownAdditive=false)
// [ ] HasTags(names=blank,bAllRequired=true)
// [ ] PushToStack(keyVar,itemObj): creates a new stack if one doesnt exist, and stores it in the passed variable name, and then pushes item object onto it.
// [ ] PushToStack(keyVar,itemObj): creates a new stack if one doesnt exist, and stores it in the passed variable name, and then pushes item object onto it.
// [ ] PopFromStack(keyVar,itemVar): pop pops an item off the stack, and stores it in the itemVar variable, failing if the stack is already empty.
// [ ] IsEmptyStack(keyVar): checks if the stack passed is empty and returns success if it is, and failure if its not.
// [ ] Communication Node: This is a type of action node that allows an AI agent to communicate with other agents or entities in the game world. The node takes an input specifying the message to be communicated and the recipient(s) of the message (wildmask,l/p/f/g prefixes). The node then sends the message to the designated recipient(s) and returns success when the communication is completed. This node can be useful for implementing behaviors that require the AI agent to coordinate with other agents or to convey information to the player. It could use a radius argument to specify the maximum allowed distance for the recipients.

View File

@ -1,28 +1,35 @@
// dll ------------------------------------------------------------------------
/* deprecated
#if is(win32)
# include <winsock2.h>
# define dlopen(name,mode) (void*)( (name) ? LoadLibraryA(name) : GetModuleHandle(NULL))
# define dlsym(handle,symbol) GetProcAddress((HMODULE)handle, symbol )
# define dlopen(name,flags) (void*)( (name) ? LoadLibraryA(name) : GetModuleHandleA(NULL))
# define dlsym(handle,symbol) GetProcAddress((HMODULE)(handle), symbol )
# define dlclose(handle) 0
#else
# include <dlfcn.h>
# define dlopen(name,flags) (void*)( (name) ? dlopen(name, flags) : NULL )
# define dlsym(handle,symbol) dlsym( (handle) ? (handle) : ifdef(osx,RTLD_SELF,NULL), symbol )
#endif
void* dll(const char *filename, const char *symbol) {
/*
char *buf, *base = file_name(filename);
if( file_exists(buf = va("%s", base)) ||
file_exists(buf = va("%s.dll", base)) ||
file_exists(buf = va("%s.so", base)) ||
file_exists(buf = va("lib%s.so", base)) ||
file_exists(buf = va("%s.dylib", base)) ) {
filename = buf;
}
*/
void *dll = dlopen(filename, RTLD_NOW | RTLD_LOCAL);
dll = dll ? dlsym(dll, symbol) : 0;
return dll;
void* dll(const char *fname, const char *symbol) {
if( fname && !file_exist(fname) ) {
char *buf, *path = file_path(fname), *base = file_base(fname);
if( file_exist(buf = va("%s%s.dll", path, base)) ||
file_exist(buf = va("%s%s.so", path, base)) ||
file_exist(buf = va("%slib%s.so", path, base)) ||
file_exist(buf = va("%s%s.dylib", path, base)) ) {
fname = (const char *)buf;
} else {
return NULL;
}
}
#if is(win32)
return (void*)GetProcAddress(fname ? LoadLibraryA(fname) : GetModuleHandleA(NULL), symbol);
#else
return dlsym(fname ? dlopen(fname, RTLD_NOW|RTLD_LOCAL) : ifdef(osx, RTLD_SELF, NULL), symbol);
#endif
}
#if 0 // demo: cl demo.c /LD && REM dll
@ -210,3 +217,72 @@ bool script_tests() {
}
#undef XMACRO
// script v2 ------------------------------------------------------------------
#define luaL_dostringsafe(L, str) \
luaL_dostring(L, \
"xpcall(function()\n" \
str \
"end, function(err)\n" \
" print('Error: ' .. tostring(err))\n" \
" print(debug.traceback(nil, 2))\n" \
" if core and core.on_error then\n" \
" pcall(core.on_error, err)\n" \
" end\n" \
" os.exit(1)\n" \
"end)" \
);
static int f_vfs_read(lua_State *L) {
char *file = file_normalize(luaL_checkstring(L, 1));
if( strbegi(file, app_path()) ) file += strlen(app_path());
strswap(file+1, ".", "/");
strswap(file+1, "/lua", ".lua");
int len; char *data = vfs_load(file, &len);
if( len ) {
data = memcpy(MALLOC(len+1), data, len), data[len] = 0;
//tty_color(data ? GREEN : RED);
//printf("%s (%s)\n%s", file, data ? "ok" : "failed", data);
//tty_color(0);
}
return lua_pushstring(L, data), 1; // "\n\tcannot find `%s` within mounted zipfiles", file), 1;
}
// add our zip loader at the end of package.loaders
void lua_add_ziploader(lua_State* L) {
lua_pushcfunction( L, f_vfs_read );
lua_setglobal( L, "vfs_read" );
luaL_dostringsafe(L,
// "package.path = [[;<?>;<<?.lua>>;]]\n" // .. package.path\n"
"package.searchers[#package.searchers + 1] = function(libraryname)\n"
" for pattern in string.gmatch( package.path, '[^;]+' ) do\n"
" local proper_path = string.gsub(pattern, '?', libraryname)\n"
" local f = vfs_read(proper_path)\n"
" if f ~= nil then\n"
" return load(f, proper_path)\n"
" end\n"
" end\n"
" return nil\n"
"end\n"
);
}
void *script_init_env(unsigned flags) {
if( flags & SCRIPT_LUA ) {
lua_State *L = luaL_newstate();
luaL_openlibs(L);
if( flags & SCRIPT_DEBUGGER ) {
// Register debuggers/inspectors
// luaL_dostringsafe(L, "I = require('inspect').inspect\n");
dbg_setup_default(L);
}
lua_add_ziploader(L);
return L;
}
return 0;
}

View File

@ -22,3 +22,13 @@ API void script_bind_function(const char *c_name, void *c_function);
API void script_call(const char *lua_function);
API bool script_tests();
// -----------------------------------------------------------------------------
// script framework
enum {
SCRIPT_LUA = 1,
SCRIPT_DEBUGGER = 2,
};
API void *script_init_env(unsigned flags);

View File

@ -161,7 +161,7 @@ char *file_id(const char *pathfile) {
char *ext = strchr(base, '.'); if (ext) ext[0] = '\0'; // remove all extensions
#else // extensionless for audio/images only (materials: diffuse.tga and diffuse.png will match)
char *ext = strrchr(base, '.'); //if (ext) ext[0] = '\0'; // remove all extensions
if(ext) if( strstr(".jpg.png.bmp.tga"".", ext) || strstr(".ogg.mp3.wav.mod.xm.flac"".", ext) || strstr(".mp4.ogv.avi.mkv.wmv.mpg.mpeg"".", ext) ) {
if(ext) if( strstr(".jpg.png.bmp.tga.hdr"".", ext) || strstr(".ogg.mp3.wav.mod.xm.flac"".", ext) || strstr(".mp4.ogv.avi.mkv.wmv.mpg.mpeg"".", ext) ) {
ext = strchr(base, '.');
ext[0] = '\0'; //strcpy(ext, "_xxx");
}

View File

@ -99,7 +99,7 @@ enum INPUT_ENUMS {
KEY_PAD1,KEY_PAD2,KEY_PAD3,KEY_PAD4,KEY_PAD5,KEY_PAD6,KEY_PAD7,KEY_PAD8,KEY_PAD9,KEY_PAD0, // beware: complicated on laptops
KEY_PADADD,KEY_PADSUB,KEY_PADMUL,KEY_PADDIV,KEY_PADDOT,KEY_PADENTER, // beware: complicated on laptops
MOUSE_L, MOUSE_M, MOUSE_R,
MOUSE_L, MOUSE_M, MOUSE_R, // @todo: MOUSE_CLICKS,
GAMEPAD_CONNECTED, GAMEPAD_A, GAMEPAD_B, GAMEPAD_X, GAMEPAD_Y,
GAMEPAD_UP, GAMEPAD_DOWN, GAMEPAD_LEFT, GAMEPAD_RIGHT, GAMEPAD_MENU, GAMEPAD_START,
GAMEPAD_LB, GAMEPAD_RB, GAMEPAD_LTHUMB, GAMEPAD_RTHUMB,

View File

@ -106,6 +106,7 @@ enum TEXTURE_FLAGS {
// @fixme
TEXTURE_SRGB = 1 << 24,
TEXTURE_BGR = 1 << 25,
TEXTURE_BGRA = TEXTURE_BGR,
TEXTURE_ARRAY = 1 << 26,
};

View File

@ -13,7 +13,7 @@ char* tempvl(const char *fmt, va_list vl) {
static __thread char buf[STACK_ALLOC];
#else
int heap = 1;
static __thread int STACK_ALLOC = 128*1024;
static __thread int STACK_ALLOC =