pinballx
This commit is contained in:
parent
b0d2757f70
commit
28c69ff62f
8
Makefile
8
Makefile
|
@ -89,18 +89,18 @@ yuginec = ./source/engine/yugine.c
|
|||
ENGINE = $(BIN)libengine.a
|
||||
INCLUDE = $(BIN)include
|
||||
|
||||
LINK = $(LIBPATH) $(LINKER_FLAGS) $(LELIBS) -o $@
|
||||
LINK = $(LIBPATH) $(LINKER_FLAGS) $(LELIBS)
|
||||
|
||||
engine: $(yuginec:.%.c=$(objprefix)%.o) $(ENGINE)
|
||||
@echo Linking engine
|
||||
$(CLINK) $< $(LINK)
|
||||
$(CLINK) $< $(LINK) -o $@
|
||||
@echo Finished build
|
||||
|
||||
bs: engine
|
||||
cp engine brainstorm
|
||||
|
||||
ed: engine
|
||||
cp engine editor
|
||||
pin: engine
|
||||
cp engine pinball
|
||||
|
||||
$(ENGINE): $(eobjects) bin/libglfw3.a
|
||||
@echo Making library engine.a
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
window = win_make("editor")
|
||||
nuke_cb(window, :editor)
|
||||
|
||||
def editor
|
||||
editor_render()
|
||||
end
|
||||
|
||||
def update(dt)
|
||||
|
||||
end
|
601
source/engine/editor.c
Executable file → Normal file
601
source/engine/editor.c
Executable file → Normal file
File diff suppressed because it is too large
Load diff
|
@ -31,10 +31,13 @@ struct editorVars {
|
|||
bool showLevel;
|
||||
};
|
||||
|
||||
struct gameproject {
|
||||
char name[127];
|
||||
char path[MAXPATH];
|
||||
};
|
||||
struct vec;
|
||||
struct gameproject;
|
||||
struct mSprite;
|
||||
|
||||
extern struct gameproject *cur_project;
|
||||
extern struct vec *projects;
|
||||
|
||||
|
||||
struct Texture;
|
||||
struct mSDLWindow;
|
||||
|
@ -51,13 +54,6 @@ void editor_makenewobject();
|
|||
|
||||
void editor_project_gui();
|
||||
|
||||
void editor_init_project(struct gameproject *gp);
|
||||
void editor_save_projects();
|
||||
void editor_load_projects();
|
||||
void editor_proj_select_gui();
|
||||
void editor_import_project(char *path);
|
||||
void editor_make_project(char *path);
|
||||
|
||||
void editor_selectasset(struct fileasset *asset);
|
||||
void editor_selectasset_str(char *path);
|
||||
void editor_asset_gui(struct fileasset *asset);
|
||||
|
|
|
@ -40,7 +40,7 @@ void font_init(struct mShader *textshader) {
|
|||
|
||||
|
||||
// Default font
|
||||
font = MakeFont("notosans.ttf", 300);
|
||||
font = MakeFont("teenytinypixels.ttf", 300);
|
||||
}
|
||||
|
||||
void font_frame(struct mSDLWindow *w) {
|
||||
|
|
|
@ -39,7 +39,6 @@ void nuke_start()
|
|||
|
||||
void nuke_end()
|
||||
{
|
||||
nk_end(ctx);
|
||||
nk_glfw3_render(&nkglfw, NK_ANTI_ALIASING_ON, MAX_VERTEX_BUFFER, MAX_ELEMENT_BUFFER);
|
||||
}
|
||||
|
||||
|
|
|
@ -93,31 +93,6 @@ struct mSprite *tsprite = NULL;
|
|||
|
||||
static unsigned int projUBO;
|
||||
|
||||
const char *textvert =
|
||||
"#version 330 core\n"
|
||||
"layout (location = 0) in vec4 vertex; \n"
|
||||
"out vec2 TexCoords;\n"
|
||||
|
||||
"uniform mat4 projection;\n"
|
||||
|
||||
"void main() {\n"
|
||||
" gl_Position = projection * vec4(vertex.xy, 0.0, 1.0);\n"
|
||||
" TexCoords = vec2(vertex.z, 1.0 - vertex.w);\n"
|
||||
"}\n";
|
||||
|
||||
const char *textfrag =
|
||||
"#version 330 core\n"
|
||||
"in vec2 TexCoords;\n"
|
||||
"out vec4 color;\n"
|
||||
|
||||
"uniform sampler2D text;\n"
|
||||
"uniform vec3 textColor;\n"
|
||||
|
||||
"void main() { \n"
|
||||
" vec4 sampled = vec4(1.0, 1.0, 1.0, texture(text, TexCoords).r);\n"
|
||||
" color = vec4(textColor, 1.0) * sampled;\n"
|
||||
"}\n";
|
||||
|
||||
void openglInit()
|
||||
{
|
||||
if (!mainwin) {
|
||||
|
@ -126,11 +101,9 @@ void openglInit()
|
|||
}
|
||||
|
||||
////// MAKE SHADERS
|
||||
outlineShader = MakeShader("outlinevert.glsl", "outline.glsl");
|
||||
spriteShader = MakeShader("spritevert.glsl", "spritefrag.glsl");
|
||||
animSpriteShader = MakeShader("animspritevert.glsl", "animspritefrag.glsl");
|
||||
textShader = MakeShader("textvert.glsl", "textfrag.glsl");
|
||||
//textShader = CreateShader(textverg, textfrag);
|
||||
|
||||
shader_use(textShader);
|
||||
shader_setint(textShader, "text", 0);
|
||||
|
@ -139,7 +112,7 @@ void openglInit()
|
|||
|
||||
font_init(textShader);
|
||||
sprite_initialize();
|
||||
//debugdraw_init();
|
||||
debugdraw_init();
|
||||
|
||||
|
||||
//glEnable(GL_STENCIL_TEST);
|
||||
|
@ -168,8 +141,6 @@ void openglInit()
|
|||
shader_setUBO(spriteShader, "Projection", 0);
|
||||
shader_setUBO(textShader, "Projection", 0);
|
||||
shader_setUBO(animSpriteShader, "Projection", 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -272,7 +272,13 @@ void window_render(struct mSDLWindow *w) {
|
|||
nuke_start();
|
||||
script_call_sym(w->nuke_cb);
|
||||
nuke_end();
|
||||
} else if (w->nuke_gui != NULL) {
|
||||
nuke_start();
|
||||
w->nuke_gui();
|
||||
nuke_end();
|
||||
}
|
||||
|
||||
|
||||
window_swap(w);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ struct mSDLWindow {
|
|||
float projection[16];
|
||||
mrb_sym nuke_cb;
|
||||
mrb_sym gui_cb;
|
||||
void (*nuke_gui)();
|
||||
};
|
||||
|
||||
struct Texture;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include "input.h"
|
||||
#include "openglrender.h"
|
||||
|
||||
#include "string.h"
|
||||
|
||||
int physOn = 0;
|
||||
|
||||
double renderlag = 0;
|
||||
|
@ -15,13 +17,28 @@ double renderMS = 1/60.f;
|
|||
double physMS = 1/120.f;
|
||||
double updateMS = 1/60.f;
|
||||
|
||||
static int ed = 1;
|
||||
|
||||
|
||||
int main(int argc, char **args) {
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (args[i][0] == '-') {
|
||||
if (strncmp(args[i][1], "play", 4) == 0) {
|
||||
ed = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
engine_init();
|
||||
|
||||
window_set_icon("icon.png");
|
||||
|
||||
if (ed) {
|
||||
editor_init(MakeSDLWindow("Editor", 600, 600, 0));
|
||||
} else {
|
||||
script_dofile("game.rb");
|
||||
}
|
||||
|
||||
openglInit();
|
||||
|
||||
|
@ -45,7 +62,7 @@ int main(int argc, char **args) {
|
|||
|
||||
input_poll(updateMS - elapsed < 0 ? 0 : updateMS - elapsed);
|
||||
window_all_handle_events();
|
||||
script_update(updateMS);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue