press space to teach respect

This commit is contained in:
2023-01-22 16:42:23 +01:00
parent ff78687b64
commit f7a2c15717
+20
View File
@@ -35,6 +35,8 @@ RenderObject_t scoreText;
static RenderId_t scoreTextId = -1; static RenderId_t scoreTextId = -1;
static int victimHeight; static int victimHeight;
static RenderId_t pressSpaceShadowId;
static RenderId_t pressSpaceTextId;
#define VICTIME_COUNT 4 #define VICTIME_COUNT 4
RenderId_t victims[VICTIME_COUNT]; RenderId_t victims[VICTIME_COUNT];
@@ -166,6 +168,18 @@ int game_staticRender(void){
strengthBarSlider.height = 0.05f; strengthBarSlider.height = 0.05f;
strengthBarSliderId = scene_addRenderObject(&gameScene, strengthBarSlider, 0.30f * CAMERA_WIDTH, 0.89f * CAMERA_HEIGHT); strengthBarSliderId = scene_addRenderObject(&gameScene, strengthBarSlider, 0.30f * CAMERA_WIDTH, 0.89f * CAMERA_HEIGHT);
RenderObject_t pressSpaceShadow = EMPTY_RENDER_OBJECT;
strcpy(pressSpaceShadow.name, "pressSpaceShadow");
text_renderText(&pressSpaceShadow, 50, 1, black, "./assets/fonts/Quinquefive.ttf", 20, "Press space to teach respect");
pressSpaceShadowId = scene_addRenderObject(&gameScene, pressSpaceShadow, 0.30f * CAMERA_WIDTH, 0.8f * CAMERA_HEIGHT);
RenderObject_t pressSpaceText = EMPTY_RENDER_OBJECT;
strcpy(pressSpaceText.name, "pressSpaceText");
SDL_Color white = {255, 255, 255, 255};
text_renderText(&pressSpaceText, 50, 1, white, "./assets/fonts/Quinquefive.ttf", 20, "Press space to teach respect");
pressSpaceTextId = scene_addRenderObject(&gameScene, pressSpaceText, 0.295f * CAMERA_WIDTH, 0.82f * CAMERA_HEIGHT);
return 0; return 0;
} }
@@ -254,6 +268,12 @@ void game_handleSpaceKeyInput(void){
personVelocityX *= strength * adameStrength; personVelocityX *= strength * adameStrength;
scene_moveRenderObject(&gameScene, strengthBarId, 0, CAMERA_HEIGHT * 2); scene_moveRenderObject(&gameScene, strengthBarId, 0, CAMERA_HEIGHT * 2);
scene_moveRenderObject(&gameScene, strengthBarSliderId, 0, CAMERA_HEIGHT * 2); scene_moveRenderObject(&gameScene, strengthBarSliderId, 0, CAMERA_HEIGHT * 2);
scene_removeRenderObject(&gameScene, pressSpaceShadowId);
scene_removeRenderObject(&gameScene, pressSpaceTextId);
} }
} }
// press space to teach respect