-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
366 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
using System; | ||
|
||
namespace ConsoleApplication{ | ||
class GameplayWindow:IWindow{ | ||
|
||
int _sizeX; | ||
int _sizeY; | ||
int _positionX; | ||
int _positionY; | ||
char[,] _content; | ||
int tx,ty; | ||
public int sizeX{ | ||
get{ | ||
return _sizeX; | ||
} | ||
set{ | ||
_sizeX = value; | ||
} | ||
} | ||
|
||
public int sizeY{ | ||
get{ | ||
return _sizeY; | ||
} | ||
set{ | ||
_sizeY = value; | ||
} | ||
} | ||
|
||
public int positionX{ | ||
get{ | ||
return _positionX; | ||
} | ||
set{ | ||
_positionX = value; | ||
} | ||
} | ||
|
||
public int positionY{ | ||
get{ | ||
return _positionY; | ||
} | ||
set{ | ||
_positionY = value; | ||
} | ||
} | ||
|
||
public char[,] content{ | ||
get{ | ||
return _content; | ||
} | ||
set{ | ||
_content = value; | ||
} | ||
} | ||
|
||
public GameplayWindow(){ | ||
sizeX = 15; | ||
sizeY = 15; | ||
content = new char[sizeX,sizeY]; | ||
} | ||
public void Fill(Source s){ | ||
for(int i = 0; i < sizeX; i++){ | ||
for(int t = 0; t < sizeY; t++){ | ||
tx = s.playerX - sizeX/2 + i; | ||
ty = s.playerY - sizeY/2 + t; | ||
if(tx >= 0 & tx < s.GetDungeonW & ty >= 0 & ty < s.GetDungeonH) | ||
content[i,t] = s.GetMapObj[tx,ty].symbol; | ||
else | ||
content[i,t] = ' '; | ||
} | ||
} | ||
} | ||
|
||
public void Update(Source s){ | ||
for(int i = 0; i < sizeX; i++){ | ||
for(int t = 0; t < sizeY; t++){ | ||
tx = s.playerX - sizeX/2 + i; | ||
ty = s.playerY - sizeY/2 + t; | ||
if(tx >= 0 & tx < s.GetDungeonW & ty >= 0 & ty < s.GetDungeonH) | ||
content[i,t] = s.GetMapObj[tx,ty].symbol; | ||
else | ||
content[i,t] = ' '; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace ConsoleApplication{ | ||
interface IWindow{ | ||
int sizeX{get;set;} | ||
int sizeY{get;set;} | ||
int positionX{get;set;} | ||
int positionY{get;set;} | ||
|
||
char[,] content{get;set;} | ||
|
||
void Fill(Source s); | ||
void Update(Source s); | ||
} | ||
} |
Oops, something went wrong.