Clang warning fixes; remove unneeded nuklear files; remove assumed window size
This commit is contained in:
parent
467f7b29ea
commit
f41f547f63
23
Makefile
23
Makefile
|
@ -2,6 +2,7 @@ PROCS != nproc
|
||||||
MAKEFLAGS = --jobs=$(PROCS)
|
MAKEFLAGS = --jobs=$(PROCS)
|
||||||
|
|
||||||
UNAME != uname
|
UNAME != uname
|
||||||
|
MAKEDIR != pwd
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
# DBG --- build with debugging symbols and logging
|
# DBG --- build with debugging symbols and logging
|
||||||
|
@ -40,19 +41,26 @@ ELIBS = engine quickjs
|
||||||
|
|
||||||
PKGCMD = tar --directory $(BIN) --exclude="./*.a" --exclude="./obj" --exclude="./include" -czf $(DISTDIR)/$(DIST) .
|
PKGCMD = tar --directory $(BIN) --exclude="./*.a" --exclude="./obj" --exclude="./include" -czf $(DISTDIR)/$(DIST) .
|
||||||
ZIP = .tar.gz
|
ZIP = .tar.gz
|
||||||
|
UNZIP = cp $(DISTDIR)/$(DIST) $(DESTDIR) && tar xzf $(DESTDIR)/$(DIST) -C $(DESTDIR) && rm $(DESTDIR)/$(DIST)
|
||||||
|
|
||||||
ARCH = x64
|
ARCH = x64
|
||||||
|
|
||||||
|
COMPILER_FLAGS = $(includeflag) $(QFLAGS) -MD $(WARNING_FLAGS) -I. -DCP_USE_DOUBLES=0 -DTINYSPLINE_FLOAT_PRECISION -DVER=\"$(VER)\" -DINFO=\"$(INFO)\" -c $< -o $@
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(OS), Windows_NT)
|
ifeq ($(OS), Windows_NT)
|
||||||
LINKER_FLAGS += -mwin32 -static
|
LINKER_FLAGS += -mwin32 -static
|
||||||
ELIBS += kernel32 user32 shell32 dxgi gdi32 ws2_32 ole32 winmm setupapi m
|
COMPILER_FLAGS += -mwin32
|
||||||
|
ELIBS += mingw32 kernel32 user32 shell32 dxgi gdi32 ws2_32 ole32 winmm setupapi m
|
||||||
EXT = .exe
|
EXT = .exe
|
||||||
PLAT = w64
|
PLAT = w64
|
||||||
PKGCMD = zip -r $(DISTDIR)/$(DIST) $(BIN) --exclude "./*.a" --exclude="./obj" --exclude="./include"
|
PKGCMD = cd $(BIN); zip -q -r $(MAKEDIR)/$(DISTDIR)/$(DIST) . -x \*.a ./obj/\*
|
||||||
ZIP = .zip
|
ZIP = .zip
|
||||||
|
UNZIP = unzip -o -q $(DISTDIR)/$(DIST) -d $(DESTDIR)
|
||||||
else ifeq ($(CC), emcc)
|
else ifeq ($(CC), emcc)
|
||||||
LINKER_FLAGS += -sFULL_ES3
|
LINKER_FLAGS += -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2 -pthread
|
||||||
ELIBS += pthread quickjs GL c m dl
|
COMPILER_FLAGS += -pthread
|
||||||
|
ELIBS += pthread quickjs GL openal c m dl
|
||||||
CC = emcc
|
CC = emcc
|
||||||
EXT = .html
|
EXT = .html
|
||||||
PLAT = html5
|
PLAT = html5
|
||||||
|
@ -106,13 +114,12 @@ includeflag != find source -type d -name include
|
||||||
includeflag += $(engincs) source/engine/thirdparty/Nuklear
|
includeflag += $(engincs) source/engine/thirdparty/Nuklear
|
||||||
includeflag := $(addprefix -I, $(includeflag))
|
includeflag := $(addprefix -I, $(includeflag))
|
||||||
|
|
||||||
WARNING_FLAGS = -Wall -Wno-incompatible-function-pointer-types -Wno-unused-function# -pedantic -Wextra -Wwrite-strings -Wno-incompatible-function-pointer-types -Wno-incompatible-pointer-types -Wno-unused-function -Wno-int-conversion
|
WARNING_FLAGS = -Wno-incompatible-function-pointer-types -Wno-incompatible-pointer-types #-Wall -Wno-incompatible-function-pointer-types -Wno-unused-function# -pedantic -Wextra -Wwrite-strings -Wno-incompatible-function-pointer-types -Wno-incompatible-pointer-types -Wno-unused-function -Wno-int-conversion
|
||||||
|
|
||||||
SEM = 0.0.1
|
SEM = 0.0.1
|
||||||
COM != fossil describe
|
COM != fossil describe
|
||||||
VER = $(SEM)-$(COM)
|
VER = $(SEM)-$(COM)
|
||||||
|
|
||||||
COMPILER_FLAGS = $(includeflag) $(QFLAGS) -MD $(WARNING_FLAGS) -I. -DCP_USE_DOUBLES=0 -DTINYSPLINE_FLOAT_PRECISION -DVER=\"$(VER)\" -DINFO=\"$(INFO)\" -c $< -o $@
|
|
||||||
|
|
||||||
LIBPATH = -L$(BIN)
|
LIBPATH = -L$(BIN)
|
||||||
|
|
||||||
|
@ -143,7 +150,7 @@ DESTDIR ?= ~/.bin
|
||||||
install: $(DISTDIR)/$(DIST)
|
install: $(DISTDIR)/$(DIST)
|
||||||
@echo Unpacking $(DIST) in $(DESTDIR)
|
@echo Unpacking $(DIST) in $(DESTDIR)
|
||||||
# @unzip $(DISTDIR)/$(DIST) -d $(DESTDIR)
|
# @unzip $(DISTDIR)/$(DIST) -d $(DESTDIR)
|
||||||
@cp $(DISTDIR)/$(DIST) $(DESTDIR) && tar xzf $(DESTDIR)/$(DIST) -C $(DESTDIR) && rm $(DESTDIR)/$(DIST)
|
@$(UNZIP)
|
||||||
|
|
||||||
$(BIN)$(NAME): $(objprefix)/source/engine/yugine.o $(ENGINE) $(BIN)libquickjs.a
|
$(BIN)$(NAME): $(objprefix)/source/engine/yugine.o $(ENGINE) $(BIN)libquickjs.a
|
||||||
@echo Linking $(NAME)
|
@echo Linking $(NAME)
|
||||||
|
@ -165,7 +172,7 @@ $(BIN)libquickjs.a:
|
||||||
|
|
||||||
$(ENGINE): $(eobjects)
|
$(ENGINE): $(eobjects)
|
||||||
@echo Making library engine.a
|
@echo Making library engine.a
|
||||||
@llvm-ar r $(ENGINE) $(eobjects)
|
@ar r $(ENGINE) $(eobjects)
|
||||||
|
|
||||||
$(objprefix)/%.o:%.c
|
$(objprefix)/%.o:%.c
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
|
|
|
@ -632,8 +632,8 @@ static cpBool handle_collision(cpArbiter *arb, int type) {
|
||||||
cpBody *body1;
|
cpBody *body1;
|
||||||
cpBody *body2;
|
cpBody *body2;
|
||||||
cpArbiterGetBodies(arb, &body1, &body2);
|
cpArbiterGetBodies(arb, &body1, &body2);
|
||||||
int g1 = (int)cpBodyGetUserData(body1);
|
int g1 = *(int*)cpBodyGetUserData(body1);
|
||||||
int g2 = (int)cpBodyGetUserData(body2);
|
int g2 = *(int*)cpBodyGetUserData(body2);
|
||||||
struct gameobject *go = id2go(g1);
|
struct gameobject *go = id2go(g1);
|
||||||
struct gameobject *go2 = id2go(g2);
|
struct gameobject *go2 = id2go(g2);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define LIGHT_H
|
#define LIGHT_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
/*
|
||||||
struct mLight {
|
struct mLight {
|
||||||
struct gameobject *go;
|
struct gameobject *go;
|
||||||
uint8_t color[3];
|
uint8_t color[3];
|
||||||
|
@ -11,7 +11,7 @@ struct mLight {
|
||||||
int on;
|
int on;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
struct mPointLight {
|
struct mPointLight {
|
||||||
struct mLight light;
|
struct mLight light;
|
||||||
float constant;
|
float constant;
|
||||||
|
@ -54,10 +54,10 @@ struct mDirectionalLight *MakeDLight();
|
||||||
|
|
||||||
extern struct mDirectionalLight *dLight;
|
extern struct mDirectionalLight *dLight;
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
void light_gui(struct mLight *light);
|
void light_gui(struct mLight *light);
|
||||||
void pointlight_gui(struct mPointLight *light);
|
void pointlight_gui(struct mPointLight *light);
|
||||||
void spotlight_gui(struct mSpotLight *spot);
|
void spotlight_gui(struct mSpotLight *spot);
|
||||||
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,97 +0,0 @@
|
||||||
#include "mesh.h"
|
|
||||||
|
|
||||||
#include "render.h"
|
|
||||||
#include "shader.h"
|
|
||||||
#include "texture.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
void DrawMesh(struct mesh *mesh, struct shader *shader) {
|
|
||||||
// bind appropriate textures
|
|
||||||
uint32_t diffuseNr = 1;
|
|
||||||
uint32_t specularNr = 1;
|
|
||||||
uint32_t normalNr = 1;
|
|
||||||
uint32_t heightNr = 1;
|
|
||||||
|
|
||||||
// for (int i = 0; i < (mesh->te - mesh->textures); i++) {
|
|
||||||
// glActiveTexture(GL_TEXTURE0 + i); // active proper texture unit before binding
|
|
||||||
// retrieve texture number (the N in diffuse_textureN)
|
|
||||||
// char number = 0;
|
|
||||||
// TODO: malloc every single frame ... nope! Change to stack
|
|
||||||
/*char *name = malloc(sizeof(char) *(strlen(mesh->textures[i].type) + 2));*/
|
|
||||||
/*
|
|
||||||
// if (mesh->textures[i].type == TEX_DIFF)
|
|
||||||
// number = diffuseNr++;
|
|
||||||
// else if (mesh->textures[i].type == TEX_SPEC)
|
|
||||||
// number = specularNr++;
|
|
||||||
// else if (mesh->textures[i].type == TEX_NORM)
|
|
||||||
// number = normalNr++;
|
|
||||||
// else if (mesh->textures[i].type == TEX_HEIGHT)
|
|
||||||
// number = heightNr++;
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
glUniform1i(glGetUniformLocation(shader->id, name), i);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, mesh->textures[i].id);
|
|
||||||
free(name);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawMeshAgain(struct mesh *mesh) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void setupmesh(struct mesh *mesh) {
|
|
||||||
/*
|
|
||||||
// create buffers/arrays
|
|
||||||
glGenVertexArrays(1, &mesh->VAO);
|
|
||||||
glGenBuffers(1, &mesh->VBO);
|
|
||||||
glGenBuffers(1, &mesh->EBO);
|
|
||||||
|
|
||||||
glBindVertexArray(mesh->VAO);
|
|
||||||
// load data into vertex buffers
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, mesh->VBO);
|
|
||||||
|
|
||||||
|
|
||||||
// The effect is that we can simply pass a pointer to the struct and it translates perfectly to vevc array which
|
|
||||||
// again translates to 3/2 floats which translates to a byte array.
|
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
|
||||||
(mesh->ve - mesh->vertices) * sizeof(struct Vertex),
|
|
||||||
&mesh->vertices[0], GL_STATIC_DRAW);
|
|
||||||
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh->EBO);
|
|
||||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER,
|
|
||||||
(mesh->ie - mesh->indices) * sizeof(uint32_t),
|
|
||||||
&mesh->indices[0], GL_STATIC_DRAW);
|
|
||||||
|
|
||||||
// set the vertex attribute pointers
|
|
||||||
// vertex Positions
|
|
||||||
glEnableVertexAttribArray(0);
|
|
||||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(struct Vertex), NULL);
|
|
||||||
// vertex normals
|
|
||||||
glEnableVertexAttribArray(1);
|
|
||||||
// glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(struct Vertex), offsetof(struct Vertex, Normal[3]));
|
|
||||||
// vertex texture coords
|
|
||||||
glEnableVertexAttribArray(2);
|
|
||||||
// glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(struct Vertex), offsetof(struct Vertex, TexCoords[2]));
|
|
||||||
// vertex tangent
|
|
||||||
glEnableVertexAttribArray(3);
|
|
||||||
// glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, sizeof(struct Vertex), offsetof(struct Vertex, Tangent[3]));
|
|
||||||
// vertex bitangent
|
|
||||||
glEnableVertexAttribArray(4);
|
|
||||||
// glVertexAttribPointer(4, 3, GL_FLOAT, GL_FALSE, sizeof(struct Vertex), offsetof(struct Vertex, Bitangent[3]));
|
|
||||||
|
|
||||||
// Bone ids
|
|
||||||
glEnableVertexAttribArray(5);
|
|
||||||
glVertexAttribPointer(5, 4, GL_INT, GL_FALSE, sizeof(struct Vertex), offsetof(struct Vertex,
|
|
||||||
m_BoneIDs
|
|
||||||
[MAX_BONE_INFLUENCE]));
|
|
||||||
|
|
||||||
// Weights
|
|
||||||
glEnableVertexAttribArray(6);
|
|
||||||
// glVertexAttribPointer(6, 4, GL_FLOAT, GL_FALSE, sizeof(struct Vertex), offsetof(struct Vertex, m_Weights));
|
|
||||||
|
|
||||||
glBindVertexArray(0);
|
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
#ifndef MESH_H
|
|
||||||
#define MESH_H
|
|
||||||
|
|
||||||
#include "sokol/sokol_gfx.h"
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
struct shader;
|
|
||||||
struct Texture;
|
|
||||||
|
|
||||||
struct mesh {
|
|
||||||
sg_bindings bind;
|
|
||||||
uint32_t face_count;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct mesh *MakeMesh(struct Vertex *vertices, struct Vertex *ve, uint32_t *indices, uint32_t *ie, struct Texture *textures, struct Texture *te);
|
|
||||||
void setupmesh(struct mesh *mesh); /* Loads mesh into the GPU */
|
|
||||||
void DrawMesh(struct mesh *mesh, struct shader *shader);
|
|
||||||
void DrawMeshAgain(struct mesh *mesh); /* Draws whatever mesh was drawn last */
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,11 +1,11 @@
|
||||||
#include "model.h"
|
#include "model.h"
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "mesh.h"
|
|
||||||
#include "resources.h"
|
#include "resources.h"
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
#include "stb_ds.h"
|
#include "stb_ds.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
|
#include "window.h"
|
||||||
|
|
||||||
#include "openglrender.h"
|
#include "openglrender.h"
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
char *key;
|
char *key;
|
||||||
struct Texture *value;
|
struct model *value;
|
||||||
} *modelhash = NULL;
|
} *modelhash = NULL;
|
||||||
|
|
||||||
static void processnode();
|
static void processnode();
|
||||||
|
@ -126,15 +126,15 @@ struct model *MakeModel(const char *path) {
|
||||||
cgltf_data *data = NULL;
|
cgltf_data *data = NULL;
|
||||||
cgltf_result result = cgltf_parse_file(&options, path, &data);
|
cgltf_result result = cgltf_parse_file(&options, path, &data);
|
||||||
|
|
||||||
if (!result == cgltf_result_success) {
|
if (result) {
|
||||||
YughError("Could not read file %s.", path);
|
YughError("CGLTF could not parse file %s, err %d.", path, result);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = cgltf_load_buffers(&options, data, path);
|
result = cgltf_load_buffers(&options, data, path);
|
||||||
|
|
||||||
if (!result == cgltf_result_success) {
|
if (result) {
|
||||||
YughError("Could not load buffers for file %s.", path);
|
YughError("CGLTF could not load buffers for file %s, err %d.", path, result);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ struct model *MakeModel(const char *path) {
|
||||||
HMM_Vec3 eye = {50,10,5};
|
HMM_Vec3 eye = {50,10,5};
|
||||||
|
|
||||||
void draw_model(struct model *model, HMM_Mat4 amodel, HMM_Mat4 lsm) {
|
void draw_model(struct model *model, HMM_Mat4 amodel, HMM_Mat4 lsm) {
|
||||||
HMM_Mat4 proj = HMM_Perspective_RH_ZO(45, 1200.f / 720, 0.1, 10000);
|
HMM_Mat4 proj = HMM_Perspective_RH_ZO(45, (float)mainwin.width / mainwin.height, 0.1, 10000);
|
||||||
HMM_Vec3 center = {0.f, 0.f, 0.f};
|
HMM_Vec3 center = {0.f, 0.f, 0.f};
|
||||||
HMM_Vec3 up = {0.f, 1.f, 0.f};
|
HMM_Vec3 up = {0.f, 1.f, 0.f};
|
||||||
HMM_Mat4 view = HMM_LookAt_RH(eye, center, up);
|
HMM_Mat4 view = HMM_LookAt_RH(eye, center, up);
|
||||||
|
|
|
@ -1,12 +1,18 @@
|
||||||
#ifndef MODEL_H
|
#ifndef MODEL_H
|
||||||
#define MODEL_H
|
#define MODEL_H
|
||||||
|
|
||||||
#include "mesh.h"
|
|
||||||
#include "HandmadeMath.h"
|
#include "HandmadeMath.h"
|
||||||
|
|
||||||
|
#include "sokol/sokol_gfx.h"
|
||||||
|
|
||||||
extern HMM_Vec3 eye;
|
extern HMM_Vec3 eye;
|
||||||
struct shader;
|
struct shader;
|
||||||
|
|
||||||
|
struct mesh {
|
||||||
|
sg_bindings bind;
|
||||||
|
uint32_t face_count;
|
||||||
|
};
|
||||||
|
|
||||||
struct model {
|
struct model {
|
||||||
struct mesh *meshes;
|
struct mesh *meshes;
|
||||||
};
|
};
|
||||||
|
|
|
@ -105,6 +105,7 @@ struct mSkybox *MakeSkybox(const char *cubemap) {
|
||||||
|
|
||||||
return newskybox;
|
return newskybox;
|
||||||
*/
|
*/
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void skybox_draw(const struct mSkybox *skybox,
|
void skybox_draw(const struct mSkybox *skybox,
|
||||||
|
|
|
@ -10,4 +10,6 @@
|
||||||
#define DEG2RADS 0.0174532925199432957692369076848861271344287188854172545609719144f
|
#define DEG2RADS 0.0174532925199432957692369076848861271344287188854172545609719144f
|
||||||
#define RAD2DEGS 57.2958f
|
#define RAD2DEGS 57.2958f
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -105,7 +105,7 @@ void ds_openvideo(struct datastream *ds, const char *video, const char *adriver)
|
||||||
ds->playing = true;
|
ds->playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct datastream *MakeDatastream() {
|
void MakeDatastream() {
|
||||||
vid_shader = sg_compile_shader("shaders/videovert.glsl", "shaders/videofrag.glsl", &(sg_shader_desc){
|
vid_shader = sg_compile_shader("shaders/videovert.glsl", "shaders/videofrag.glsl", &(sg_shader_desc){
|
||||||
.fs.images[0] = {
|
.fs.images[0] = {
|
||||||
.name = "video",
|
.name = "video",
|
||||||
|
|
|
@ -21,7 +21,7 @@ struct datastream {
|
||||||
|
|
||||||
struct Texture;
|
struct Texture;
|
||||||
|
|
||||||
struct datastream *MakeDatastream();
|
void MakeDatastream();
|
||||||
void ds_openvideo(struct datastream *ds, const char *path, const char *adriver);
|
void ds_openvideo(struct datastream *ds, const char *path, const char *adriver);
|
||||||
struct Texture *ds_maketexture(struct datastream *);
|
struct Texture *ds_maketexture(struct datastream *);
|
||||||
void ds_advance(struct datastream *ds, double);
|
void ds_advance(struct datastream *ds, double);
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
#ifndef DEBUG_GUI_H
|
#ifndef DEBUG_GUI_H
|
||||||
#define DEBUG_GUI_H
|
#define DEBUG_GUI_H
|
||||||
|
|
||||||
|
#ifndef static_assert
|
||||||
#define static_assert(pred) switch(0){case 0:case pred:;}
|
#define static_assert(pred) switch(0){case 0:case pred:;}
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
|
@ -461,7 +461,7 @@ void inflatepoints(cpVect *r, cpVect *p, float d, int n)
|
||||||
|
|
||||||
void draw_edge(cpVect *points, int n, struct rgba color, int thickness, int closed, int flags, struct rgba line_color, float line_seg)
|
void draw_edge(cpVect *points, int n, struct rgba color, int thickness, int closed, int flags, struct rgba line_color, float line_seg)
|
||||||
{
|
{
|
||||||
static_assert(sizeof(cpVect) == 2*sizeof(float));
|
static_assert(sizeof(cpVect) == 2*sizeof(float), "Size of cpVect is not 2 floats.");
|
||||||
if (thickness == 0) {
|
if (thickness == 0) {
|
||||||
thickness = 1;
|
thickness = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -412,7 +412,7 @@ JSValue duk_win_make(JSContext *js, JSValueConst this, int argc, JSValueConst *a
|
||||||
}
|
}
|
||||||
|
|
||||||
JSValue duk_spline_cmd(JSContext *js, JSValueConst this, int argc, JSValueConst *argv) {
|
JSValue duk_spline_cmd(JSContext *js, JSValueConst this, int argc, JSValueConst *argv) {
|
||||||
static_assert(sizeof(tsReal) * 2 == sizeof(cpVect));
|
static_assert(sizeof(tsReal) * 2 == sizeof(cpVect), "Size of tsRealx2 is not cpVect");
|
||||||
|
|
||||||
tsBSpline spline;
|
tsBSpline spline;
|
||||||
|
|
||||||
|
@ -492,7 +492,7 @@ int point2segindex(cpVect p, cpVect *segs, double slop) {
|
||||||
float c = segs[i].y - (a * segs[i].x);
|
float c = segs[i].y - (a * segs[i].x);
|
||||||
float b = -1;
|
float b = -1;
|
||||||
|
|
||||||
float dist = abs(a * p.x + b * p.y + c) / sqrt(pow(a, 2) + 1);
|
float dist = fabsf(a * p.x + b * p.y + c) / sqrt(pow(a, 2) + 1);
|
||||||
|
|
||||||
if (dist > shortest) continue;
|
if (dist > shortest) continue;
|
||||||
|
|
||||||
|
@ -517,12 +517,13 @@ int point2segindex(cpVect p, cpVect *segs, double slop) {
|
||||||
n.x = segs[1].x - segs[0].x;
|
n.x = segs[1].x - segs[0].x;
|
||||||
n.y = segs[1].y - segs[0].y;
|
n.y = segs[1].y - segs[0].y;
|
||||||
n = cpvnormalize(n);
|
n = cpvnormalize(n);
|
||||||
if (cpvdot(n, cpvsub(p, segs[0])) < 0)
|
if (cpvdot(n, cpvsub(p, segs[0])) < 0) {
|
||||||
if (cpvdist(p, segs[0]) >= slop)
|
if (cpvdist(p, segs[0]) >= slop)
|
||||||
best = -1;
|
best = -1;
|
||||||
else
|
else
|
||||||
best = 0;
|
best = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (best == arrlen(segs) - 1) {
|
if (best == arrlen(segs) - 1) {
|
||||||
cpVect n;
|
cpVect n;
|
||||||
|
@ -530,12 +531,13 @@ int point2segindex(cpVect p, cpVect *segs, double slop) {
|
||||||
n.y = segs[best - 1].y - segs[best - 1].y;
|
n.y = segs[best - 1].y - segs[best - 1].y;
|
||||||
n = cpvnormalize(n);
|
n = cpvnormalize(n);
|
||||||
|
|
||||||
if (cpvdot(n, cpvsub(p, segs[best])) < 0)
|
if (cpvdot(n, cpvsub(p, segs[best])) < 0) {
|
||||||
if (cpvdist(p, segs[best]) >= slop)
|
if (cpvdist(p, segs[best]) >= slop)
|
||||||
best = -1;
|
best = -1;
|
||||||
else
|
else
|
||||||
best = arrlen(segs);
|
best = arrlen(segs);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
@ -568,7 +570,7 @@ JSValue dukext2paths(char *ext) {
|
||||||
dukext = ext;
|
dukext = ext;
|
||||||
dukarr = JS_NewArray(js);
|
dukarr = JS_NewArray(js);
|
||||||
dukidx = 0;
|
dukidx = 0;
|
||||||
nftw(".", duk2path, 10,0);
|
ftw(".", duk2path, 10);
|
||||||
return dukarr;
|
return dukarr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ unsigned char *slurp_file(const char *filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char *slurp_text(const char *filename) {
|
char *slurp_text(const char *filename) {
|
||||||
FILE *f = fopen(filename, "r'");
|
FILE *f = fopen(filename, "r");
|
||||||
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
YughWarn("File %s doesn't exist.", filename);
|
YughWarn("File %s doesn't exist.", filename);
|
||||||
|
@ -156,6 +156,8 @@ struct sFont *MakeSDFFont(const char *fontfile, int height)
|
||||||
int w, h, xoff, yoff;
|
int w, h, xoff, yoff;
|
||||||
// unsigned char *stbtt_GetGlyphSDF(&fontinfo, height, i, 1, 0, 1, &w, &h, &xoff, &yoff);
|
// unsigned char *stbtt_GetGlyphSDF(&fontinfo, height, i, 1, 0, 1, &w, &h, &xoff, &yoff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return newfont;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sFont *MakeFont(const char *fontfile, int height) {
|
struct sFont *MakeFont(const char *fontfile, int height) {
|
||||||
|
@ -316,8 +318,8 @@ void text_settype(struct sFont *mfont) {
|
||||||
struct boundingbox text_bb(const char *text, float scale, float lw, float tracking)
|
struct boundingbox text_bb(const char *text, float scale, float lw, float tracking)
|
||||||
{
|
{
|
||||||
HMM_Vec2 cursor = {0,0};
|
HMM_Vec2 cursor = {0,0};
|
||||||
unsigned char *c = text;
|
const unsigned char *c = text;
|
||||||
unsigned char *wordstart;
|
const unsigned char *wordstart;
|
||||||
|
|
||||||
while (*c != '\0') {
|
while (*c != '\0') {
|
||||||
if (isblank(*c)) {
|
if (isblank(*c)) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ struct gameobject *id2go(int id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int body2id(cpBody *body) {
|
int body2id(cpBody *body) {
|
||||||
return (int)cpBodyGetUserData(body);
|
return *(int*)cpBodyGetUserData(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
cpBody *id2body(int id) {
|
cpBody *id2body(int id) {
|
||||||
|
|
|
@ -5,9 +5,19 @@
|
||||||
|
|
||||||
#define STBTT_STATIC
|
#define STBTT_STATIC
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include "nuke.h"
|
#include "nuke.h"
|
||||||
|
|
||||||
#define SOKOL_GLCORE33
|
#if defined __linux__
|
||||||
|
#define SOKOL_GLCORE33
|
||||||
|
#elif __EMSCRIPTEN__
|
||||||
|
#define SOKOL_GLES3
|
||||||
|
#elif __WIN32
|
||||||
|
#define SOKOL_GLCORE33
|
||||||
|
#define SOKOL_WIN32_FORCE_MAIN
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "sokol/sokol_gfx.h"
|
#include "sokol/sokol_gfx.h"
|
||||||
|
|
||||||
#define SOKOL_NUKLEAR_IMPL
|
#define SOKOL_NUKLEAR_IMPL
|
||||||
|
@ -38,36 +48,8 @@ void nuke_start() {
|
||||||
ctx = snk_new_frame();
|
ctx = snk_new_frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nuke_input_cursor(int x, int y)
|
|
||||||
{
|
|
||||||
nk_input_motion(ctx, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
void nuke_input_key(int key, int down)
|
|
||||||
{
|
|
||||||
nk_input_key(ctx, key, down);
|
|
||||||
}
|
|
||||||
|
|
||||||
void nuke_input_button(int btn, int x, int y, int down)
|
|
||||||
{
|
|
||||||
nk_input_button(ctx, btn, x, y, down);
|
|
||||||
}
|
|
||||||
|
|
||||||
void nuke_input_scroll(float x, float y)
|
|
||||||
{
|
|
||||||
nk_input_scroll(ctx, nk_vec2(x, y));
|
|
||||||
}
|
|
||||||
|
|
||||||
void nuke_input_char(char c)
|
|
||||||
{
|
|
||||||
nk_input_char(ctx, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
void nuke_input_begin() { nk_input_begin(ctx); }
|
|
||||||
void nuke_input_end() { nk_input_end(ctx); }
|
|
||||||
|
|
||||||
void nuke_end() {
|
void nuke_end() {
|
||||||
snk_render(1200,720);
|
snk_render(mainwin.width,mainwin.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nuke_begin(const char *lbl, struct nk_rect rect, int flags) {
|
int nuke_begin(const char *lbl, struct nk_rect rect, int flags) {
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#define NK_INCLUDE_STANDARD_IO
|
#define NK_INCLUDE_STANDARD_IO
|
||||||
#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT
|
#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT
|
||||||
|
|
||||||
|
|
||||||
#include "nuklear.h"
|
#include "nuklear.h"
|
||||||
|
|
||||||
struct window;
|
struct window;
|
||||||
|
@ -28,14 +27,6 @@ void nuke_property_float(const char *lbl, float min, float *val, float max, floa
|
||||||
void nuke_property_float2(const char *label, float min, float *val, float max, float step, float dragstep);
|
void nuke_property_float2(const char *label, float min, float *val, float max, float step, float dragstep);
|
||||||
void nuke_property_float3(const char *label, float min, float *val, float max, float step, float dragstep);
|
void nuke_property_float3(const char *label, float min, float *val, float max, float step, float dragstep);
|
||||||
|
|
||||||
void nuke_input_begin();
|
|
||||||
void nuke_input_end();
|
|
||||||
void nuke_input_cursor(int x, int y);
|
|
||||||
void nuke_input_key(int key, int down);
|
|
||||||
void nuke_input_button(int btn, int x, int y, int down);
|
|
||||||
void nuke_input_scroll(float x, float y);
|
|
||||||
void nuke_input_char(char c);
|
|
||||||
|
|
||||||
void nuke_property_int(const char *lbl, int min, int *val, int max, int step);
|
void nuke_property_int(const char *lbl, int min, int *val, int max, int step);
|
||||||
void nuke_radio_btn(const char *lbl, int *val, int cmp);
|
void nuke_radio_btn(const char *lbl, int *val, int cmp);
|
||||||
void nuke_checkbox(const char *lbl, int *val);
|
void nuke_checkbox(const char *lbl, int *val);
|
||||||
|
|
|
@ -164,14 +164,14 @@ void openglInit() {
|
||||||
|
|
||||||
crt_post.img = sg_make_image(&(sg_image_desc){
|
crt_post.img = sg_make_image(&(sg_image_desc){
|
||||||
.render_target = true,
|
.render_target = true,
|
||||||
.width = 1200,
|
.width = mainwin.width,
|
||||||
.height = 720,
|
.height = mainwin.height,
|
||||||
});
|
});
|
||||||
|
|
||||||
crt_post.depth_img = sg_make_image(&(sg_image_desc){
|
crt_post.depth_img = sg_make_image(&(sg_image_desc){
|
||||||
.render_target = true,
|
.render_target = true,
|
||||||
.width = 1200,
|
.width = mainwin.width,
|
||||||
.height = 720,
|
.height = mainwin.height,
|
||||||
.pixel_format = SG_PIXELFORMAT_DEPTH_STENCIL
|
.pixel_format = SG_PIXELFORMAT_DEPTH_STENCIL
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -387,6 +387,5 @@ sg_shader sg_compile_shader(const char *v, const char *f, sg_shader_desc *d)
|
||||||
sg_shader ret = sg_make_shader(d);
|
sg_shader ret = sg_make_shader(d);
|
||||||
free(vs);
|
free(vs);
|
||||||
free(fs);
|
free(fs);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ static sg_blend_state blend_trans = {
|
||||||
.src_factor_rgb = SG_BLENDFACTOR_SRC_ALPHA,
|
.src_factor_rgb = SG_BLENDFACTOR_SRC_ALPHA,
|
||||||
.dst_factor_rgb = SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
|
.dst_factor_rgb = SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
|
||||||
.src_factor_alpha = SG_BLENDFACTOR_SRC_ALPHA,
|
.src_factor_alpha = SG_BLENDFACTOR_SRC_ALPHA,
|
||||||
.src_factor_alpha = SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA
|
.dst_factor_alpha = SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -89,7 +89,7 @@ static int ext_check(const char *path, const struct stat *sb, int typeflag) {
|
||||||
void fill_extensions(char *paths, const char *path, const char *ext) {
|
void fill_extensions(char *paths, const char *path, const char *ext) {
|
||||||
cur_ext = ext;
|
cur_ext = ext;
|
||||||
arrfree(paths);
|
arrfree(paths);
|
||||||
nftw(".", ext_check, 10, 0);
|
ftw(".", ext_check, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
void findPrefabs() {
|
void findPrefabs() {
|
||||||
|
|
|
@ -29,72 +29,6 @@ struct shader *MakeShader(const char *vertpath, const char *fragpath) {
|
||||||
return &arrlast(shaders);
|
return &arrlast(shaders);
|
||||||
}
|
}
|
||||||
|
|
||||||
int shader_compile_error(int shader) {
|
|
||||||
/*
|
|
||||||
GLint success = 0;
|
|
||||||
GLchar infoLog[ERROR_BUFFER] = { '\0' };
|
|
||||||
|
|
||||||
glGetShaderiv(shader, GL_COMPILE_STATUS, &success);
|
|
||||||
if (success) return 0;
|
|
||||||
|
|
||||||
glGetShaderInfoLog(shader, ERROR_BUFFER, NULL, infoLog);
|
|
||||||
YughLog(0, LOG_ERROR, "Shader compilation error.\nLog: %s", infoLog);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
int shader_link_error(int shader) {
|
|
||||||
/*
|
|
||||||
GLint success = 0;
|
|
||||||
GLchar infoLog[ERROR_BUFFER] = { '\0' };
|
|
||||||
|
|
||||||
glGetProgramiv(shader, GL_LINK_STATUS, &success);
|
|
||||||
if (success) return 0;
|
|
||||||
|
|
||||||
glGetProgramInfoLog(shader, ERROR_BUFFER, NULL, infoLog);
|
|
||||||
YughLog(0, LOG_ERROR, "Shader link error.\nLog: %s", infoLog);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
int load_shader_from_file(const char *path, int type) {
|
|
||||||
char spath[MAXPATH] = {'\0'};
|
|
||||||
|
|
||||||
sprintf(spath, "%s%s", "shaders/", path);
|
|
||||||
FILE *f = fopen(make_path(spath), "r'");
|
|
||||||
if (!path)
|
|
||||||
perror(spath), exit(1);
|
|
||||||
|
|
||||||
char *buf;
|
|
||||||
long int fsize;
|
|
||||||
fseek(f, 0, SEEK_END);
|
|
||||||
fsize = ftell(f);
|
|
||||||
buf = malloc(fsize + 1);
|
|
||||||
rewind(f);
|
|
||||||
size_t r = fread(buf, sizeof(char), fsize, f);
|
|
||||||
buf[r] = '\0';
|
|
||||||
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
/*
|
|
||||||
GLuint id = glCreateShader(type);
|
|
||||||
const char *code = buf;
|
|
||||||
glShaderSource(id, 1, &code, NULL);
|
|
||||||
glCompileShader(id);
|
|
||||||
if (shader_compile_error(id)) {
|
|
||||||
YughError("Error with shader %s.", path);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
free(buf);
|
|
||||||
|
|
||||||
|
|
||||||
return id;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void shader_compile(struct shader *shader) {
|
void shader_compile(struct shader *shader) {
|
||||||
YughInfo("Making shader with %s and %s.", shader->vertpath, shader->fragpath);
|
YughInfo("Making shader with %s and %s.", shader->vertpath, shader->fragpath);
|
||||||
char spath[MAXPATH];
|
char spath[MAXPATH];
|
||||||
|
@ -113,10 +47,6 @@ void shader_compile(struct shader *shader) {
|
||||||
free(fsrc);
|
free(fsrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void shader_use(struct shader *shader) {
|
|
||||||
// glUseProgram(shader->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void shader_compile_all() {
|
void shader_compile_all() {
|
||||||
for (int i = 0; i < arrlen(shaders); i++)
|
for (int i = 0; i < arrlen(shaders); i++)
|
||||||
shader_compile(&shaders[i]);
|
shader_compile(&shaders[i]);
|
||||||
|
|
|
@ -12,5 +12,4 @@ struct shader {
|
||||||
void shader_compile_all();
|
void shader_compile_all();
|
||||||
struct shader *MakeShader(const char *vertpath, const char *fragpath);
|
struct shader *MakeShader(const char *vertpath, const char *fragpath);
|
||||||
void shader_compile(struct shader *shader);
|
void shader_compile(struct shader *shader);
|
||||||
void shader_use(struct shader *shader);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "samplerate.h"
|
#include "samplerate.h"
|
||||||
|
|
||||||
#include "stb_ds.h"
|
#include "stb_ds.h"
|
||||||
|
|
|
@ -125,7 +125,7 @@ struct wav gen_triangle(float amp, float freq, int sr, int ch)
|
||||||
soundbyte *data = (soundbyte*)new.data;
|
soundbyte *data = (soundbyte*)new.data;
|
||||||
|
|
||||||
for (int i = 0; i < new.frames; i++) {
|
for (int i = 0; i < new.frames; i++) {
|
||||||
soundbyte val = 2 * abs( (i/new.frames) - floor( (i/new.frames) + 0.5));
|
soundbyte val = 2 * fabsf( (i/new.frames) - floor( (i/new.frames) + 0.5));
|
||||||
for (int j = 0; j < new.ch; j++) {
|
for (int j = 0; j < new.ch; j++) {
|
||||||
data[i+j] = val;
|
data[i+j] = val;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define DSP_H
|
#define DSP_H
|
||||||
|
|
||||||
#define SAMPLERATE 44100
|
#define SAMPLERATE 44100
|
||||||
#define BUF_FRAMES 128 /* At 48k, 128 needed for 240fps consistency */
|
#define BUF_FRAMES 2048 /* At 48k, 128 needed for 240fps consistency */
|
||||||
#define CHANNELS 2
|
#define CHANNELS 2
|
||||||
|
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
|
|
24
source/engine/thirdparty/Nuklear/doc/Makefile
vendored
24
source/engine/thirdparty/Nuklear/doc/Makefile
vendored
|
@ -1,24 +0,0 @@
|
||||||
# Install
|
|
||||||
BIN = doc
|
|
||||||
|
|
||||||
# Flags
|
|
||||||
CFLAGS += -std=c99 -pedantic -O2
|
|
||||||
|
|
||||||
SRC = stddoc.c
|
|
||||||
OBJ = $(SRC:.c=.o)
|
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT)
|
|
||||||
BIN := $(BIN).exe
|
|
||||||
LIBS =
|
|
||||||
else
|
|
||||||
UNAME_S := $(shell uname -s)
|
|
||||||
ifeq ($(UNAME_S),Darwin)
|
|
||||||
LIBS =
|
|
||||||
else
|
|
||||||
LIBS =
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(BIN):
|
|
||||||
rm -f $(BIN) $(OBJS)
|
|
||||||
$(CC) $(SRC) $(CFLAGS) -o $(BIN)
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
cat ../nuklear.h|./doc > index.html
|
|
2671
source/engine/thirdparty/Nuklear/doc/index.html
vendored
2671
source/engine/thirdparty/Nuklear/doc/index.html
vendored
File diff suppressed because it is too large
Load diff
|
@ -1,11 +0,0 @@
|
||||||
<!--
|
|
||||||
This page is here in order to allow redirecting the old nuklear.html URL over to index.html
|
|
||||||
-->
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0; URL=index.html" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>If you are not redirected in five seconds, <a href="index.html">click here</a>.</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
141
source/engine/thirdparty/Nuklear/doc/stddoc.c
vendored
141
source/engine/thirdparty/Nuklear/doc/stddoc.c
vendored
|
@ -1,141 +0,0 @@
|
||||||
/// ## About
|
|
||||||
/// - _stddoc.c_ is a tiny documentation generator for 60 programming languages.
|
|
||||||
/// - This page sample was auto-generated from the code comments found in `stddoc.c` file.
|
|
||||||
///
|
|
||||||
/// ## How does it work?
|
|
||||||
/// - Markdeep code comments are extracted from stdin and printed into stdout as a HTML file.
|
|
||||||
///
|
|
||||||
/// ## Supported languages
|
|
||||||
/// - `/// Three slashes comment` [ActionScript, AngelScript, C (C99), C#, C++, ChaiScript, D,
|
|
||||||
/// GameMonkey, GML, Go, Java, JavaScript, JetScript, jtc, Jx9, Kotlin, Neko, Object Pascal (Delphi),
|
|
||||||
/// Objective-C, Pawn, PHP, QuakeC, Rust, SASS, Scala, Squirrel, Swift, Vala, Wren, Xojo].
|
|
||||||
/// - `--- Three dashes comment` [Ada, AppleScript, Eiffel, Euphoria, Haskell, Lua, Occam,
|
|
||||||
/// PL/SQL, PSL, SGML, SPARK, SQL, Terra, TSQL, VHDL].
|
|
||||||
/// - `### Three hashes comment` [AWK, Bash, Bourne shell, C shell, Cobra, Maple, Maple,
|
|
||||||
/// Perl, Perl6, PowerShell, Python, R, Ruby, Seed7, Tcl].
|
|
||||||
///
|
|
||||||
/// ## Usage
|
|
||||||
/// - `stddoc < source.code > documentation.html`
|
|
||||||
///
|
|
||||||
/// ## Changelog
|
|
||||||
/// 2018/01/07
|
|
||||||
/// : Initial version (_v1.0.0_)
|
|
||||||
///
|
|
||||||
/// ## License
|
|
||||||
/// - rlyeh, unlicensed (~public domain).
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
printf("%s\n", "<meta charset='utf-8' emacsmode='-*- markdown -*-'>");
|
|
||||||
printf("%s\n", "<link rel='stylesheet' href='https://casual-effects.com/markdeep/latest/apidoc.css?'>");
|
|
||||||
|
|
||||||
for( int fsm_S = 0, fsm_D = 0, fsm_H = 0; !feof(stdin); ) {
|
|
||||||
int chr = getc(stdin);
|
|
||||||
if( fsm_S > 3 || fsm_D > 3 || fsm_H > 3 ) {
|
|
||||||
putc(chr, stdout);
|
|
||||||
if( chr != '\r' && chr != '\n' ) continue;
|
|
||||||
}
|
|
||||||
/**/ if( fsm_S <= 2 && chr == '/' && !fsm_D && !fsm_H ) fsm_S++;
|
|
||||||
else if( fsm_S == 3 && chr == ' ' && !fsm_D && !fsm_H ) fsm_S++;
|
|
||||||
else if( fsm_D <= 2 && chr == '-' && !fsm_S && !fsm_H ) fsm_D++;
|
|
||||||
else if( fsm_D == 3 && chr == ' ' && !fsm_S && !fsm_H ) fsm_D++;
|
|
||||||
else if( fsm_H <= 2 && chr == '#' && !fsm_S && !fsm_D ) fsm_H++;
|
|
||||||
else if( fsm_H == 3 && chr == ' ' && !fsm_S && !fsm_D ) fsm_H++;
|
|
||||||
else fsm_S = fsm_D = fsm_H = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("%s\n", "<script>markdeepOptions={tocStyle:'medium'};</script>");
|
|
||||||
printf("%s\n", "<!-- Markdeep: --><script src='https://casual-effects.com/markdeep/latest/markdeep.min.js?'></script>");
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
|
||||||
/// ## **Example page!**
|
|
||||||
///
|
|
||||||
/// Imaginary documentation page. Here would be some introduction text.
|
|
||||||
///
|
|
||||||
/// The table of contents that Markdeep produces is stuffed on the right side,
|
|
||||||
/// if the browser window is wide enough. Otherwise it is hidden.
|
|
||||||
///
|
|
||||||
/// ### Basic Markdeep
|
|
||||||
///
|
|
||||||
/// Regular styling like **bold**, _italics_, ~~strikethrough~~, `inline code`, etc. Lists as:
|
|
||||||
///
|
|
||||||
/// * A
|
|
||||||
/// * Bullet
|
|
||||||
/// * List
|
|
||||||
///
|
|
||||||
/// And:
|
|
||||||
///
|
|
||||||
/// 1. A
|
|
||||||
/// 1. Numbered
|
|
||||||
/// 1. List!
|
|
||||||
///
|
|
||||||
/// Symbol substitutions: a 45-degree turn; some x -> y arrows; some whoa ==> fancy <==> arrows.
|
|
||||||
///
|
|
||||||
/// Is this a definition list?
|
|
||||||
/// : Looks like one to me
|
|
||||||
/// Is that right?
|
|
||||||
/// : Possibly!
|
|
||||||
///
|
|
||||||
/// And a code listing:
|
|
||||||
///
|
|
||||||
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
/// int main()
|
|
||||||
/// {
|
|
||||||
/// return 1;
|
|
||||||
/// }
|
|
||||||
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
///
|
|
||||||
///
|
|
||||||
/// ### Tables
|
|
||||||
///
|
|
||||||
/// Thing Name | Description |Notes
|
|
||||||
/// ------------------------|--------------------|-----
|
|
||||||
/// Yes | Yup! |
|
|
||||||
/// No | Nope :( |
|
|
||||||
/// FileNotFound | Doesn't find files | Pass `-sFIND_FILE=maybe` to maybe find them
|
|
||||||
///
|
|
||||||
///
|
|
||||||
/// ### Diagrams
|
|
||||||
///
|
|
||||||
/// ******************************************* Here's a text to the right of the diagram,
|
|
||||||
/// * +-----------------+ .-. * ain't that fancy. Pretty fancy indeed, I
|
|
||||||
/// * |\ | .-+ | * must say! Markdeep diagrams are generally
|
|
||||||
/// * | \ A-B *---+--> .--+ '--. * enclosed into a rectangle full made of `*`
|
|
||||||
/// * | \ | | Cloud! | * symbols; and are "drawn" using ASCII-art
|
|
||||||
/// * +---+-------------+ '-------------' * style, with `- | + / \ * o` etc.
|
|
||||||
/// ******************************************* Suh-weet!
|
|
||||||
///
|
|
||||||
/// Another random diagram, just because:
|
|
||||||
///
|
|
||||||
/// ********************
|
|
||||||
/// * +-+-+-+-*-o *
|
|
||||||
/// * / / ^ / *
|
|
||||||
/// * / v / / *
|
|
||||||
/// * +-+-+-+ *
|
|
||||||
/// ********************
|
|
||||||
///
|
|
||||||
/// ### Special notes
|
|
||||||
///
|
|
||||||
/// !!! Note
|
|
||||||
/// Hey I'm a note. Don't mind me, I'm just sitting here.
|
|
||||||
///
|
|
||||||
/// !!! WARNING
|
|
||||||
/// I'm a warning, perhaps. *Something might happen!*
|
|
||||||
///
|
|
||||||
/// !!! Error: Never Pass `nullptr` to a Shader
|
|
||||||
/// Invoking a shader with a null argument can seg fault.
|
|
||||||
/// This is a multi-line admonition.
|
|
||||||
///
|
|
||||||
/// Seriously, don't call shaders like that.
|
|
||||||
///
|
|
||||||
/// ### Embedding HTML
|
|
||||||
///
|
|
||||||
/// <pre>
|
|
||||||
/// This is an embedded html node by the way!
|
|
||||||
/// </pre>
|
|
||||||
///
|
|
||||||
/// ## Credits
|
|
||||||
/// - API doc style created by [Aras Pranckevičius](https://github.com/aras-p)
|
|
||||||
/// - Markdeep by [Morgan McGuire](https://casual-effects.com/markdeep/).
|
|
|
@ -36,7 +36,7 @@
|
||||||
#define SOKOL_TRACE_HOOKS
|
#define SOKOL_TRACE_HOOKS
|
||||||
#define SOKOL_IMPL
|
#define SOKOL_IMPL
|
||||||
|
|
||||||
#if defined __GLIBC__
|
#if defined __linux__
|
||||||
#define SOKOL_GLCORE33
|
#define SOKOL_GLCORE33
|
||||||
#elif __EMSCRIPTEN__
|
#elif __EMSCRIPTEN__
|
||||||
#define SOKOL_GLES3
|
#define SOKOL_GLES3
|
||||||
|
@ -84,7 +84,6 @@ double renderMS = 1 / 165.f;
|
||||||
double physMS = 1 / 165.f;
|
double physMS = 1 / 165.f;
|
||||||
double updateMS = 1 / 165.f;
|
double updateMS = 1 / 165.f;
|
||||||
|
|
||||||
|
|
||||||
static int phys_step = 0;
|
static int phys_step = 0;
|
||||||
|
|
||||||
double appTime = 0;
|
double appTime = 0;
|
||||||
|
@ -146,7 +145,7 @@ void seghandle(int sig) {
|
||||||
|
|
||||||
const char *engine_info()
|
const char *engine_info()
|
||||||
{
|
{
|
||||||
char str[100];
|
static char str[100];
|
||||||
snprintf(str, 100, "Yugine version %s, %s build.\nCopyright 2022-2023 odplot productions LLC.\n", VER, INFO);
|
snprintf(str, 100, "Yugine version %s, %s build.\nCopyright 2022-2023 odplot productions LLC.\n", VER, INFO);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -353,9 +352,12 @@ sapp_desc sokol_main(int sargc, char **sargs) {
|
||||||
|
|
||||||
script_startup();
|
script_startup();
|
||||||
|
|
||||||
|
mainwin.width = 1200;
|
||||||
|
mainwin.height = 700;
|
||||||
|
|
||||||
return (sapp_desc){
|
return (sapp_desc){
|
||||||
.width = 720,
|
.width = mainwin.width,
|
||||||
.height = 480,
|
.height = mainwin.height,
|
||||||
.high_dpi = 0,
|
.high_dpi = 0,
|
||||||
.sample_count = 8,
|
.sample_count = 8,
|
||||||
.fullscreen = 0,
|
.fullscreen = 0,
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
var required_files = ["proto.json"];
|
var required_files = ["proto.json"];
|
||||||
|
|
||||||
required_files.forEach(x => {
|
required_files.forEach(x => {
|
||||||
if (!IO.exists(x)) slurpwrite("", x);
|
if (!IO.exists(x)) IO.slurpwrite("", x);
|
||||||
});
|
});
|
||||||
|
|
||||||
var editor_level = Level.create();
|
var editor_level = Level.create();
|
||||||
|
|
Loading…
Reference in a new issue