[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
|
||||
*core
|
||||
*screenshot.png
|
||||
*VERSION
|
||||
|
||||
|
@ -35,7 +35,7 @@ LDFLAGS += -pg
|
||||
endif
|
||||
|
||||
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
|
||||
@gcc -c $(CFLAGS) -o $@ $<
|
||||
@ -54,11 +54,11 @@ pack: ../src/pack.c ../utils/pack/main.c
|
||||
mksprite: ../utils/mkspr/main.c
|
||||
@(cd ../utils/mkspr; $(MAKE))
|
||||
|
||||
../$(VERSIONFILE):
|
||||
@echo -n "$(VMAJOR).$(VMINOR).$(VREV)" > ../$(VERSIONFILE)
|
||||
$(VERSIONFILE):
|
||||
@echo -n "$(VMAJOR).$(VMINOR).$(VREV)" > $(VERSIONFILE)
|
||||
|
||||
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"
|
||||
@./pack $(DATA) $(DATAFILES)
|
||||
|
||||
|
8
bin/conf
8
bin/conf
@ -1,6 +1,6 @@
|
||||
--WINDOW.
|
||||
width = 800
|
||||
height = 640
|
||||
width = 1024
|
||||
height = 768
|
||||
fullscreen = 0
|
||||
|
||||
-- SCREEN.
|
||||
@ -29,12 +29,12 @@ target_nearest = { type = "jbutton", key = 3 }
|
||||
face = { type = "keyboard", key = 38 }
|
||||
board = { type = "keyboard", key = 57 }
|
||||
secondary = { type = "jbutton", key = 7 }
|
||||
secondary_next = { type = "jbutotn", key = 5 }
|
||||
secondary_next = { type = "jbutton", key = 5 }
|
||||
|
||||
-- Space.
|
||||
|
||||
-- Gui.
|
||||
mapzoomin = { type = "jbutton", key = 4 }
|
||||
mapzoomout = { type = "jbuton", key = 6 }
|
||||
mapzoomout = { type = "jbutton", key = 6 }
|
||||
screenshot = { type = "keyboard", key = 82 }
|
||||
|
||||
|
@ -29,12 +29,12 @@ target_nearest = { type = "jbutton", key = 3 }
|
||||
face = { type = "keyboard", key = 38 }
|
||||
board = { type = "keyboard", key = 57 }
|
||||
secondary = { type = "jbutton", key = 7 }
|
||||
secondary_next = { type = "jbutotn", key = 5 }
|
||||
secondary_next = { type = "jbutton", key = 5 }
|
||||
|
||||
-- Space.
|
||||
|
||||
-- Gui.
|
||||
mapzoomin = { type = "jbutton", key = 4 }
|
||||
mapzoomout = { type = "jbuton", key = 6 }
|
||||
mapzoomout = { type = "jbutton", key = 6 }
|
||||
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.
|
||||
int gl_init(void) {
|
||||
int doublebuf, depth, i, supported = 0;
|
||||
int doublebuf, depth, i, j, off, toff, supported = 0;
|
||||
SDL_Rect** modes;
|
||||
int flags = SDL_OPENGL;
|
||||
flags |= SDL_FULLSCREEN * (gl_has(OPENGL_FULLSCREEN) ? 1: 0);
|
||||
@ -447,7 +447,7 @@ int gl_init(void) {
|
||||
DEBUG("All fullscreen modes available");
|
||||
else {
|
||||
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);
|
||||
if((flags & SDL_FULLSCREEN) && (modes[i]->w == gl_screen.w) && (modes[i]->h == gl_screen.h))
|
||||
supported = 1; // Mode we asked for is supported.
|
||||
@ -455,11 +455,23 @@ int gl_init(void) {
|
||||
}
|
||||
|
||||
// Make sure fullscreen mode is supported.
|
||||
if(flags & SDL_FULLSCREEN && !supported) {
|
||||
WARN("Fullscreen mode %dx%d is not supported by your current setup, attempting %dx%d",
|
||||
gl_screen.w, gl_screen.h, modes[0]->w, modes[0]->h);
|
||||
gl_screen.w = modes[0]->w;
|
||||
gl_screen.h = modes[0]->h;
|
||||
if((flags & SDL_FULLSCREEN) && !supported) {
|
||||
// Try to get the closest aproximation to mode we asked for.
|
||||
off = -1;
|
||||
j = 0;
|
||||
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.
|
||||
for(i = 0; modes[i]; ++i)
|
||||
|
Loading…
Reference in New Issue
Block a user