Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cpp-project
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
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Maul
cpp-project
Commits
a34e12d6
Commit
a34e12d6
authored
5 months ago
by
Frederik
Browse files
Options
Downloads
Patches
Plain Diff
remove mousclick handlers
parent
b75c9897
No related branches found
No related tags found
1 merge request
!29
Merge main into box2d to implement physics
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/game/Level.cpp
+8
-51
8 additions, 51 deletions
src/game/Level.cpp
with
8 additions
and
51 deletions
src/game/Level.cpp
+
8
−
51
View file @
a34e12d6
...
...
@@ -81,7 +81,8 @@ std::shared_ptr<Level> Level::loadLevel(const std::string& path, Engine& engine)
std
::
string
name
=
pt
.
get
<
std
::
string
>
(
"level.name"
);
// if level is smaler than 20x20 surround with water tiles
if
(
width
<
20
||
height
<
20
)
{
if
(
width
<
20
||
height
<
20
)
{
int
w_start
=
(
20
-
width
)
/
2
;
int
h_start
=
(
20
-
height
)
/
2
;
std
::
vector
<
uint8_t
>
transformed_tiles_array
;
...
...
@@ -96,7 +97,8 @@ std::shared_ptr<Level> Level::loadLevel(const std::string& path, Engine& engine)
}
else
{
transformed_tiles_array
.
push_back
(
level_tilesarray
[
x
-
w_start
+
(
y
-
h_start
)
*
width
]);
transformed_tiles_array
.
push_back
(
level_tilesarray
[
x
-
w_start
+
(
y
-
h_start
)
*
width
]);
}
}
}
...
...
@@ -774,34 +776,6 @@ void Level::handleSelectingEvents(Engine& engine, SDL_Event& event)
}
}
break
;
case
SDL_MOUSEBUTTONDOWN
:
if
(
event
.
button
.
button
==
SDL_BUTTON_LEFT
)
{
selectEntity
(
event
.
button
.
x
,
event
.
button
.
y
);
if
(
m_selectedUnit
>=
0
||
m_selectedBuilding
>=
0
)
{
std
::
pair
<
int
,
int
>
tilePos
=
calcTilePos
(
event
.
button
.
x
,
event
.
button
.
y
);
m_currentPos
.
setPosition
(
tilePos
.
first
,
tilePos
.
second
);
m_contextMenu
.
update
(
(
tilePos
.
first
*
16
+
15
)
*
RENDERING_SCALE
,
(
tilePos
.
second
*
16
+
15
)
*
RENDERING_SCALE
);
if
(
m_selectedUnit
>=
0
)
{
m_contextMenu
.
setOptions
({
"Move"
,
"Attack"
,
"Info"
,
"Wait"
});
}
else
{
m_contextMenu
.
setOptions
({
"Train"
,
"Info"
,
"Wait"
});
}
m_state
=
LevelState
::
MENUACTIVE_STATE
;
}
else
{
m_showReachableTiles
=
false
;
m_showAttackableTiles
=
false
;
m_state
=
LevelState
::
SELECTING_STATE
;
}
}
default
:
break
;
}
...
...
@@ -938,15 +912,6 @@ void Level::handleMovementEvents(Engine& engine, SDL_Event& event)
m_state
=
LevelState
::
MENUACTIVE_STATE
;
}
break
;
case
SDL_MOUSEBUTTONDOWN
:
if
(
event
.
button
.
button
==
SDL_BUTTON_LEFT
)
{
// Bei Movement animation in ANIMATING_STATE gehen
std
::
pair
<
int
,
int
>
tilePos
=
calcTilePos
(
event
.
button
.
x
,
event
.
button
.
y
);
m_currentPos
.
setPosition
(
tilePos
.
first
,
tilePos
.
second
);
handleMovement
(
tilePos
);
}
break
;
default
:
break
;
}
...
...
@@ -973,14 +938,6 @@ void Level::handleAttackingEvents(Engine& engine, SDL_Event& event)
handleAttack
(
m_currentPos
.
getPosition
());
}
break
;
case
SDL_MOUSEBUTTONDOWN
:
if
(
event
.
button
.
button
==
SDL_BUTTON_LEFT
)
{
std
::
pair
<
int
,
int
>
tilePos
=
calcTilePos
(
event
.
button
.
x
,
event
.
button
.
y
);
m_currentPos
.
setPosition
(
tilePos
.
first
,
tilePos
.
second
);
handleAttack
(
tilePos
);
}
break
;
default
:
break
;
}
...
...
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