Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
beadandó 3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Borostyán József Bálint
beadandó 3
Commits
d1786791
Commit
d1786791
authored
1 month ago
by
Borostyán József Bálint
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
3b040fb7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
menu.cpp
+35
-0
35 additions, 0 deletions
menu.cpp
with
35 additions
and
0 deletions
menu.cpp
0 → 100644
+
35
−
0
View file @
d1786791
#include
"menu.hpp"
#include
"graphics.hpp"
using
namespace
genv
;
Menu
::
Menu
(
int
x
,
int
y
,
int
w
,
int
h
,
std
::
function
<
void
()
>
start_callback
)
:
Widget
(
x
,
y
,
w
,
h
),
on_start
(
start_callback
)
{}
void
Menu
::
draw
()
const
{
// hatter
gout
<<
color
(
30
,
30
,
30
)
<<
move_to
(
x
,
y
)
<<
box
(
width
,
height
);
// cim
gout
<<
font
(
"LiberationSans-Bold.ttf"
,
50
);
gout
<<
move_to
(
x
+
width
/
2
-
180
,
y
+
50
);
gout
<<
color
(
255
,
0
,
0
)
<<
text
(
"Connect"
);
gout
<<
color
(
255
,
255
,
0
)
<<
text
(
" Four"
);
// START
gout
<<
color
(
200
,
200
,
200
)
<<
move_to
(
x
+
width
/
2
-
60
,
y
+
150
)
<<
box
(
120
,
50
);
gout
<<
color
(
0
,
0
,
0
)
<<
move_to
(
x
+
width
/
2
-
30
,
y
+
180
)
<<
text
(
"START"
);
}
void
Menu
::
handle
(
event
ev
)
{
if
(
ev
.
type
==
ev_mouse
&&
ev
.
button
==
btn_left
)
{
int
mx
=
ev
.
pos_x
;
int
my
=
ev
.
pos_y
;
if
(
mx
>=
x
+
width
/
2
-
60
&&
mx
<=
x
+
width
/
2
+
60
&&
my
>=
y
+
150
&&
my
<=
y
+
200
)
{
on_start
();
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment