Use CC for general compiling; get rid of more printfs; display opengl version on load
This commit is contained in:
parent
29c001e7df
commit
a0f016a011
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,6 +1,8 @@
|
||||||
|
.git/
|
||||||
bin/
|
bin/
|
||||||
build/
|
build/
|
||||||
*.o
|
*.o
|
||||||
*.a
|
*.a
|
||||||
engine
|
engine
|
||||||
tags
|
tags
|
||||||
|
Jenkinsfile
|
||||||
|
|
47
Makefile
47
Makefile
|
@ -11,7 +11,7 @@ UNAME_P != uname -m
|
||||||
|
|
||||||
CCACHE = ccache
|
CCACHE = ccache
|
||||||
|
|
||||||
CC = $(CCACHE) clang
|
CC = $(CCACHE) cc
|
||||||
|
|
||||||
ifeq ($(DEBUG), 1)
|
ifeq ($(DEBUG), 1)
|
||||||
DEFFALGS += -DDEBUG
|
DEFFALGS += -DDEBUG
|
||||||
|
@ -44,15 +44,15 @@ define findindir
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# All other sources
|
# All other sources
|
||||||
edirs != find ./source/engine -type d -name include
|
edirs != find ./source -type d -name include
|
||||||
edirs += ./source/engine
|
edirs += ./source/engine
|
||||||
ehead != $(call findindir,./source/engine,*.h)
|
ehead != $(call findindir,./source/engine,*.h)
|
||||||
eobjects != $(call make_objs, ./source/engine)
|
eobjects != $(call make_objs, ./source/engine)
|
||||||
eobjects != $(call rm,$(eobjects),sqlite pl_mpeg_extract_frames pl_mpeg_player yugine nuklear)
|
eobjects != $(call rm,$(eobjects),sqlite pl_mpeg_extract_frames pl_mpeg_player yugine nuklear)
|
||||||
|
|
||||||
edirs += ./source/engine/thirdparty/Chipmunk2D/include ./source/engine/thirdparty/enet/include ./source/engine/thirdparty/Nuklear
|
edirs += ./source/engine/thirdparty/Chipmunk2D/include ./source/engine/thirdparty/enet/include ./source/engine/thirdparty/Nuklear
|
||||||
includeflag != $(call prefix,$(edirs) $(eddirs),-I)
|
includeflag != $(call prefix,$(edirs),-I)
|
||||||
COMPINCLUDE = $(edirs) $(eddirs)
|
COMPINCLUDE = $(edirs)
|
||||||
|
|
||||||
WARNING_FLAGS = -Wno-everything #-Wno-incompatible-function-pointer-types -Wall -Wwrite-strings -Wunsupported -Wall -Wextra -Wwrite-strings -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -Wno-incompatible-function-pointer-types -Wno-gnu-statement-expression -Wno-complex-component-init -pedantic
|
WARNING_FLAGS = -Wno-everything #-Wno-incompatible-function-pointer-types -Wall -Wwrite-strings -Wunsupported -Wall -Wextra -Wwrite-strings -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -Wno-incompatible-function-pointer-types -Wno-gnu-statement-expression -Wno-complex-component-init -pedantic
|
||||||
|
|
||||||
|
@ -63,22 +63,22 @@ LIBPATH = -L./bin -L/usr/local/lib
|
||||||
ALLFILES != find source/ -name '*.[ch]' -type f
|
ALLFILES != find source/ -name '*.[ch]' -type f
|
||||||
|
|
||||||
ifeq ($(UNAME), Windows_NT)
|
ifeq ($(UNAME), Windows_NT)
|
||||||
LINKER_FLAGS = -static -DSDL_MAIN_HANDLED
|
LINKER_FLAGS = -DSDL_MAIN_HANDLED
|
||||||
ELIBS = engine editor mingw32 SDL2main SDL2 m dinput8 dxguid dxerr8 user32 gdi32 winmm imm32 ole32 oleaut32 shell32 version uuid setupapi opengl32 stdc++ winpthread
|
ELIBS = engine editor mingw32 SDL2main SDL2 m dinput8 dxguid dxerr8 user32 gdi32 winmm imm32 ole32 oleaut32 shell32 version uuid setupapi opengl32 stdc++ winpthread
|
||||||
ELIBS += SDL2_mixer FLAC vorbis vorbisenc vorbisfile mpg123 out123 syn123 opus opusurl opusfile ogg ssp shlwapi
|
ELIBS += SDL2_mixer FLAC vorbis vorbisenc vorbisfile mpg123 out123 syn123 opus opusurl opusfile ogg ssp shlwapi
|
||||||
CLIBS = glew32
|
CLIBS = glew32
|
||||||
EXT = .exe
|
EXT = .exe
|
||||||
else
|
else
|
||||||
LINKER_FLAGS = -g
|
LINKER_FLAGS = -g
|
||||||
ELIBS = engine glfw3 pthread yughc mruby portaudio m
|
ELIBS = engine glfw3 pthread yughc mruby portaudio asound c m dl
|
||||||
CLIBS = asound jack c
|
CLIBS =
|
||||||
EXT =
|
EXT =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CLIBS != $(call prefix, $(CLIBS), -l)
|
CLIBS != $(call prefix, $(CLIBS), -l)
|
||||||
ELIBS != $(call prefix, $(ELIBS), -l)
|
ELIBS != $(call prefix, $(ELIBS), -l)
|
||||||
|
|
||||||
LELIBS = -Wl,-Bdynamic $(ELIBS) -Wl,-Bdynamic $(CLIBS)
|
LELIBS = $(ELIBS)
|
||||||
|
|
||||||
objects = $(eobjects)
|
objects = $(eobjects)
|
||||||
DEPENDS = $(objects:.o=.d)
|
DEPENDS = $(objects:.o=.d)
|
||||||
|
@ -91,22 +91,23 @@ INCLUDE = $(BIN)include
|
||||||
|
|
||||||
LINK = $(LIBPATH) $(LINKER_FLAGS) $(LELIBS)
|
LINK = $(LIBPATH) $(LINKER_FLAGS) $(LELIBS)
|
||||||
|
|
||||||
engine: $(yuginec:.%.c=$(objprefix)%.o) $(ENGINE) tags $(BIN)libportaudio.a $(BIN)libglfw3.a
|
.PHONY: yugine
|
||||||
@echo Linking engine
|
|
||||||
$(CC) $< $(LINK) -o $@
|
yugine: $(yuginec:.%.c=$(objprefix)%.o) $(ENGINE) $(BIN)libportaudio.a $(BIN)libglfw3.a
|
||||||
|
@echo Linking yugine
|
||||||
|
$(CC) $< $(LINK) -o yugine
|
||||||
@echo Finished build
|
@echo Finished build
|
||||||
|
|
||||||
bs: engine
|
install: yugine
|
||||||
cp engine brainstorm
|
cp yugine ~/.local/bin
|
||||||
|
|
||||||
pin: engine
|
pin: yugine
|
||||||
cp -rf source/shaders pinball
|
cp yugine pinball
|
||||||
cp -rf assets/fonts pinball
|
mkdir -p pinball/fonts pinball/scripts pinball/shaders
|
||||||
cp -f assets/scripts/* pinball/scripts
|
cp -f assets/fonts/* pinball/fonts
|
||||||
cp engine pinball
|
cp -f source/scripts/* pinball/scripts
|
||||||
|
cp -rf source/shaders/* pinball/shaders
|
||||||
pal: engine
|
|
||||||
cp engine paladin
|
|
||||||
|
|
||||||
$(ENGINE): $(eobjects)
|
$(ENGINE): $(eobjects)
|
||||||
@echo Making library engine.a
|
@echo Making library engine.a
|
||||||
|
@ -138,10 +139,6 @@ $(objprefix)/%.o:%.c
|
||||||
@echo Making C object $@
|
@echo Making C object $@
|
||||||
@$(CC) $(COMPILER_FLAGS)
|
@$(CC) $(COMPILER_FLAGS)
|
||||||
|
|
||||||
tags: $(ALLFILES)
|
|
||||||
@echo Making tags
|
|
||||||
@ctags -x -R source > tags
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo Cleaning project
|
@echo Cleaning project
|
||||||
@find $(BIN) -type f -delete
|
@find $(BIN) -type f -delete
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
class Method
|
|
||||||
def source(n=5)
|
|
||||||
loc = source_location
|
|
||||||
puts `sed -n "#{loc[1]},#{loc[1]+n}p;#{loc[1]+6}q" #{loc[0]}`
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class Music
|
|
||||||
|
|
||||||
def initialize(mpath = "")
|
|
||||||
load(mpath);
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
def load(mpath)
|
|
||||||
#@music = load(path);
|
|
||||||
end
|
|
||||||
|
|
||||||
def play
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class Sound
|
|
||||||
def initialize(path = "")
|
|
||||||
load(path);
|
|
||||||
end
|
|
||||||
|
|
||||||
def load(path)
|
|
||||||
#@sound =
|
|
||||||
end
|
|
||||||
|
|
||||||
def play
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def checknewer
|
|
||||||
$maketimes ||= {}
|
|
||||||
file = caller[0].split(":")[0]
|
|
||||||
if $maketimes[file].nil?
|
|
||||||
$maketimes[file] = `stat --printf '%Y' #{file}`
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
newtime = `stat --printf '%Y' #{file}`
|
|
||||||
if newtime > $maketimes[file]
|
|
||||||
load(file)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_renderms(val)
|
|
||||||
settings_cmd(0, val);
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_updatems(val)
|
|
||||||
settings_cmd(1, val);
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_physms(val)
|
|
||||||
settings_cmd(2, val);
|
|
||||||
end
|
|
|
@ -50,7 +50,8 @@ void engine_init()
|
||||||
glfwSetErrorCallback(error_callback);
|
glfwSetErrorCallback(error_callback);
|
||||||
/* Initialize GLFW */
|
/* Initialize GLFW */
|
||||||
if (!glfwInit()) {
|
if (!glfwInit()) {
|
||||||
printf("Could not init GLFW\n");
|
YughError("Could not init GLFW. Exiting.");
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef RENDER_H
|
#ifndef RENDER_H
|
||||||
#define RENDER_H
|
#define RENDER_H
|
||||||
|
|
||||||
|
#define GLFW_INCLUDE_NONE
|
||||||
#include <glad/gl.h>
|
#include <glad/gl.h>
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include <GLFW/glfw3.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <stb_ds.h>;
|
#include <stb_ds.h>;
|
||||||
|
@ -100,4 +99,4 @@ void arrwalk(void *arr, void (*fn)(void *data))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < arrlen(arr); i++)
|
for (int i = 0; i < arrlen(arr); i++)
|
||||||
fn(&arr[i]);
|
fn(&arr[i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,12 @@ struct window *MakeSDLWindow(const char *name, int width, int height, uint32_t f
|
||||||
}
|
}
|
||||||
|
|
||||||
glfwMakeContextCurrent(w.window);
|
glfwMakeContextCurrent(w.window);
|
||||||
gladLoadGL(glfwGetProcAddress);
|
int version = gladLoadGL(glfwGetProcAddress);
|
||||||
|
if (!version) {
|
||||||
|
YughError("Failed to initialize OpenGL context.");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
YughInfo("Loaded OpenGL %d.%d", GLAD_VERSION_MAJOR(version), GLAD_VERSION_MINOR(version));
|
||||||
glfwSwapInterval(1);
|
glfwSwapInterval(1);
|
||||||
|
|
||||||
// Set callbacks
|
// Set callbacks
|
||||||
|
|
|
@ -1,28 +1,62 @@
|
||||||
class Component
|
class Method
|
||||||
|
def source(n=5)
|
||||||
|
loc = source_location
|
||||||
|
puts `sed -n "#{loc[1]},#{loc[1]+n}p;#{loc[1]+6}q" #{loc[0]}`
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Sprite
|
class Music
|
||||||
|
|
||||||
|
def initialize(mpath = "")
|
||||||
|
load(mpath);
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def load(mpath)
|
||||||
|
#@music = load(path);
|
||||||
|
end
|
||||||
|
|
||||||
|
def play
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class CircleCollider2D
|
class Sound
|
||||||
|
def initialize(path = "")
|
||||||
|
load(path);
|
||||||
|
end
|
||||||
|
|
||||||
|
def load(path)
|
||||||
|
#@sound =
|
||||||
|
end
|
||||||
|
|
||||||
|
def play
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Segment2D
|
def checknewer
|
||||||
|
$maketimes ||= {}
|
||||||
|
file = caller[0].split(":")[0]
|
||||||
|
if $maketimes[file].nil?
|
||||||
|
$maketimes[file] = `stat --printf '%Y' #{file}`
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
newtime = `stat --printf '%Y' #{file}`
|
||||||
|
if newtime > $maketimes[file]
|
||||||
|
load(file)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Box2D
|
def set_renderms(val)
|
||||||
|
settings_cmd(0, val);
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class Polygon2D
|
def set_updatems(val)
|
||||||
|
settings_cmd(1, val);
|
||||||
end
|
end
|
||||||
|
|
||||||
class Edge2D
|
def set_physms(val)
|
||||||
|
settings_cmd(2, val);
|
||||||
end
|
end
|
Loading…
Reference in a new issue