[Fix] Few warnings from conf file and VERSION not loading into packed data file.
This commit is contained in:
parent
5381ceed02
commit
c5fa395f17
1
.gitignore
vendored
1
.gitignore
vendored
@ -29,4 +29,5 @@
|
|||||||
*pack
|
*pack
|
||||||
*core
|
*core
|
||||||
*screenshot.png
|
*screenshot.png
|
||||||
|
*VERSION
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ LDFLAGS += -pg
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
DATA = data
|
DATA = data
|
||||||
DATAFILES = ../$(VERSIONFILE) $(shell find ../scripts/ ../gfx/ ../dat/ -name '*.lua' -o -name '*.png' -o -name '*.xml' -o -name '*.ttf')
|
DATAFILES = $(VERSIONFILE) $(shell find ../scripts/ ../gfx/ ../dat/ -name '*.lua' -o -name '*.png' -o -name '*.xml' -o -name '*.ttf')
|
||||||
|
|
||||||
%.o: %.c %.h
|
%.o: %.c %.h
|
||||||
@gcc -c $(CFLAGS) -o $@ $<
|
@gcc -c $(CFLAGS) -o $@ $<
|
||||||
@ -54,11 +54,11 @@ pack: ../src/pack.c ../utils/pack/main.c
|
|||||||
mksprite: ../utils/mkspr/main.c
|
mksprite: ../utils/mkspr/main.c
|
||||||
@(cd ../utils/mkspr; $(MAKE))
|
@(cd ../utils/mkspr; $(MAKE))
|
||||||
|
|
||||||
../$(VERSIONFILE):
|
$(VERSIONFILE):
|
||||||
@echo -n "$(VMAJOR).$(VMINOR).$(VREV)" > ../$(VERSIONFILE)
|
@echo -n "$(VMAJOR).$(VMINOR).$(VREV)" > $(VERSIONFILE)
|
||||||
|
|
||||||
data: pack $(DATAFILES) ../src/pack.c ../utils/pack/main.c
|
data: pack $(DATAFILES) ../src/pack.c ../utils/pack/main.c
|
||||||
@echo -n "$(VMAJOR).$(VMINOR).$(VREV)" > ../$(VERSIONFILE)
|
@echo -n "$(VMAJOR).$(VMINOR).$(VREV)" > $(VERSIONFILE)
|
||||||
@echo -e "\tCreating data..\n"
|
@echo -e "\tCreating data..\n"
|
||||||
@./pack $(DATA) $(DATAFILES)
|
@./pack $(DATA) $(DATAFILES)
|
||||||
|
|
||||||
|
8
bin/conf
8
bin/conf
@ -1,6 +1,6 @@
|
|||||||
--WINDOW.
|
--WINDOW.
|
||||||
width = 800
|
width = 1024
|
||||||
height = 640
|
height = 768
|
||||||
fullscreen = 0
|
fullscreen = 0
|
||||||
|
|
||||||
-- SCREEN.
|
-- SCREEN.
|
||||||
@ -29,12 +29,12 @@ target_nearest = { type = "jbutton", key = 3 }
|
|||||||
face = { type = "keyboard", key = 38 }
|
face = { type = "keyboard", key = 38 }
|
||||||
board = { type = "keyboard", key = 57 }
|
board = { type = "keyboard", key = 57 }
|
||||||
secondary = { type = "jbutton", key = 7 }
|
secondary = { type = "jbutton", key = 7 }
|
||||||
secondary_next = { type = "jbutotn", key = 5 }
|
secondary_next = { type = "jbutton", key = 5 }
|
||||||
|
|
||||||
-- Space.
|
-- Space.
|
||||||
|
|
||||||
-- Gui.
|
-- Gui.
|
||||||
mapzoomin = { type = "jbutton", key = 4 }
|
mapzoomin = { type = "jbutton", key = 4 }
|
||||||
mapzoomout = { type = "jbuton", key = 6 }
|
mapzoomout = { type = "jbutton", key = 6 }
|
||||||
screenshot = { type = "keyboard", key = 82 }
|
screenshot = { type = "keyboard", key = 82 }
|
||||||
|
|
||||||
|
@ -29,12 +29,12 @@ target_nearest = { type = "jbutton", key = 3 }
|
|||||||
face = { type = "keyboard", key = 38 }
|
face = { type = "keyboard", key = 38 }
|
||||||
board = { type = "keyboard", key = 57 }
|
board = { type = "keyboard", key = 57 }
|
||||||
secondary = { type = "jbutton", key = 7 }
|
secondary = { type = "jbutton", key = 7 }
|
||||||
secondary_next = { type = "jbutotn", key = 5 }
|
secondary_next = { type = "jbutton", key = 5 }
|
||||||
|
|
||||||
-- Space.
|
-- Space.
|
||||||
|
|
||||||
-- Gui.
|
-- Gui.
|
||||||
mapzoomin = { type = "jbutton", key = 4 }
|
mapzoomin = { type = "jbutton", key = 4 }
|
||||||
mapzoomout = { type = "jbuton", key = 6 }
|
mapzoomout = { type = "jbutton", key = 6 }
|
||||||
screenshot = { type = "keyboard", key = 82 }
|
screenshot = { type = "keyboard", key = 82 }
|
||||||
|
|
||||||
|
26
src/opengl.c
26
src/opengl.c
@ -422,7 +422,7 @@ void gl_bindCamera(const Vec2* pos) {
|
|||||||
|
|
||||||
// Initialize SDL/OpenGL etc.
|
// Initialize SDL/OpenGL etc.
|
||||||
int gl_init(void) {
|
int gl_init(void) {
|
||||||
int doublebuf, depth, i, supported = 0;
|
int doublebuf, depth, i, j, off, toff, supported = 0;
|
||||||
SDL_Rect** modes;
|
SDL_Rect** modes;
|
||||||
int flags = SDL_OPENGL;
|
int flags = SDL_OPENGL;
|
||||||
flags |= SDL_FULLSCREEN * (gl_has(OPENGL_FULLSCREEN) ? 1: 0);
|
flags |= SDL_FULLSCREEN * (gl_has(OPENGL_FULLSCREEN) ? 1: 0);
|
||||||
@ -447,7 +447,7 @@ int gl_init(void) {
|
|||||||
DEBUG("All fullscreen modes available");
|
DEBUG("All fullscreen modes available");
|
||||||
else {
|
else {
|
||||||
DEBUG("Available fullscreen modes:");
|
DEBUG("Available fullscreen modes:");
|
||||||
for(i = 0; modes[i]; ++i) {
|
for(i = 0; modes[i]; i++) {
|
||||||
DEBUG("\t%dx%d", modes[i]->w, modes[i]->h);
|
DEBUG("\t%dx%d", modes[i]->w, modes[i]->h);
|
||||||
if((flags & SDL_FULLSCREEN) && (modes[i]->w == gl_screen.w) && (modes[i]->h == gl_screen.h))
|
if((flags & SDL_FULLSCREEN) && (modes[i]->w == gl_screen.w) && (modes[i]->h == gl_screen.h))
|
||||||
supported = 1; // Mode we asked for is supported.
|
supported = 1; // Mode we asked for is supported.
|
||||||
@ -455,11 +455,23 @@ int gl_init(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make sure fullscreen mode is supported.
|
// Make sure fullscreen mode is supported.
|
||||||
if(flags & SDL_FULLSCREEN && !supported) {
|
if((flags & SDL_FULLSCREEN) && !supported) {
|
||||||
WARN("Fullscreen mode %dx%d is not supported by your current setup, attempting %dx%d",
|
// Try to get the closest aproximation to mode we asked for.
|
||||||
gl_screen.w, gl_screen.h, modes[0]->w, modes[0]->h);
|
off = -1;
|
||||||
gl_screen.w = modes[0]->w;
|
j = 0;
|
||||||
gl_screen.h = modes[0]->h;
|
for(i = 0; modes[i]; i++) {
|
||||||
|
toff = ABS(gl_screen.w-modes[i]->w) + ABS(gl_screen.h-modes[i]->h);
|
||||||
|
if((off == -1) || (toff < off)) {
|
||||||
|
j = i;
|
||||||
|
off = toff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WARN("Fullscreen mode %dx%d is not supported by your setup\n"
|
||||||
|
" Switching to %dx%d", gl_screen.w, gl_screen.h,
|
||||||
|
modes[j]->w, modes[j]->h);
|
||||||
|
|
||||||
|
gl_screen.w = modes[j]->w;
|
||||||
|
gl_screen.h = modes[j]->h;
|
||||||
}
|
}
|
||||||
// Free the video modes.
|
// Free the video modes.
|
||||||
for(i = 0; modes[i]; ++i)
|
for(i = 0; modes[i]; ++i)
|
||||||
|
Loading…
Reference in New Issue
Block a user