23 Font comfortaa =
LoadFontEx(
"../resources/font/Comfortaa-Regular.ttf", 25, 0, 250);
24 Font comfortaaScore =
LoadFontEx(
"../resources/font/Comfortaa-Regular.ttf", 32, 0, 250);
25 Font comfortaaTravelPoints =
LoadFontEx(
"../resources/font/Comfortaa-Bold.ttf", 40, 0, 250);
30 LoadTexture(
"../resources/images/map components/City marker Easy.png"),
31 LoadTexture(
"../resources/images/map components/City marker Medium.png"),
32 LoadTexture(
"../resources/images/map components/City marker Hard.png")
38 Texture2D visitedCityWarning =
LoadTexture(
"../resources/images/UI components/City warning.png");
45 {
LoadTexture(
"../resources/images/UI components/menu components/buttons/play button.png"),
LoadTexture(
"../resources/images/UI components/menu components/hover effects/play button hover.png")},
46 {
LoadTexture(
"../resources/images/UI components/menu components/buttons/about button.png"),
LoadTexture(
"../resources/images/UI components/menu components/hover effects/about button hover.png")},
47 {
LoadTexture(
"../resources/images/UI components/menu components/buttons/quit button.png"),
LoadTexture(
"../resources/images/UI components/menu components/hover effects/quit button hover.png")}
60 bool drawMenuTransition =
false;
61 bool* drawMenuTransitionPtr = &drawMenuTransition;
62 bool menuUnloaded =
false;
65 Vector2 mousePoint = { 0.0f, 0.0f };
69 float* cameraPosXPtr = &cameraPosX;
71 float* cameraPosYPtr = &cameraPosY;
75 camera.
offset = { float(width) / 2, float(height) / 2 };
76 camera.
target = { cameraPosX, cameraPosY };
83 citiArrayPtr = cities;
88 bool quitButtonPressed =
false;
89 bool* quitButtonPressedPtr = &quitButtonPressed;
92 const int cityCounter = 40;
96 City activeCity = cities[startCityNum];
98 City* activeCityPtr = &activeCity;
102 City* tempCityPtr = &tempCity;
103 int index = startCityNum;
104 int* indexPtr = &index;
107 std::vector<LinePoints> conLines;
108 std::vector<LinePoints>* conLinesPtr = &conLines;
111 bool searchingNextCity =
false;
112 bool* searchingNextCityPtr = &searchingNextCity;
113 bool showPopUpMenu =
false;
114 bool* showPopUpMenuPtr = &showPopUpMenu;
119 Rectangle confirmHitbox = { 1462, 993, 186, 67 };
120 Rectangle denyHitbox = { 1693, 993, 186, 67 };
135 bool activeQuizLoaded =
false;
136 bool* activeQuizLoadedPtr = &activeQuizLoaded;
137 bool showQuiz =
false;
138 bool* showQuizPtr = &showQuiz;
139 bool nextCityChosen =
true;
140 bool* nextCityChosenPtr = &nextCityChosen;
141 bool optionSelected =
false;
142 bool* optionSelectedPtr = &optionSelected;
144 {{1034, 800, 740, 51},
LoadTexture(
"../resources/images/UI components/option hover/option a hover.png"),
LoadTexture(
"../resources/images/UI components/option indicators/Right answer a.png"),
LoadTexture(
"../resources/images/UI components/option indicators/Wrong answer a.png")},
145 {{1034, 867, 740, 51},
LoadTexture(
"../resources/images/UI components/option hover/option b hover.png"),
LoadTexture(
"../resources/images/UI components/option indicators/Right answer b.png"),
LoadTexture(
"../resources/images/UI components/option indicators/Wrong answer b.png")},
146 {{1034, 934, 740, 51},
LoadTexture(
"../resources/images/UI components/option hover/option c hover.png"),
LoadTexture(
"../resources/images/UI components/option indicators/Right answer c.png"),
LoadTexture(
"../resources/images/UI components/option indicators/Wrong answer c.png")},
147 {{1034, 1001, 740, 51},
LoadTexture(
"../resources/images/UI components/option hover/option d hover.png"),
LoadTexture(
"../resources/images/UI components/option indicators/Right answer d.png"),
LoadTexture(
"../resources/images/UI components/option indicators/Wrong answer d.png")}
151 bool intialTimerStarted =
false;
152 float freeTime = 1.8;
153 Timer freeTimeTimer = { 0 };
154 Timer* freeTimeTimerPtr = &freeTimeTimer;
159 bool wariningVisible =
false;
160 bool* warningVisiblePtr = &wariningVisible;
163 float warningScreentime = 2.5f;
164 float* warningScreentimePtr = &warningScreentime;
165 Timer warningTimer = { 0 };
166 Timer* warningTimerPtr = &warningTimer;
169 std::string popUpText =
"";
171 int* scorePtr = &score;
173 int* bonusPtr = &bonus;
174 int travelPoints = 40;
175 int* travelPointsPtr = &travelPoints;
179 int* startNumPtr = &startNum;
181 int* endNumPtr = &endNum;
183 int* countUpstepPtr = &countUpstep;
184 bool countUpDone =
true;
185 bool* countUpDonePtr = &countUpDone;
199 switch (currentScreen)
203 hangleMenuInput(menuHitboxes, transitionPtr, quitButtonPressedPtr, drawMenuTransitionPtr);
208 if (transition.
radius <= 10 && !intialTimerStarted)
212 intialTimerStarted =
true;
216 if (currentScreen ==
GAMEPLAY && !menuUnloaded)
218 for (
int i = 0; i < 3; i++)
230 camera.
target = { *cameraPosXPtr, *cameraPosYPtr };
236 if (quizAnimationFrame.
pos.
x == 1920 && !showQuiz)
238 travelToNextCity(mousePoint, citiArrayPtr, activeCity, tempCityPtr, searchingNextCityPtr, showPopUpMenuPtr, cityCounter, indexPtr);
245 handlePopUpInput(citiArrayPtr, activeCityPtr, tempCityPtr, popUpMenuFrame, confirmHitbox, denyHitbox, conLinesPtr, searchingNextCityPtr, showPopUpMenuPtr, nextCityChosenPtr, indexPtr, travelPointsPtr, bonusPtr);
251 manageWarningAnimation(mousePoint, cities, activeCity, warningAnimationFramePtr, popUpMenuFrame, warningTimerPtr, warningScreentimePtr, warningVisiblePtr, showPopUpMenu);
259 if (!activeQuizLoaded && popUpMenuFrame.
pos.
y == 1080 && !showPopUpMenu &&
TimerDone(&freeTimeTimer))
262 activeQuizLoaded =
true;
267 if (quizAnimationFrame.
pos.
x == 1920 && !showQuiz && !searchingNextCity)
269 searchingNextCity =
true;
271 activeQuizLoaded =
false;
275 handleQuizInput(activeCity, options, showQuizPtr, optionSelectedPtr, scorePtr, startNumPtr, endNumPtr, countUpstepPtr, countUpDonePtr, bonusPtr);
278 if (quizAnimationFrame.
pos.
x == 1920)
280 optionSelected =
false;
294 if (transitionPtr->
radius >= 1120)
297 quitButtonPressed =
false;
301 switch (currentScreen)
350 else if (!countUpDone)
369 drawPopUpMenuHover(confirmHitbox, denyHitbox, confirmHover, denyHover, popUpMenuFramePtr);
372 if (popUpMenuFrame.
pos.
y == 1080 || popUpMenuFrame.
pos.
y == 913)
378 DrawTextEx(comfortaa, popUpText.c_str(),
Vector2{ 1427, popUpMenuFrame.pos.y + float(19) }, 25, 1,
WHITE);
387 for (
int i = 0; i < 5; i++)
409 for (
int i = 0; i < 10; i++)
417 if (quitButtonPressed && transition.
radius == 0)
void manageWarningAnimation(Vector2 mousePoint, City cities[40], City activeCity, PopUpAnimationFrame *warningAnimationFramePtr, PopUpAnimationFrame popUpMenuFrame, Timer *warningTimerPtr, float *warningScreentimePtr, bool *wariningVisiblePtr, bool showPopUpMenu)
Manage warning animation.
void drawQuizOptionsHover(Option options[4], PopUpAnimationFrame quizAnimationFrame, int index)
Draw quiz options hover effect.
void drawOptionIndicators(City activeCity, Option options[4], PopUpAnimationFrame quizAnimationFrame, bool optionSelected, int index)
Draw option indicators to show if the selected option was true or false.
void drawPopUpMenuHover(Rectangle confirmHitbox, Rectangle denyHitbox, Texture2D confirmHover, Texture2D denyHover, PopUpAnimationFrame *popUpAnimationFramePtr)
Draw popUp buttons hover effect.
void drawPopUpAnimationBottom(PopUpAnimationFrame *componentPtr, float endY, bool showComponent)
Draw pop-up animation across its different states.
void drawActiveCityAnimation(ActiveCityAnimationFrame *activeCityAnimationParts, City activeCity)
Draw active city animation.
void drawPopUpAnimationSide(PopUpAnimationFrame *quizPtr, Texture2D texture, bool showQuiz)
Draw pop-up animation side.
#define frame1
Define active city animation colors.
City * intialiseCitiesArray(City cities[40])
Initialise cities.
void updateCityTravelCostAndBonus(City *cities, City activeCity, int citiesCounter)
Update city travel cost and bonus.
void drawCityMarkers(City *cities, City activeCity, Texture2D markers[3], int citiesCounter)
Draw city markers based of distance from active city.
void drawCityNames(City *cities, int citiesCounter, Font comfortaaRegular)
Draw city marks on the map.
#define mapBackgroundColor
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.
void updateCameraPos(float *xCoordinate, float *yCoordinate)
Update camera position.
void setInitialCameraPos(float *cameraPosXPtr, float *cameraPosYPtr, int num)
Set the camera's intial positon based on the starter city's index.
void handleQuizInput(City activeCity, Option options[4], bool *showQuizPtr, bool *optionSelectedPtr, int *scorePtr, int *startNumPtr, int *endNumPtr, int *countUpstepPtr, bool *countUpDonePtr, int *bonusPtr)
Handle mouse input relative to the quiz options.
RLAPI const char * TextFormat(const char *text,...)
RLAPI void InitWindow(int width, int height, const char *title)
RLAPI void BeginMode2D(Camera2D camera)
RLAPI void CloseWindow(void)
RLAPI bool WindowShouldClose(void)
RLAPI void ClearBackground(Color color)
RLAPI Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int glyphCount)
RLAPI Texture2D LoadTexture(const char *fileName)
RLAPI void BeginDrawing(void)
RLAPI void UnloadTexture(Texture2D texture)
RLAPI void EndDrawing(void)
RLAPI int GetScreenWidth(void)
RLAPI void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color)
RLAPI Vector2 GetScreenToWorld2D(Vector2 position, Camera2D camera)
RLAPI Vector2 GetMousePosition(void)
RLAPI int GetScreenHeight(void)
RLAPI int GetRandomValue(int min, int max)
RLAPI void EndMode2D(void)
RLAPI void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint)
RLAPI void DrawTexture(Texture2D texture, int posX, int posY, Color tint)
RLAPI void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint)
Define Active city animation frame struct.
const char * textureFilePath
Define Pop up animation frame.
void StartTimer(Timer *timer, float lifetime)
Start or restart a timer with a specific lifetime.
void UpdateTimer(Timer *timer)
Update a timer with the current frame time.
bool TimerDone(Timer *timer)
Check if a timer is done.
void travelToNextCity(Vector2 mousePoint, City *cities, City activeCity, City *tempCity, bool *searchingNextCity, bool *showPopUpMenu, int citiesCounter, int *indexPtr)
Travel to next selected city (if possible).
void handlePopUpInput(City *cities, City *activeCity, City *tempCity, PopUpAnimationFrame popUpFrame, Rectangle confirmHitbox, Rectangle denyHitbox, std::vector< LinePoints > *conLinesPtr, bool *searchingNextCity, bool *showPopUpMenu, bool *nextCityChosenPtr, int *indexPtr, int *travelPointsPtr, int *bonusPtr)
Handle mouse input for the pop-up.