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/
|
||||
build/
|
||||
*.o
|
||||
*.a
|
||||
engine
|
||||
tags
|
||||
Jenkinsfile
|
||||
|
|
45
Makefile
45
Makefile
|
@ -11,7 +11,7 @@ UNAME_P != uname -m
|
|||
|
||||
CCACHE = ccache
|
||||
|
||||
CC = $(CCACHE) clang
|
||||
CC = $(CCACHE) cc
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
DEFFALGS += -DDEBUG
|
||||
|
@ -44,15 +44,15 @@ define findindir
|
|||
endef
|
||||
|
||||
# All other sources
|
||||
edirs != find ./source/engine -type d -name include
|
||||
edirs != find ./source -type d -name include
|
||||
edirs += ./source/engine
|
||||
ehead != $(call findindir,./source/engine,*.h)
|
||||
eobjects != $(call make_objs, ./source/engine)
|
||||
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
|
||||
includeflag != $(call prefix,$(edirs) $(eddirs),-I)
|
||||
COMPINCLUDE = $(edirs) $(eddirs)
|
||||
includeflag != $(call prefix,$(edirs),-I)
|
||||
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
|
||||
|
||||
|
@ -63,22 +63,22 @@ LIBPATH = -L./bin -L/usr/local/lib
|
|||
ALLFILES != find source/ -name '*.[ch]' -type f
|
||||
|
||||
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 += SDL2_mixer FLAC vorbis vorbisenc vorbisfile mpg123 out123 syn123 opus opusurl opusfile ogg ssp shlwapi
|
||||
CLIBS = glew32
|
||||
EXT = .exe
|
||||
else
|
||||
LINKER_FLAGS = -g
|
||||
ELIBS = engine glfw3 pthread yughc mruby portaudio m
|
||||
CLIBS = asound jack c
|
||||
ELIBS = engine glfw3 pthread yughc mruby portaudio asound c m dl
|
||||
CLIBS =
|
||||
EXT =
|
||||
endif
|
||||
|
||||
CLIBS != $(call prefix, $(CLIBS), -l)
|
||||
ELIBS != $(call prefix, $(ELIBS), -l)
|
||||
|
||||
LELIBS = -Wl,-Bdynamic $(ELIBS) -Wl,-Bdynamic $(CLIBS)
|
||||
LELIBS = $(ELIBS)
|
||||
|
||||
objects = $(eobjects)
|
||||
DEPENDS = $(objects:.o=.d)
|
||||
|
@ -91,22 +91,23 @@ INCLUDE = $(BIN)include
|
|||
|
||||
LINK = $(LIBPATH) $(LINKER_FLAGS) $(LELIBS)
|
||||
|
||||
engine: $(yuginec:.%.c=$(objprefix)%.o) $(ENGINE) tags $(BIN)libportaudio.a $(BIN)libglfw3.a
|
||||
@echo Linking engine
|
||||
$(CC) $< $(LINK) -o $@
|
||||
.PHONY: yugine
|
||||
|
||||
yugine: $(yuginec:.%.c=$(objprefix)%.o) $(ENGINE) $(BIN)libportaudio.a $(BIN)libglfw3.a
|
||||
@echo Linking yugine
|
||||
$(CC) $< $(LINK) -o yugine
|
||||
@echo Finished build
|
||||
|
||||
bs: engine
|
||||
cp engine brainstorm
|
||||
install: yugine
|
||||
cp yugine ~/.local/bin
|
||||
|
||||
pin: engine
|
||||
cp -rf source/shaders pinball
|
||||
cp -rf assets/fonts pinball
|
||||
cp -f assets/scripts/* pinball/scripts
|
||||
cp engine pinball
|
||||
pin: yugine
|
||||
cp yugine pinball
|
||||
mkdir -p pinball/fonts pinball/scripts pinball/shaders
|
||||
cp -f assets/fonts/* pinball/fonts
|
||||
cp -f source/scripts/* pinball/scripts
|
||||
cp -rf source/shaders/* pinball/shaders
|
||||
|
||||
pal: engine
|
||||
cp engine paladin
|
||||
|
||||
$(ENGINE): $(eobjects)
|
||||
@echo Making library engine.a
|
||||
|
@ -138,10 +139,6 @@ $(objprefix)/%.o:%.c
|
|||
@echo Making C object $@
|
||||
@$(CC) $(COMPILER_FLAGS)
|
||||
|
||||
tags: $(ALLFILES)
|
||||
@echo Making tags
|
||||
@ctags -x -R source > tags
|
||||
|
||||
clean:
|
||||
@echo Cleaning project
|
||||
@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);
|
||||
/* Initialize GLFW */
|
||||
if (!glfwInit()) {
|
||||
printf("Could not init GLFW\n");
|
||||
YughError("Could not init GLFW. Exiting.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef RENDER_H
|
||||
#define RENDER_H
|
||||
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "timer.h"
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <stb_ds.h>;
|
||||
|
|
|
@ -89,7 +89,12 @@ struct window *MakeSDLWindow(const char *name, int width, int height, uint32_t f
|
|||
}
|
||||
|
||||
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);
|
||||
|
||||
// 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
|
||||
|
||||
class Sprite
|
||||
class Music
|
||||
|
||||
def initialize(mpath = "")
|
||||
load(mpath);
|
||||
end
|
||||
|
||||
|
||||
def load(mpath)
|
||||
#@music = load(path);
|
||||
end
|
||||
|
||||
def play
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
class CircleCollider2D
|
||||
class Sound
|
||||
def initialize(path = "")
|
||||
load(path);
|
||||
end
|
||||
|
||||
def load(path)
|
||||
#@sound =
|
||||
end
|
||||
|
||||
def play
|
||||
|
||||
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
|
||||
|
||||
class Box2D
|
||||
|
||||
|
||||
def set_renderms(val)
|
||||
settings_cmd(0, val);
|
||||
end
|
||||
|
||||
class Polygon2D
|
||||
|
||||
def set_updatems(val)
|
||||
settings_cmd(1, val);
|
||||
end
|
||||
|
||||
class Edge2D
|
||||
|
||||
def set_physms(val)
|
||||
settings_cmd(2, val);
|
||||
end
|
Loading…
Reference in a new issue