Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bevprog2bead3
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fodor Ágoston
bevprog2bead3
Commits
7cf79a24
Commit
7cf79a24
authored
May 19, 2024
by
Fodor Ágoston
Browse files
Options
Downloads
Patches
Plain Diff
végleges verzió
parent
7c2c4c60
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
application.cpp
+68
-10
68 additions, 10 deletions
application.cpp
application.hpp
+3
-1
3 additions, 1 deletion
application.hpp
menu.cpp
+0
-2
0 additions, 2 deletions
menu.cpp
spinbox.cpp
+9
-2
9 additions, 2 deletions
spinbox.cpp
with
80 additions
and
15 deletions
application.cpp
+
68
−
10
View file @
7cf79a24
...
@@ -42,8 +42,36 @@ void Application :: board(int diffi)
...
@@ -42,8 +42,36 @@ void Application :: board(int diffi)
{
0
,
0
,
0
,
0
,
8
,
0
,
0
,
7
,
9
}
{
0
,
0
,
0
,
0
,
8
,
0
,
0
,
7
,
9
}
};
};
}
}
if
(
diffi
==
2
)
{
board
=
{
{
3
,
0
,
0
,
0
,
9
,
0
,
8
,
2
,
0
},
{
0
,
1
,
0
,
6
,
0
,
0
,
0
,
0
,
0
},
{
0
,
0
,
0
,
4
,
3
,
0
,
0
,
7
,
6
},
{
0
,
9
,
1
,
0
,
0
,
0
,
6
,
4
,
0
},
{
0
,
0
,
0
,
0
,
2
,
0
,
0
,
0
,
8
},
{
6
,
0
,
8
,
9
,
0
,
0
,
0
,
0
,
0
},
{
7
,
0
,
6
,
3
,
0
,
9
,
2
,
5
,
4
},
{
1
,
2
,
3
,
5
,
0
,
8
,
0
,
6
,
9
},
{
0
,
4
,
0
,
2
,
0
,
7
,
0
,
0
,
0
}
};
}
if
(
diffi
==
3
)
{
board
=
{
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
9
},
{
9
,
4
,
0
,
0
,
0
,
0
,
8
,
3
,
0
},
{
0
,
0
,
0
,
9
,
0
,
0
,
6
,
0
,
2
},
{
0
,
1
,
0
,
7
,
0
,
0
,
0
,
9
,
0
},
{
0
,
0
,
0
,
0
,
0
,
2
,
0
,
5
,
0
},
{
0
,
0
,
7
,
0
,
0
,
6
,
0
,
0
,
0
},
{
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
},
{
5
,
8
,
1
,
0
,
2
,
0
,
0
,
0
,
0
},
{
0
,
6
,
0
,
0
,
0
,
8
,
4
,
0
,
0
}
};
}
board_values
=
board
;
for
(
int
i
=
0
;
i
<
9
;
++
i
)
for
(
int
i
=
0
;
i
<
9
;
++
i
)
{
{
...
@@ -68,35 +96,45 @@ void Application :: board(int diffi)
...
@@ -68,35 +96,45 @@ void Application :: board(int diffi)
}
}
}
}
bool
Application
::
check_board
()
{
for
(
int
i
=
0
;
i
<
9
;
++
i
)
{
for
(
int
j
=
0
;
j
<
9
;
++
j
)
{
if
(
widgets2
[
i
][
j
]
->
getter
()
!=
board_values
[
i
][
j
])
{
return
false
;
}
}
}
return
true
;
}
void
Application
::
event_loop
()
void
Application
::
event_loop
()
{
{
Menu
m
;
int
wrongi
=
-
1
;
int
wrongi
=
-
1
;
event
ev
;
int
focus
=
-
1
;
int
focus
=
-
1
;
while
(
m
.
diffret
()
==
0
and
gin
>>
ev
)
{
event
ev
;
while
(
m
.
diffret
()
==
0
and
gin
>>
ev
)
{
m
.
draw
();
m
.
draw
();
m
.
handle
(
ev
);
m
.
handle
(
ev
);
gout
<<
refresh
;
gout
<<
refresh
;
if
(
ev
.
type
==
ev_key
and
ev
.
keycode
==
key_escape
)
{
break
;
}
}
}
board
(
m
.
diffret
());
board
(
m
.
diffret
());
while
(
gin
>>
ev
)
while
(
gin
>>
ev
)
{
{
if
(
ev
.
type
==
ev_mouse
&&
ev
.
button
==
btn_left
)
if
(
ev
.
type
==
ev_mouse
&&
ev
.
button
==
btn_left
)
{
{
for
(
size_t
i
=
0
;
i
<
widgets
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
widgets
.
size
();
i
++
)
...
@@ -190,6 +228,26 @@ void Application::event_loop()
...
@@ -190,6 +228,26 @@ void Application::event_loop()
{
{
break
;
break
;
}
}
int
rowsum
=
0
;
int
colsum
=
0
;
for
(
int
i
=
0
;
i
<
9
;
++
i
)
{
for
(
int
j
=
0
;
j
<
9
;
++
j
)
{
rowsum
+=
widgets2
[
i
][
j
]
->
getter
();
}
}
for
(
int
j
=
0
;
j
<
9
;
++
j
)
{
for
(
int
i
=
0
;
i
<
9
;
++
i
)
{
colsum
+=
widgets2
[
i
][
j
]
->
getter
();
}
}
if
(
colsum
==
9
*
45
and
rowsum
==
9
*
45
and
wrongi
==
-
1
)
{
break
;
}
gout
<<
refresh
;
gout
<<
refresh
;
...
...
This diff is collapsed.
Click to expand it.
application.hpp
+
3
−
1
View file @
7cf79a24
...
@@ -19,7 +19,7 @@ public:
...
@@ -19,7 +19,7 @@ public:
virtual
void
event_loop
();
virtual
void
event_loop
();
virtual
void
registerWidget
(
Widget
*
);
virtual
void
registerWidget
(
Widget
*
);
void
ellenoriz
(
std
::
vector
<
Widget
>
v
);
void
ellenoriz
(
std
::
vector
<
Widget
>
v
);
bool
check_board
();
void
board
(
int
);
void
board
(
int
);
...
@@ -29,6 +29,8 @@ public:
...
@@ -29,6 +29,8 @@ public:
protected:
protected:
std
::
vector
<
Widget
*>
widgets
;
std
::
vector
<
Widget
*>
widgets
;
std
::
vector
<
std
::
vector
<
SpinBox
*>>
widgets2
;
std
::
vector
<
std
::
vector
<
SpinBox
*>>
widgets2
;
Menu
m
;
std
::
vector
<
std
::
vector
<
int
>>
board_values
;
};
};
...
...
This diff is collapsed.
Click to expand it.
menu.cpp
+
0
−
2
View file @
7cf79a24
...
@@ -37,8 +37,6 @@ void Menu::handle(genv::event ev) {
...
@@ -37,8 +37,6 @@ void Menu::handle(genv::event ev) {
{
{
diffnum
=
3
;
diffnum
=
3
;
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
spinbox.cpp
+
9
−
2
View file @
7cf79a24
...
@@ -22,6 +22,7 @@ void SpinBox::draw()
...
@@ -22,6 +22,7 @@ void SpinBox::draw()
gout
<<
move_to
(
_x
+
2
*
_sizey
+
1
,
_y
+
1
)
<<
color
(
0
,
0
,
0
)
<<
box
(
_sizey
-
2
,
_sizey
-
2
);
gout
<<
move_to
(
_x
+
2
*
_sizey
+
1
,
_y
+
1
)
<<
color
(
0
,
0
,
0
)
<<
box
(
_sizey
-
2
,
_sizey
-
2
);
int
text_width
=
gout
.
twidth
(
to_string
(
_num
));
int
text_width
=
gout
.
twidth
(
to_string
(
_num
));
int
text_height
=
gout
.
cascent
()
+
gout
.
cdescent
();
int
text_height
=
gout
.
cascent
()
+
gout
.
cdescent
();
...
@@ -93,8 +94,14 @@ void SpinBox::handle(event ev)
...
@@ -93,8 +94,14 @@ void SpinBox::handle(event ev)
_isselected
=
false
;
_isselected
=
false
;
}
}
}
}
if
(
_isselected
and
ev
.
button
==
btn_wheeldown
and
_num
>=
_min
+
1
)
{
_num
-=
1
;
}
if
(
_isselected
and
ev
.
button
==
btn_wheelup
and
_num
<=
_max
-
1
)
{
_num
+=
1
;
}
}
}
else
if
(
ev
.
type
==
ev_key
)
else
if
(
ev
.
type
==
ev_key
)
...
...
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