Wise&mystical  1.0
Project about Europe
Loading...
Searching...
No Matches
manageActiveText.cpp
Go to the documentation of this file.
1#include <iostream>
2#include <string>
3#include <cmath>
4#include "raylib.h"
5#include "cityOperations.h"
6#include "animations.h"
7
11std::string updatePopUpActiveText(std::string text, City activeCity, City tempCity, PopUpAnimationFrame popUpMenuFrame)
12{
13 // Reset the active text
14 text = "";
15
16 // Update the active text with the current information
17 text.append("Travel from ");
18 text.append(activeCity.name);
19 text.append(" to ");
20 text.append(tempCity.name);
21 if (popUpMenuFrame.pos.y == 913)
22 {
23 text.append("?");
24 }
25
26 // Return the updated active text
27 return text;
28}
29
33void updateScoreCountUp(bool* countUpDone, int* startNum, int* endNum, int countUpstep)
34{
35 // Update score count up
36 *startNum += countUpstep;
37
38 // Check for new score boundary
39 if (*startNum >= *endNum)
40 {
41 *startNum = *endNum;
42 *countUpDone = true;
43 }
44}
45
49void drawTravelPointsCount(Font comfortaaTravelPoints, int travelPoints)
50{
51 float x = 0;
52
53 // Check for travel points count and update x to center the counter
54 if (travelPoints >= 20 )
55 {
56 x += 2;
57 if (travelPoints / 10 % 10 == 1)
58 {
59 x += 6;
60 }
61 }
62 else if (travelPoints < 20 && travelPoints >= 10)
63 {
64 if (travelPoints / 10 % 10 == 1)
65 {
66 x += 6;
67 }
68 }
69 else if (travelPoints < 10)
70 {
71 x += 13;
72 if (travelPoints / 10 % 10 == 1)
73 {
74 x += 6;
75 }
76 }
77
78 // Draw travel points counter
79 DrawTextEx(comfortaaTravelPoints, TextFormat("%i", travelPoints), Vector2{ float(283.84) + x, 242 }, 40, 1, WHITE);
80}
void drawTravelPointsCount(Font comfortaaTravelPoints, int travelPoints)
Draw travel points count.
void updateScoreCountUp(bool *countUpDone, int *startNum, int *endNum, int countUpstep)
Update score count up sequence.
std::string updatePopUpActiveText(std::string text, City activeCity, City tempCity, PopUpAnimationFrame popUpMenuFrame)
Update the pop-up active text.
RLAPI const char * TextFormat(const char *text,...)
Definition: rtext.c:1278
#define WHITE
Definition: raylib.h:170
RLAPI void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint)
Definition: rtext.c:1024
Initialise cities.
Definition: cityOperations.h:8
std::string name
Definition: raylib.h:289
Define Pop up animation frame.
Definition: animations.h:39
float y
Definition: physac.h:131