-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplays.c
122 lines (110 loc) · 3.51 KB
/
displays.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* displays.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: acostaz <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/26 18:35:48 by acostaz #+# #+# */
/* Updated: 2019/04/08 14:34:58 by acostaz ### ########.fr */
/* */
/* ************************************************************************** */
#include "fdf.h"
static void print_shown(t_data *e)
{
t_pos pos;
pos.y = 109;
while (++pos.y < 423)
{
pos.x = 9;
while (++pos.x < 405)
{
if (pos.y < 115 || pos.y > 417 || pos.x < 15 || pos.x > 399
|| (pos.x > 204 && pos.x < 210 && pos.y > 143)
|| (pos.y > 143 && pos.y < 149))
image_put_pixel(e->image, pos, e->size_line, 0x777777);
else
image_put_pixel(e->image, pos, e->size_line, 0x00030);
}
}
}
static void print_hidden(t_data *e)
{
t_pos pos;
pos.y = 109;
while (++pos.y < 145)
{
pos.x = 9;
while (++pos.x < 280)
{
if (pos.y < 115 || pos.y > 139 || pos.x < 15 || pos.x > 274)
image_put_pixel(e->image, pos, e->size_line, 0x777777);
else
image_put_pixel(e->image, pos, e->size_line, 0x00030);
}
}
}
/*
** Prints menu's frame
*/
void print_menu_win(t_data *e)
{
if (e->menu == 1)
print_shown(e);
else
print_hidden(e);
}
/*
** Prints menu's text
*/
void print_menu(t_data *e)
{
if (e->menu == 0)
mlx_string_put(e->mlx, e->win, 10, 115, 0xDDDDDD, M_PROMPT);
else
{
mlx_string_put(e->mlx, e->win, 10, 105 + 13, 0xDDDDDD, CONTROLS);
mlx_string_put(e->mlx, e->win, 10, 120 + 34, 0xDDDDDD, M_UP_DOWN);
mlx_string_put(e->mlx, e->win, 10, 120 + 52, 0xDDDDDD, M_LEFT_RIGHT);
mlx_string_put(e->mlx, e->win, 10, 120 + 70, 0xDDDDDD, M_MOVE_SPEED);
mlx_string_put(e->mlx, e->win, 10, 120 + 88, 0xDDDDDD, M_ZOOM);
mlx_string_put(e->mlx, e->win, 10, 120 + 106, 0xDDDDDD, M_ROTATE);
mlx_string_put(e->mlx, e->win, 10, 120 + 124, 0xDDDDDD, M_HEIGHT);
mlx_string_put(e->mlx, e->win, 10, 120 + 142, 0xDDDDDD, M_COLOR);
mlx_string_put(e->mlx, e->win, 10, 120 + 178, 0xDDDDDD, M_DISPLAY_ISO);
mlx_string_put(e->mlx, e->win, 10, 120 + 196, 0xDDDDDD, M_DISPLAY_PAR);
mlx_string_put(e->mlx, e->win, 10, 120 + 232, 0xDDDDDD, M_CLOSE_MENU);
mlx_string_put(e->mlx, e->win, 10, 120 + 250, 0xDDDDDD, M_RESET);
mlx_string_put(e->mlx, e->win, 10, 120 + 268, 0xDDDDDD, M_EXIT);
}
}
/*
** Basic border printing with given heights
*/
void print_borders(t_data *e)
{
t_pos position;
position.x = -1;
while (++position.x < WIN_W)
{
position.y = -1;
while (++position.y < 100)
{
if (position.y < 75)
image_put_pixel(e->image, position, e->size_line, 0x1F7070);
else
image_put_pixel(e->image, position, e->size_line, 0x134340);
}
}
position.x = -1;
while (++position.x < WIN_W)
{
position.y = WIN_H - 1;
while (--position.y >= WIN_H - 100)
if (position.y > WIN_H - 75)
image_put_pixel(e->image, position, e->size_line, 0x1F7070);
else
image_put_pixel(e->image, position, e->size_line, 0x134340);
}
mlx_string_put(e->mlx, e->win, WIN_W / 2 - 75, 25, 0xDDDDDD, BORDER_NAME);
}