Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Felix Huther
Programmieren2
Commits
b22cb79a
Commit
b22cb79a
authored
Jun 21, 2022
by
Felix Huther
Browse files
pit and ramp
parent
61b1f2a1
Changes
12
Hide whitespace changes
Inline
Side-by-side
DungeonCrawler/DungeonGame/DungeonGame.pro
View file @
b22cb79a
...
...
@@ -6,6 +6,7 @@ CONFIG -= qt
SOURCES
+=
\
abstractui
.
cpp
\
character
.
cpp
\
controller
.
cpp
\
door
.
cpp
\
dungeoncrawler
.
cpp
\
floor
.
cpp
\
...
...
@@ -25,6 +26,7 @@ SOURCES += \
HEADERS
+=
\
abstractui
.
h
\
character
.
h
\
controller
.
h
\
door
.
h
\
dungeoncrawler
.
h
\
floor
.
h
\
...
...
DungeonCrawler/DungeonGame/abstractui.h
View file @
b22cb79a
...
...
@@ -10,10 +10,6 @@ public:
virtual
void
draw
(
Level
*
pLevel
)
=
0
;
virtual
char
askMoveFromUser
()
=
0
;
protected:
Level
*
mCurrentLevel
;
};
...
...
DungeonCrawler/DungeonGame/controller.cpp
0 → 100644
View file @
b22cb79a
#include
"controller.h"
Controller
::
Controller
()
{
}
DungeonCrawler/DungeonGame/controller.h
0 → 100644
View file @
b22cb79a
#ifndef CONTROLLER_H
#define CONTROLLER_H
class
Controller
{
public:
Controller
();
virtual
char
askMoveFromUser
()
=
0
;
};
#endif // CONTROLLER_H
DungeonCrawler/DungeonGame/dungeoncrawler.cpp
View file @
b22cb79a
...
...
@@ -47,7 +47,10 @@ void DungeonCrawler::play() {
system
(
"CLS"
);
mUserInterface
->
draw
(
mCurrentLevel
);
movingDirection
=
mUserInterface
->
askMoveFromUser
();
TerminalUI
*
termUI
=
static_cast
<
TerminalUI
*>
(
mUserInterface
);
movingDirection
=
termUI
->
askMoveFromUser
();
switch
(
movingDirection
)
{
case
'w'
:
{
int
oneRowUp
=
characterPos
.
getRow
()
-
1
;
...
...
DungeonCrawler/DungeonGame/dungeoncrawler.h
View file @
b22cb79a
...
...
@@ -4,6 +4,7 @@
#include
"level.h"
#include
"character.h"
#include
"abstractui.h"
#include
"terminalui.h"
class
AbstractUI
;
class
DungeonCrawler
{
...
...
DungeonCrawler/DungeonGame/floor.cpp
View file @
b22cb79a
...
...
@@ -9,6 +9,7 @@ Floor::~Floor()
delete
currentCharacter
;
}
Tile
*
Floor
::
onEnter
(
Tile
*
fromTile
,
Character
*
who
)
{
if
(
typeid
(
*
fromTile
)
==
typeid
(
Pit
))
{
...
...
DungeonCrawler/DungeonGame/floor.h
View file @
b22cb79a
...
...
@@ -10,6 +10,8 @@ public:
Floor
(
const
std
::
string
&
texture
,
Character
*
currentCharacter
,
const
Position2D
&
position
);
~
Floor
();
Floor
(
const
Floor
&
other
);
Tile
*
onEnter
(
Tile
*
fromTile
,
Character
*
who
)
override
;
bool
moveTo
(
Tile
*
destTile
,
Character
*
who
)
override
;
Tile
*
onLeave
(
Tile
*
destTile
,
Character
*
who
)
override
;
...
...
DungeonCrawler/DungeonGame/level.cpp
View file @
b22cb79a
...
...
@@ -5,6 +5,12 @@ Level::Level(int height,int width) : mwidth(width),mheight(height) {
setStructure
();
}
Level
::
Level
(
const
Level
&
other
)
:
mwidth
(
other
.
mwidth
),
mheight
(
other
.
mheight
)
{
}
int
Level
::
getHeight
()
const
{
return
mheight
;
}
...
...
DungeonCrawler/DungeonGame/level.h
View file @
b22cb79a
...
...
@@ -16,8 +16,8 @@ class Level {
//MEMBER VARIABLES
private:
const
int
mwidth
;
const
int
mheight
;
int
mwidth
;
int
mheight
;
Character
*
mcharacter
;
std
::
vector
<
std
::
vector
<
Tile
*>>
mLevel
;
...
...
@@ -28,6 +28,7 @@ private:
//CONSTRUCTOR AND DESTRUCTOR
public:
explicit
Level
(
int
height
,
int
width
);
Level
(
const
Level
&
other
);
~
Level
();
//GETTER AND SETTER
...
...
DungeonCrawler/DungeonGame/terminalui.h
View file @
b22cb79a
#ifndef TERMINALUI_H
#define TERMINALUI_H
#include
"abstractui.h"
#include
"controller.h"
class
TerminalUI
:
public
AbstractUI
{
class
TerminalUI
:
public
AbstractUI
,
public
Controller
{
public:
TerminalUI
(
Level
*
mCurrentLevel
);
~
TerminalUI
();
//AbstractUI interface
public:
void
draw
(
Level
*
pLevel
)
override
;
void
draw
(
Level
*
pLevel
)
override
;
// Controller interface
public:
char
askMoveFromUser
()
override
;
};
#endif // TERMINALUI_H
Praktika/NEWpraktika1/.idea/workspace.xml
0 → 100644
View file @
b22cb79a
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"CMakeRunConfigurationManager"
>
<generated>
<config
projectName=
"NEWpraktika1"
targetName=
"NEWpraktika1"
/>
</generated>
</component>
<component
name=
"CMakeSettings"
>
<configurations>
<configuration
PROFILE_NAME=
"Debug"
ENABLED=
"true"
CONFIG_NAME=
"Debug"
/>
</configurations>
</component>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"d5b360b0-c34a-4ada-b8c5-2e45a1dab924"
name=
"Changes"
comment=
""
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
<option
name=
"LAST_RESOLUTION"
value=
"IGNORE"
/>
</component>
<component
name=
"ClangdSettings"
>
<option
name=
"formatViaClangd"
value=
"false"
/>
</component>
<component
name=
"ExecutionTargetManager"
SELECTED_TARGET=
"CMakeBuildProfile:Debug"
/>
<component
name=
"Git.Settings"
>
<option
name=
"RECENT_GIT_ROOT_PATH"
value=
"$PROJECT_DIR$/../.."
/>
</component>
<component
name=
"HighlightingSettingsPerFile"
>
<setting
file=
"file://$PROJECT_DIR$/Level.cpp"
root0=
"SKIP_INSPECTION"
/>
</component>
<component
name=
"MarkdownSettingsMigration"
>
<option
name=
"stateVersion"
value=
"1"
/>
</component>
<component
name=
"ProjectApplicationVersion"
>
<option
name=
"ide"
value=
"CLion"
/>
<option
name=
"majorVersion"
value=
"2022"
/>
<option
name=
"minorVersion"
value=
"1"
/>
</component>
<component
name=
"ProjectId"
id=
"29OP8O4EnbKvHw8wOWpTjcwGRGQ"
/>
<component
name=
"ProjectLevelVcsManager"
settingsEditedManually=
"true"
/>
<component
name=
"ProjectViewState"
>
<option
name=
"hideEmptyMiddlePackages"
value=
"true"
/>
<option
name=
"showLibraryContents"
value=
"true"
/>
</component>
<component
name=
"PropertiesComponent"
>
{
"
keyToString
"
: {
"
RunOnceActivity.cidr.known.project.marker
"
:
"
true
"
,
"
WebServerToolWindowFactoryState
"
:
"
false
"
,
"
cf.first.check.clang-format
"
:
"
false
"
,
"
cidr.known.project.marker
"
:
"
true
"
,
"
cmake.loaded.for.project
"
:
"
true
"
,
"
last_opened_file_path
"
:
"
C:/Users/felix/Documents/GitLab/programmieren2/HoersaalUebungen/22.04.2022_Hoersaal/Hoersaal/Hoersaal.pro.user
"
}
}
</component>
<component
name=
"RunManager"
>
<configuration
name=
"NEWpraktika1"
type=
"CMakeRunConfiguration"
factoryName=
"Application"
REDIRECT_INPUT=
"false"
ELEVATE=
"false"
USE_EXTERNAL_CONSOLE=
"false"
PASS_PARENT_ENVS_2=
"true"
PROJECT_NAME=
"NEWpraktika1"
TARGET_NAME=
"NEWpraktika1"
CONFIG_NAME=
"Debug"
RUN_TARGET_PROJECT_NAME=
"NEWpraktika1"
RUN_TARGET_NAME=
"NEWpraktika1"
>
<method
v=
"2"
>
<option
name=
"com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask"
enabled=
"true"
/>
</method>
</configuration>
</component>
<component
name=
"SpellCheckerSettings"
RuntimeDictionaries=
"0"
Folders=
"0"
CustomDictionaries=
"0"
DefaultDictionary=
"application-level"
UseSingleDictionary=
"true"
transferred=
"true"
/>
<component
name=
"TaskManager"
>
<task
active=
"true"
id=
"Default"
summary=
"Default task"
>
<changelist
id=
"d5b360b0-c34a-4ada-b8c5-2e45a1dab924"
name=
"Changes"
comment=
""
/>
<created>
1652980999060
</created>
<option
name=
"number"
value=
"Default"
/>
<option
name=
"presentableId"
value=
"Default"
/>
<updated>
1652980999060
</updated>
<workItem
from=
"1652981000472"
duration=
"12588000"
/>
<workItem
from=
"1653024659543"
duration=
"45000"
/>
<workItem
from=
"1653041073291"
duration=
"1151000"
/>
<workItem
from=
"1653299928699"
duration=
"13000"
/>
<workItem
from=
"1654854534198"
duration=
"3904000"
/>
<workItem
from=
"1655039421786"
duration=
"58000"
/>
<workItem
from=
"1655051420822"
duration=
"42000"
/>
<workItem
from=
"1655315712004"
duration=
"24000"
/>
</task>
<servers
/>
</component>
<component
name=
"TypeScriptGeneratedFilesManager"
>
<option
name=
"version"
value=
"3"
/>
</component>
<component
name=
"Vcs.Log.Tabs.Properties"
>
<option
name=
"TAB_STATES"
>
<map>
<entry
key=
"MAIN"
>
<value>
<State
/>
</value>
</entry>
</map>
</option>
</component>
</project>
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment