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
68246cb2
Commit
68246cb2
authored
Apr 28, 2022
by
Felix Huther
Browse files
small changes mainly at TermUI and DungeonCrawler.play
parent
d3a379c6
Changes
9
Hide whitespace changes
Inline
Side-by-side
Praktika/Pratika1/DungeonCrawlerBase/abstractui.h
View file @
68246cb2
#ifndef ABSTRACTUI_H
#define ABSTRACTUI_H
#pragma once
#include
"level.h"
class
AbstractUI
...
...
@@ -8,6 +7,7 @@ class AbstractUI
public:
AbstractUI
();
virtual
void
draw
(
Level
*
lvl
)
=
0
;
virtual
void
userInterface
()
=
0
;
};
#endif // ABSTRACTUI_H
Praktika/Pratika1/DungeonCrawlerBase/character.h
View file @
68246cb2
#ifndef CHARACTER_H
#define CHARACTER_H
//#include "tile.h"
#include
<string>
class
Tile
;
...
...
Praktika/Pratika1/DungeonCrawlerBase/dungeoncrawler.cpp
View file @
68246cb2
#include
"dungeoncrawler.h"
DungeonCrawler
::
DungeonCrawler
(
AbstractUI
*
abstractUi
,
Level
*
currentLevel
)
:
abstractUi
(
abstractUi
)
:
abstractUi
(
abstractUi
)
,
currentLevel
(
currentLevel
)
{
this
->
levels
.
push_back
(
currentLevel
);
}
void
DungeonCrawler
::
play
()
{
currentLevel
->
setLevelStructure
();
std
::
string
texture
=
"metal"
;
Character
*
TestChar
=
new
Character
(
texture
);
if
(
currentLevel
->
getCharacter
()
==
nullptr
)
{
const
int
column
=
1
;
const
int
row
=
1
;
Position2D
pos
=
Position2D
(
row
,
column
);
currentLevel
->
placeCharacter
(
TestChar
,
pos
);
}
while
(
true
){
abstractUi
->
userInterface
();
abstractUi
->
draw
(
currentLevel
);
}
}
Praktika/Pratika1/DungeonCrawlerBase/dungeoncrawler.h
View file @
68246cb2
...
...
@@ -12,7 +12,7 @@ public:
private:
AbstractUI
*
abstractUi
;
std
::
vector
<
Level
*>
l
evel
s
;
Level
*
currentL
evel
;
};
...
...
Praktika/Pratika1/DungeonCrawlerBase/level.cpp
View file @
68246cb2
...
...
@@ -3,7 +3,7 @@
Level
::
Level
(
int
height
,
int
width
)
:
height
(
height
),
width
(
width
)
:
height
(
height
),
width
(
width
)
,
character
(
nullptr
)
{
}
...
...
@@ -89,4 +89,9 @@ void Level::setLevelStructure()
// }
}
Character
*
Level
::
getCharacter
()
const
{
return
character
;
}
Praktika/Pratika1/DungeonCrawlerBase/level.h
View file @
68246cb2
#ifndef LEVEL_H
#define LEVEL_H
#pragma once
#include
"tile.h"
#include
"floor.h"
#include
"wall.h"
...
...
@@ -24,6 +23,8 @@ public:
int
getWidth
()
const
;
Character
*
getCharacter
()
const
;
private:
const
int
height
;
const
int
width
;
...
...
Praktika/Pratika1/DungeonCrawlerBase/main.cpp
View file @
68246cb2
...
...
@@ -6,13 +6,10 @@ using namespace std;
int
main
()
{
Terminal
UI
*
termUI
=
new
TerminalUI
();
Abstract
UI
*
termUI
=
new
TerminalUI
();
Level
*
level
=
new
Level
(
10
,
10
);
level
->
setLevelStructure
();
termUI
->
interface
();
// DungeonCrawler* dungeonCraler = new DungeonCrawler(termUI,level);
termUI
->
draw
(
level
);
DungeonCrawler
dungeonCrawler
(
termUI
,
level
);
dungeonCrawler
.
play
();
return
0
;
}
Praktika/Pratika1/DungeonCrawlerBase/terminalui.cpp
View file @
68246cb2
...
...
@@ -23,7 +23,7 @@ void TerminalUI::draw(Level *lvl)
}
}
void
TerminalUI
::
i
nterface
()
void
TerminalUI
::
userI
nterface
()
{
cout
<<
"Welcome to the DungeonCrawler Game
\n
"
;
...
...
@@ -31,20 +31,14 @@ void TerminalUI::interface()
int
UserOperation
=
{};
cout
<<
"Tell me your desires
\n
"
<<
"1: Create a field
\n
"
<<
"2: Enter the Dungeon
\n
"
<<
"1: Enter the Dungeon
\n
"
<<
"0: Exit
\n
"
;
cin
>>
UserOperation
;
switch
(
UserOperation
)
{
case
1
:
int
height
,
width
;
cout
<<
"height
\n
>"
;
cin
>>
height
;
cout
<<
"
\n
width
\n
>"
;
cin
>>
width
;
std
::
cout
<<
endl
;
Level
*
level
=
new
Level
(
height
,
width
);
level
->
setLevelStructure
();
case
1
:
{
cout
<<
"You entered the Dungeon
\n
"
;
return
;
}
}
}
...
...
Praktika/Pratika1/DungeonCrawlerBase/terminalui.h
View file @
68246cb2
...
...
@@ -10,7 +10,7 @@ public:
// AbstractUI interface
void
draw
(
Level
*
lvl
)
override
;
void
i
nterface
();
void
userI
nterface
()
override
;
void
levelInterface
();
};
...
...
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