The data files are now installed with the game
This commit is contained in:
parent
59e32663a1
commit
928efe501c
6 changed files with 18 additions and 4 deletions
11
Makefile.am
11
Makefile.am
|
|
@ -5,11 +5,22 @@ ACLOCAL_AMFLAGS = -I m4 --install
|
||||||
|
|
||||||
bin_PROGRAMS = Game
|
bin_PROGRAMS = Game
|
||||||
|
|
||||||
|
dist_pkgdata_DATA = \
|
||||||
|
data/shaders/vertex.glsl \
|
||||||
|
data/shaders/fragment.glsl \
|
||||||
|
data/container.jpg
|
||||||
|
|
||||||
Game_SOURCES = \
|
Game_SOURCES = \
|
||||||
src/main.cpp \
|
src/main.cpp \
|
||||||
src/Error.h \
|
src/Error.h \
|
||||||
src/Error.cpp \
|
src/Error.cpp \
|
||||||
src/ShaderLoader.h \
|
src/ShaderLoader.h \
|
||||||
src/ShaderLoader.cpp
|
src/ShaderLoader.cpp
|
||||||
|
|
||||||
|
|
||||||
Game_CPPFLAGS = @sdl2_CFLAGS@ @glew_CFLAGS@ @opengl_CFLAGS@ @glm_CFLAGS@ @sdl2_image_CFLAGS@
|
Game_CPPFLAGS = @sdl2_CFLAGS@ @glew_CFLAGS@ @opengl_CFLAGS@ @glm_CFLAGS@ @sdl2_image_CFLAGS@
|
||||||
|
|
||||||
Game_LDFLAGS = @sdl2_LIBS@ @glew_LIBS@ @opengl_LIBS@ @glm_LIBS@ @sdl2_image_LIBS@
|
Game_LDFLAGS = @sdl2_LIBS@ @glew_LIBS@ @opengl_LIBS@ @glm_LIBS@ @sdl2_image_LIBS@
|
||||||
|
|
||||||
|
#AM_CPPFLAGS = -DDATADIR=\"$(pkgdatadir)\"
|
||||||
|
Game_CPPFLAGS += -DDATADIR=\"$(pkgdatadir)\"
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,11 @@ AC_PREREQ([2.69])
|
||||||
AC_INIT([Game], [0.0.1], [wytau@sdf.org])
|
AC_INIT([Game], [0.0.1], [wytau@sdf.org])
|
||||||
AC_CONFIG_SRCDIR([src/main.cpp])
|
AC_CONFIG_SRCDIR([src/main.cpp])
|
||||||
AC_CONFIG_HEADERS([config.h])
|
AC_CONFIG_HEADERS([config.h])
|
||||||
|
|
||||||
|
# This is actually defined in Makefile.am
|
||||||
|
# But this stops intellisense like software from complaining
|
||||||
|
AC_DEFINE_UNQUOTED([DATAPATH], ["$pkgdatadir"],"DData Directory Path")
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
|
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 181 KiB After Width: | Height: | Size: 181 KiB |
|
|
@ -66,7 +66,7 @@ int main(int argc, char **argv) {
|
||||||
// Create event handling struct
|
// Create event handling struct
|
||||||
SDL_Event input;
|
SDL_Event input;
|
||||||
|
|
||||||
ShaderLoader shader("src/vertex.glsl", "src/fragment.glsl");
|
ShaderLoader shader(DATADIR "/vertex.glsl", DATADIR "/fragment.glsl");
|
||||||
|
|
||||||
float vertices[] = {
|
float vertices[] = {
|
||||||
// positions // texture Co-ords
|
// positions // texture Co-ords
|
||||||
|
|
@ -121,7 +121,7 @@ int main(int argc, char **argv) {
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
|
||||||
// Load texture image
|
// Load texture image
|
||||||
SDL_Surface *image = IMG_Load("src/container.jpg");
|
SDL_Surface *image = IMG_Load(DATADIR "/container.jpg");
|
||||||
if (image == nullptr) {
|
if (image == nullptr) {
|
||||||
error.crash("SDL2_image was unable to load a texture", IMG_GetError());
|
error.crash("SDL2_image was unable to load a texture", IMG_GetError());
|
||||||
}
|
}
|
||||||
|
|
@ -142,8 +142,6 @@ int main(int argc, char **argv) {
|
||||||
GL_UNSIGNED_BYTE, image->pixels);
|
GL_UNSIGNED_BYTE, image->pixels);
|
||||||
glGenerateMipmap(GL_TEXTURE_2D);
|
glGenerateMipmap(GL_TEXTURE_2D);
|
||||||
|
|
||||||
error.log(std::to_string(image->h));
|
|
||||||
|
|
||||||
// remove image surface now it's no longer needed to create texture
|
// remove image surface now it's no longer needed to create texture
|
||||||
SDL_FreeSurface(image);
|
SDL_FreeSurface(image);
|
||||||
image = nullptr;
|
image = nullptr;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue