Fixed bug #783
Fixed coordinate positioning with OpenGL renderer, and added a test case --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403805
This commit is contained in:
parent
d58444879a
commit
1d966b1f67
2 changed files with 13 additions and 4 deletions
|
@ -450,8 +450,8 @@ GL_ActivateRenderer(SDL_Renderer * renderer)
|
||||||
data->glMatrixMode(GL_MODELVIEW);
|
data->glMatrixMode(GL_MODELVIEW);
|
||||||
data->glLoadIdentity();
|
data->glLoadIdentity();
|
||||||
data->glViewport(0, 0, window->w, window->h);
|
data->glViewport(0, 0, window->w, window->h);
|
||||||
data->glOrtho(0.0, (GLdouble) window->w, (GLdouble) window->h, 0.0,
|
data->glOrtho(-0.5, (GLdouble) window->w-0.5,
|
||||||
0.0, 1.0);
|
(GLdouble) window->h-0.5, -0.5, 0.0, 1.0);
|
||||||
data->updateSize = SDL_FALSE;
|
data->updateSize = SDL_FALSE;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -134,10 +134,19 @@ MoveSprites(SDL_WindowID window, SDL_TextureID sprite)
|
||||||
SDL_SetTextureAlphaMod(sprite, (Uint8) current_alpha);
|
SDL_SetTextureAlphaMod(sprite, (Uint8) current_alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move the sprite, bounce at the wall, and draw */
|
/* Draw a gray background */
|
||||||
n = 0;
|
|
||||||
SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
|
SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
|
||||||
SDL_RenderFill(NULL);
|
SDL_RenderFill(NULL);
|
||||||
|
|
||||||
|
/* Draw two red points to make sure they show up correctly */
|
||||||
|
SDL_SetRenderDrawColor(0xFF, 0x00, 0x00, 0xFF);
|
||||||
|
SDL_RenderPoint(0, 0);
|
||||||
|
SDL_RenderPoint(window_w-1, 0);
|
||||||
|
SDL_RenderPoint(0, window_h-1);
|
||||||
|
SDL_RenderPoint(window_w-1, window_h-1);
|
||||||
|
|
||||||
|
/* Move the sprite, bounce at the wall, and draw */
|
||||||
|
n = 0;
|
||||||
for (i = 0; i < num_sprites; ++i) {
|
for (i = 0; i < num_sprites; ++i) {
|
||||||
position = &positions[i];
|
position = &positions[i];
|
||||||
velocity = &velocities[i];
|
velocity = &velocities[i];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue