Remove vec.h; add editor start, step, pause controls
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "log.h"
|
||||
#include "vec.h"
|
||||
#include <dirent.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
@@ -20,7 +19,7 @@
|
||||
char *DATA_PATH = NULL;
|
||||
char *PREF_PATH = NULL;
|
||||
|
||||
struct vec *prefabs = NULL;
|
||||
char *prefabs;
|
||||
|
||||
const char *EXT_PREFAB = ".prefab";
|
||||
const char *EXT_LEVEL = ".level";
|
||||
@@ -29,13 +28,10 @@ int stemlen = 0;
|
||||
|
||||
static const char *cur_ext = NULL;
|
||||
struct dirent *c_dirent = NULL;
|
||||
struct vec *c_vec = NULL;
|
||||
|
||||
char pathbuf[MAXPATH + 1];
|
||||
|
||||
void resources_init() {
|
||||
prefabs = vec_make(MAXNAME, 25);
|
||||
|
||||
DATA_PATH = malloc(MAXPATH);
|
||||
getcwd(DATA_PATH, MAXPATH);
|
||||
strncat(DATA_PATH, "/", MAXPATH);
|
||||
@@ -80,17 +76,19 @@ FILE *res_open(char *path, const char *tag) {
|
||||
static int ext_check(const char *path, const struct stat *sb, int typeflag) {
|
||||
if (typeflag == FTW_F) {
|
||||
const char *ext = strrchr(path, '.');
|
||||
if (ext != NULL && !strcmp(ext, cur_ext))
|
||||
vec_add(c_vec, path);
|
||||
if (ext != NULL && !strcmp(ext, cur_ext)) {
|
||||
char newstr[255];
|
||||
strncpy(newstr, path, 255);
|
||||
arrput(prefabs, newstr);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void fill_extensions(struct vec *vec, const char *path, const char *ext) {
|
||||
c_vec = vec;
|
||||
void fill_extensions(char *paths, const char *path, const char *ext) {
|
||||
cur_ext = ext;
|
||||
vec_clear(c_vec);
|
||||
arrfree(paths);
|
||||
ftw(".", ext_check, 10);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
struct vec;
|
||||
|
||||
extern char *DATA_PATH;
|
||||
extern char *PREF_PATH;
|
||||
|
||||
@@ -15,9 +13,9 @@ extern int stemlen;
|
||||
|
||||
void resources_init();
|
||||
|
||||
extern struct vec *prefabs;
|
||||
extern char *prefabs;
|
||||
void findPrefabs();
|
||||
void fill_extensions(struct vec *vec, const char *path, const char *ext);
|
||||
void fill_extensions(char *paths, const char *path, const char *ext);
|
||||
char *get_filename_from_path(char *path, int extension);
|
||||
char *get_directory_from_path(char *path);
|
||||
char *str_replace_ext(const char *s, const char *newext);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "script.h"
|
||||
|
||||
#include "stdarg.h"
|
||||
|
||||
#include "log.h"
|
||||
#include "stdio.h"
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "log.h"
|
||||
#include "render.h"
|
||||
#include "sokol/sokol_gfx.h"
|
||||
#include "util.h"
|
||||
#include <math.h>
|
||||
#include <stb_ds.h>
|
||||
#include <stb_image.h>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
#define SOKOL_TRACE_HOOKS
|
||||
#define SOKOL_GFX_IMPL
|
||||
#define SOKOL_GLES3
|
||||
#define SOKOL_GLCORE33
|
||||
#include "sokol/sokol_gfx.h"
|
||||
|
||||
int physOn = 0;
|
||||
@@ -297,7 +297,7 @@ void sim_stop() {
|
||||
sim_play = SIM_STOP;
|
||||
}
|
||||
|
||||
int phys_stepping() { return phys_step; }
|
||||
int phys_stepping() { return sim_play == SIM_STEP; }
|
||||
|
||||
void sim_step() {
|
||||
if (sim_paused()) {
|
||||
|
||||
Reference in New Issue
Block a user