Resolution independence
This commit is contained in:
parent
4ab1ac1d85
commit
ef03e87306
3 changed files with 10 additions and 4 deletions
|
@ -35,9 +35,12 @@
|
|||
#define CONFIG_FILE "config"
|
||||
|
||||
enum {
|
||||
RESX = 800,
|
||||
RESY = 600,
|
||||
|
||||
SCREEN_W = 800,
|
||||
SCREEN_H = 600,
|
||||
|
||||
|
||||
VIEWPORT_X = 40,
|
||||
VIEWPORT_Y = 20,
|
||||
VIEWPORT_W = 480,
|
||||
|
|
|
@ -64,7 +64,7 @@ int main(int argc, char** argv) {
|
|||
if(tconfig.intval[FULLSCREEN])
|
||||
flags |= SDL_FULLSCREEN;
|
||||
|
||||
if((display = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 32, flags)) == NULL)
|
||||
if((display = SDL_SetVideoMode(RESX, RESY, 32, flags)) == NULL)
|
||||
errx(-1, "Error opening screen: %s", SDL_GetError());
|
||||
|
||||
printf("-- SDL viewport\n");
|
||||
|
|
|
@ -170,8 +170,11 @@ void draw_hud() {
|
|||
}
|
||||
|
||||
void stage_draw(StageRule bgdraw, ShaderRule *shaderrules, int time) {
|
||||
if(!tconfig.intval[NO_SHADER])
|
||||
if(!tconfig.intval[NO_SHADER]) {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, resources.fbg[0].fbo);
|
||||
if(!global.menu)
|
||||
glViewport(0,0,SCREEN_W,SCREEN_H);
|
||||
}
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glPushMatrix();
|
||||
glTranslatef(-(VIEWPORT_X+VIEWPORT_W/2.0), -(VIEWPORT_Y+VIEWPORT_H/2.0),0);
|
||||
|
@ -241,7 +244,7 @@ void stage_draw(StageRule bgdraw, ShaderRule *shaderrules, int time) {
|
|||
|
||||
if(!tconfig.intval[NO_SHADER]) {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
||||
glViewport(0,0,RESX,RESY);
|
||||
glPushMatrix();
|
||||
if(global.plr.cha == Marisa && global.plr.shot == MarisaLaser && global.frames - global.plr.recovery < 0)
|
||||
glTranslatef(8*sin(global.frames),8*sin(global.frames+3),0);
|
||||
|
|
Loading…
Reference in a new issue