Wise&mystical  1.0
Project about Europe
Loading...
Searching...
No Matches
quizLogic.cpp
Go to the documentation of this file.
1#include <raylib.h>
2#include "animations.h"
3#include "cityOperations.h"
4#include "quizLogic.h"
5#include "timer.h"
6
10void handleQuizInput(City activeCity, Option options[4], bool* showQuizPtr, bool* optionSelectedPtr, int* scorePtr, int* startNumPtr, int* endNumPtr, int* countUpstepPtr, bool* countUpDonePtr, int* bonusPtr)
11{
12 // Chdck if the left mouse button is pressed
14 {
15 // Cycle through the option hitboxes
16 for (int i = 0; i < 4; i++)
17 {
18 // Check for collision with the true answer
19 if (CheckCollisionPointRec(Vector2(GetMousePosition()), options[i].hitbox) && activeCity.trueAnswer == i + 1)
20 {
21 if (*showQuizPtr == true)
22 {
23 // Update score and count up sequence variables
24 *startNumPtr = *scorePtr;
25 *scorePtr += 200 + *bonusPtr;
26 *endNumPtr = *scorePtr;
27 *countUpDonePtr = false;
28 *countUpstepPtr = (*endNumPtr - *startNumPtr) / 100;
29 }
30
31 *optionSelectedPtr = true;
32 *showQuizPtr = false;
33
34 }
35 else if (CheckCollisionPointRec(Vector2(GetMousePosition()), options[i].hitbox))
36 {
37 *optionSelectedPtr = true;
38 *showQuizPtr = false;
39 }
40 }
41 }
42}
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.
Definition: quizLogic.cpp:10
RLAPI bool CheckCollisionPointRec(Vector2 point, Rectangle rec)
Definition: rshapes.c:1599
RLAPI Vector2 GetMousePosition(void)
Definition: rcore.c:3761
@ MOUSE_BUTTON_LEFT
Definition: raylib.h:648
RLAPI bool IsMouseButtonPressed(int button)
Definition: rcore.c:3696
Initialise cities.
Definition: cityOperations.h:8
int trueAnswer