heload, a mess
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#define WINDOW_WIDTH 1280
|
||||
#define WINDOW_HEIGHT 720
|
||||
|
||||
namespace hiisi {
|
||||
/* This function runs once at startup. */
|
||||
int init(EngineData *state, int argc, char *argv[])
|
||||
{
|
||||
@@ -52,7 +53,7 @@ int iterate(EngineData *state)
|
||||
|
||||
/* we'll have the rectangles grow and shrink over a few seconds. */
|
||||
const float direction = ((now % 2000) >= 1000) ? 1.0f : -1.0f;
|
||||
const float scale = ((float) (((int) (now % 1000)) - 500) / 500.0f) * direction;
|
||||
const float scale = ((float) (((int) (now % 1000)) - 500) / 50.0f) * direction;
|
||||
|
||||
/* as you can see from this, rendering draws over whatever was drawn before it. */
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE); /* black, full alpha */
|
||||
@@ -64,7 +65,7 @@ int iterate(EngineData *state)
|
||||
pretty standard in 2D graphics. */
|
||||
|
||||
/* Let's draw a single rectangle (square, really). */
|
||||
rects[0].x = rects[0].y = 100;
|
||||
rects[0].x = rects[0].y = 10;
|
||||
rects[0].w = rects[0].h = 100 + (100 * scale);
|
||||
SDL_SetRenderDrawColor(renderer, 250, 0, 255, SDL_ALPHA_OPAQUE); /* red, full alpha */
|
||||
SDL_RenderRect(renderer, &rects[0]);
|
||||
@@ -110,3 +111,4 @@ void quit(EngineData *state)
|
||||
{
|
||||
/* SDL will clean up the window/renderer for us. */
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user