-
Notifications
You must be signed in to change notification settings - Fork 0
/
screen_settings.c
65 lines (60 loc) · 2.06 KB
/
screen_settings.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
** EPITECH PROJECT, 2021
** MYRUNNER
** File description:
** settings
*/
#include "runner.h"
void init_settings(myrunner_t *myh)
{
if (myh->is_mod_infi_on == 1) {
myh->settingsbackg = spriteinit("images/settings_backg_ifinf_yes.png");
myh->pos_settingsbackbgpos = myposinit(0, 0, myh->settingsbackg);
myh->scale_settingsbackbgscale = mypscaleinit(0.8, 0.8,
myh->settingsbackg);
} else {
myh->settingsbackg = spriteinit("images/settings_backbg.png");
myh->pos_settingsbackbgpos = myposinit(0, 0,
myh->settingsbackg);
myh->scale_settingsbackbgscale = mypscaleinit(0.8, 0.8,
myh->settingsbackg);
}
myh->settings_backbtn = spriteinit("images/backbtn.png");
myh->pos_settings_backbtn = myposinit(50, 480, myh->settings_backbtn);
myh->scale_settings_backbtn = mypscaleinit(0.5, 0.5, myh->settings_backbtn);
init_settings_two(myh);
}
void print_settings(myrunner_t *myh, sfRenderWindow* window, sfEvent event)
{
init_settings(myh);
sfRenderWindow_drawSprite(window, myh->settingsbackg, NULL);
}
void hover_back_btn(myrunner_t *myh, sfRenderWindow* window, sfEvent event)
{
sfBool isclick;
if (myh->xmouse >= 50 && myh->xmouse <= 254
&& myh->ymouse >= 475 && myh->ymouse <= 530) {
sfRenderWindow_drawSprite(window, myh->settings_hover_backbtn, NULL);
isclick = sfMouse_isButtonPressed(sfMouseLeft);
} else {
sfRenderWindow_drawSprite(window, myh->settings_backbtn, NULL);
}
if (isclick == sfTrue) {
myh->is_back = 1;
}
}
void hover_fl_btn(myrunner_t *myh, sfRenderWindow* window, sfEvent event)
{
sfBool isclick;
if (myh->xmouse >= 530 && myh->xmouse <= 570
&& myh->ymouse >= 80 && myh->ymouse <= 120) {
sfRenderWindow_drawSprite(window, myh->settings_btn_hover_fl_no, NULL);
isclick = sfMouse_isButtonPressed(sfMouseLeft);
} else {
sfRenderWindow_drawSprite(window, myh->settings_btn_fl_no, NULL);
}
if (isclick == sfTrue) {
myh->infin_mod = 1;
myh->is_mod_infi_on = 1;
}
}