[Fix] Squished an offset bug in splite britting.

This commit is contained in:
Allanis 2013-02-13 14:38:01 +00:00
parent 053d7b75b6
commit b75f0f1d6b
2 changed files with 3 additions and 4 deletions

View File

@ -322,7 +322,6 @@ static void update_all(void) {
if(dt > MINIMUM_FPS) { if(dt > MINIMUM_FPS) {
Vec2 pos; Vec2 pos;
vect_csetmin(&pos, 10., (double)(gl_screen.h-40)); vect_csetmin(&pos, 10., (double)(gl_screen.h-40));
gl_print(NULL, &pos, "FPS is really low! Skipping frames.");
SDL_GL_SwapBuffers(); SDL_GL_SwapBuffers();
return; return;
} }
@ -365,6 +364,6 @@ static void display_fps(const double dt) {
Vec2 pos; Vec2 pos;
vect_csetmin(&pos, 10., (double)(gl_screen.h-20)); vect_csetmin(&pos, 10., (double)(gl_screen.h-20));
if(show_fps) if(show_fps)
gl_print(NULL, &pos, "%3.2f", fps); gl_print(NULL, &pos, NULL, "%3.2f", fps);
} }

View File

@ -331,8 +331,8 @@ void gl_getSpriteFromDir(int* x, int* y, const gl_texture* t, const double dir)
// Blit the sprite at given position. // Blit the sprite at given position.
void gl_blitSprite(const gl_texture* sprite, const Vec2* pos, const int sx, const int sy, const glColor* c) { void gl_blitSprite(const gl_texture* sprite, const Vec2* pos, const int sx, const int sy, const glColor* c) {
// Don't bother drawing if offscreen -- waste of cycles. // Don't bother drawing if offscreen -- waste of cycles.
if(fabs(VX(*pos) -VX(*gl_camera)) > gl_screen.w / 2 + sprite->sw / 2 || if(fabs(VX(*pos) -VX(*gl_camera)+gui_xoff) > gl_screen.w / 2 + sprite->sw / 2 ||
fabs(VY(*pos) -VY(*gl_camera)) > gl_screen.h / 2 + sprite->sh / 2) fabs(VY(*pos) -VY(*gl_camera)+gui_yoff) > gl_screen.h / 2 + sprite->sh / 2)
return; return;
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);