Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
progBead3
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
Horváth Ádám
progBead3
Commits
8a340091
Commit
8a340091
authored
1 year ago
by
Horváth Ádám
Browse files
Options
Downloads
Patches
Plain Diff
lehet végleges
parent
d423b378
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
checkbox.cpp
+74
-0
74 additions, 0 deletions
checkbox.cpp
with
74 additions
and
0 deletions
checkbox.cpp
0 → 100644
+
74
−
0
View file @
8a340091
#include
"checkbox.hpp"
#include
<cmath>
using
namespace
genv
;
CheckBox
::
CheckBox
(
Application
*
parent
,
int
x
,
int
y
,
int
sx
,
int
sy
)
:
Widget
(
parent
,
x
,
y
,
sx
,
sy
),
_checked
(
false
),
_value
(
0
)
{}
void
CheckBox
::
draw
()
{
gout
<<
move_to
(
_x
,
_y
)
<<
color
(
0
,
255
,
255
)
<<
box
(
_size_x
,
_size_y
);
gout
<<
move_to
(
_x
+
2
,
_y
+
2
)
<<
color
(
0
,
0
,
0
)
<<
box
(
_size_x
-
4
,
_size_y
-
4
);
if
(
_value
%
2
==
0
&&
_value
!=
0
)
{
drawCross
(
_x
+
4
,
_y
+
4
,
_size_x
-
8
,
_size_y
-
8
,
255
,
0
,
0
);
}
if
(
_value
%
2
==
1
&&
_value
!=
0
)
{
drawCircle
(
_x
+
_size_x
/
2
,
_y
+
_size_y
/
2
,
_size_x
/
2
-
3
,
0
,
255
,
0
);
}
}
void
CheckBox
::
drawCross
(
int
x
,
int
y
,
int
width
,
int
height
,
int
r
,
int
g
,
int
b
)
{
gout
<<
color
(
r
,
g
,
b
);
gout
<<
move_to
(
x
,
y
)
<<
line
(
width
,
height
);
gout
<<
move_to
(
x
+
1
,
y
)
<<
line
(
width
,
height
);
gout
<<
move_to
(
x
+
width
,
y
)
<<
line
(
-
width
,
height
);
gout
<<
move_to
(
x
+
width
-
1
,
y
)
<<
line
(
-
width
,
height
);
}
void
CheckBox
::
drawCircle
(
int
x
,
int
y
,
int
radius
,
int
r
,
int
g
,
int
b
)
{
gout
<<
color
(
r
,
g
,
b
);
for
(
int
i
=
-
radius
;
i
<
radius
;
i
++
)
{
for
(
int
j
=
-
radius
;
j
<
radius
;
j
++
)
{
if
(
i
*
i
+
j
*
j
<
pow
(
radius
,
2
))
{
gout
<<
move_to
(
x
+
i
,
y
+
j
)
<<
dot
;
}
}
}
}
void
CheckBox
::
handle
(
event
ev
)
{
if
(
ev
.
type
==
ev_mouse
&&
is_selected
(
ev
.
pos_x
,
ev
.
pos_y
)
&&
ev
.
button
==
btn_left
&&
!
_checked
)
{
_checked
=
true
;
}
}
bool
CheckBox
::
is_checked
()
{
return
_checked
;
}
void
CheckBox
::
value
(
int
sz
)
{
_value
=
sz
;
}
int
CheckBox
::
value_sz
()
{
return
_value
;
}
int
CheckBox
::
getPlayerValue
()
const
{
return
playerValue
;
}
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