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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fodor Ágoston
bevprog2bead3
Commits
f9ca900a
Commit
f9ca900a
authored
1 year ago
by
Fodor Ágoston
Browse files
Options
Downloads
Patches
Plain Diff
pálya betöltés kezdetlegesen
parent
7d0108d7
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
application.cpp
+8
-9
8 additions, 9 deletions
application.cpp
main.cpp
+27
-7
27 additions, 7 deletions
main.cpp
spinbox.cpp
+2
-2
2 additions, 2 deletions
spinbox.cpp
spinbox.hpp
+1
-1
1 addition, 1 deletion
spinbox.hpp
with
38 additions
and
19 deletions
application.cpp
+
8
−
9
View file @
f9ca900a
...
...
@@ -50,10 +50,10 @@ void Application::event_loop()
if
(
focus
!=
-
1
)
{
widgets
[
focus
]
->
handle
(
ev
);
for
(
int
k
=
0
;
k
<
81
;
k
+=
9
)
{
for
(
int
i
=
k
;
i
<
9
+
k
;
++
i
)
{
for
(
size_
t
j
=
i
+
1
;
j
<
9
+
k
;
++
j
)
{
if
(
widgets
[
i
]
->
getter
()
==
widgets
[
j
]
->
getter
())
{
wrongi
=
j
;
for
(
int
i
=
k
;
i
<
9
+
k
;
++
i
)
{
for
(
in
t
j
=
i
+
1
;
j
<
9
+
k
;
++
j
)
{
if
(
widgets
[
i
]
->
getter
()
!=
0
&&
widgets
[
i
]
->
getter
()
==
widgets
[
j
]
->
getter
())
{
wrongi
=
i
;
break
;
}
}
...
...
@@ -66,12 +66,11 @@ void Application::event_loop()
}
}
for
(
int
k
=
0
;
k
<
9
;
++
k
)
{
for
(
int
i
=
k
;
i
<
81
;
i
+=
9
)
{
for
(
size_
t
j
=
i
+
9
;
j
<
81
;
j
+=
9
)
{
if
(
widgets
[
i
]
->
getter
()
==
widgets
[
j
]
->
getter
())
{
wrongi
=
j
;
for
(
in
t
j
=
i
+
9
;
j
<
81
;
j
+=
9
)
{
if
(
widgets
[
i
]
->
getter
()
!=
0
&&
widgets
[
i
]
->
getter
()
==
widgets
[
j
]
->
getter
())
{
wrongi
=
i
;
break
;
}
}
...
...
@@ -123,7 +122,7 @@ void Application::event_loop()
}
}
gout
<<
refresh
;
std
::
cout
<<
widgets
[
11
]
->
getter
()
<<
std
::
endl
;
}
}
This diff is collapsed.
Click to expand it.
main.cpp
+
27
−
7
View file @
f9ca900a
#include
<iostream>
#include
"application.hpp"
#include
"spinbox.hpp"
#include
<vector>
#include
"widget.hpp"
using
namespace
genv
;
using
namespace
std
;
...
...
@@ -17,23 +17,43 @@ public:
void
palya
()
{
vector
<
vector
<
int
>>
board
=
{
{
5
,
3
,
0
,
0
,
7
,
0
,
0
,
0
,
0
},
{
6
,
0
,
0
,
1
,
9
,
5
,
0
,
0
,
0
},
{
0
,
9
,
8
,
0
,
0
,
0
,
0
,
6
,
0
},
{
8
,
0
,
0
,
0
,
6
,
0
,
0
,
0
,
3
},
{
4
,
0
,
0
,
8
,
0
,
3
,
0
,
0
,
1
},
{
7
,
0
,
0
,
0
,
2
,
0
,
0
,
0
,
6
},
{
0
,
6
,
0
,
0
,
0
,
0
,
2
,
8
,
0
},
{
0
,
0
,
0
,
4
,
1
,
9
,
0
,
0
,
5
},
{
0
,
0
,
0
,
0
,
8
,
0
,
0
,
7
,
9
}
};
for
(
int
i
=
0
;
i
<
9
;
++
i
)
{
vector
<
SpinBox
*>
rowWidgets
;
// Az adott sorhoz tartozó SpinBox-ok
vector
<
SpinBox
*>
rowWidgets
;
for
(
int
j
=
0
;
j
<
9
;
++
j
)
{
SpinBox
*
sp
=
new
SpinBox
(
this
,
5
+
j
*
100
,
5
+
i
*
100
,
100
,
0
,
9
);
rowWidgets
.
push_back
(
sp
);
// Hozzáadjuk az új SpinBox-ot az aktuális sorhoz
SpinBox
*
spin
;
if
(
board
[
i
][
j
]
!=
0
)
{
spin
=
new
SpinBox
(
this
,
5
+
j
*
100
,
5
+
i
*
100
,
100
,
board
[
i
][
j
],
board
[
i
][
j
],
board
[
i
][
j
]);
}
else
{
spin
=
new
SpinBox
(
this
,
5
+
j
*
100
,
5
+
i
*
100
,
100
,
0
,
9
,
0
);
}
rowWidgets
.
push_back
(
spin
);
}
// Hozzáadjuk az aktuális sorhoz tartozó widgeteket a teljes widget listához
widgets
.
push_back
(
rowWidgets
);
}
}
protected
:
vector
<
vector
<
SpinBox
*>>
widgets
;
// Kétdimenziós vektor a sorok és oszlopok kezelésére
vector
<
vector
<
SpinBox
*>>
widgets
;
};
int
main
()
...
...
This diff is collapsed.
Click to expand it.
spinbox.cpp
+
2
−
2
View file @
f9ca900a
...
...
@@ -9,9 +9,9 @@ using namespace std;
int
mouse_x
=
0
;
int
mouse_y
=
0
;
SpinBox
::
SpinBox
(
Application
*
parent
,
int
x
,
int
y
,
int
sizey
,
int
min
,
int
max
)
:
Widget
(
parent
,
x
,
y
,
sizey
*
3
,
sizey
),
_min
(
min
),
_max
(
max
),
_isselected
(
0
)
SpinBox
::
SpinBox
(
Application
*
parent
,
int
x
,
int
y
,
int
sizey
,
int
min
,
int
max
,
int
start
)
:
Widget
(
parent
,
x
,
y
,
sizey
*
3
,
sizey
),
_min
(
min
),
_max
(
max
),
_num
(
start
),
_isselected
(
0
)
{
_num
=
0
;
}
void
SpinBox
::
draw
()
...
...
This diff is collapsed.
Click to expand it.
spinbox.hpp
+
1
−
1
View file @
f9ca900a
...
...
@@ -10,7 +10,7 @@ protected:
bool
_isselected
;
public:
SpinBox
(
Application
*
,
int
,
int
,
int
,
int
,
int
);
SpinBox
(
Application
*
,
int
,
int
,
int
,
int
,
int
,
int
);
void
draw
()
override
;
void
handle
(
genv
::
event
)
override
;
...
...
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