Wise&mystical
1.0
Project about Europe
Toggle main menu visibility
Main Page
Related Pages
Modules
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
i
m
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
c
g
m
n
o
r
s
t
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerations
_
a
b
c
d
f
g
k
m
n
p
r
s
t
v
Enumerator
a
b
c
d
f
g
h
k
l
m
n
o
p
r
s
t
v
Macros
_
a
b
c
d
e
f
g
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
▼
Wise&mystical
LICENSE
Deprecated List
►
Modules
►
Classes
▼
Files
▼
File List
▼
Game
▼
_build
►
animations.cpp
►
animations.h
►
cityOperations.cpp
►
cityOperations.h
►
game.cpp
►
game.h
►
main.cpp
►
manageActiveText.cpp
►
manageActiveText.h
►
menu.cpp
►
menu.h
►
movement.cpp
►
movement.h
►
quizLogic.cpp
►
quizLogic.h
►
timer.cpp
►
timer.h
►
travelLogic.cpp
►
travelLogic.h
►
raylib-master
html
►
File Members
•
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
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
10
void
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
13
if
(
IsMouseButtonPressed
(
MOUSE_BUTTON_LEFT
))
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
}
animations.h
cityOperations.h
handleQuizInput
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
quizLogic.h
raylib.h
CheckCollisionPointRec
RLAPI bool CheckCollisionPointRec(Vector2 point, Rectangle rec)
Definition:
rshapes.c:1599
GetMousePosition
RLAPI Vector2 GetMousePosition(void)
Definition:
rcore.c:3761
MOUSE_BUTTON_LEFT
@ MOUSE_BUTTON_LEFT
Definition:
raylib.h:648
IsMouseButtonPressed
RLAPI bool IsMouseButtonPressed(int button)
Definition:
rcore.c:3696
City
Initialise cities.
Definition:
cityOperations.h:8
City::trueAnswer
int trueAnswer
Definition:
cityOperations.h:22
Option
Definition:
quizLogic.h:6
Vector2
Definition:
physac.h:129
timer.h
Game
_build
quizLogic.cpp
Generated by
1.9.5