fullwidth characters work now too
This commit is contained in:
parent
31d9ac0778
commit
d2d6448793
|
@ -82,6 +82,7 @@ The idea is to make 3 different kind of areas:
|
|||
|
||||
## DONE
|
||||
|
||||
- fullwidth characters as sprites
|
||||
- load world from files
|
||||
- more content (rooms, objects etc)
|
||||
- multiple socket types (regular unix, abstract unix, inet), selectable as command line arguments
|
||||
|
|
|
@ -26,5 +26,6 @@
|
|||
"troll": "T",
|
||||
" ": " "
|
||||
},
|
||||
"default": "?"
|
||||
"default": "?",
|
||||
"charwidth": 1
|
||||
}
|
||||
|
|
|
@ -45,7 +45,8 @@ class Client:
|
|||
self.fieldHeight = 0
|
||||
|
||||
self.characters = characters["mapping"]
|
||||
self.defaultChar = characters["default"]
|
||||
self.defaultChar = characters.get("default", '?')
|
||||
self.charWidth = characters.get("charwidth", 1)
|
||||
|
||||
threading.Thread(target=self.listen, daemon=True).start()
|
||||
self.command_loop()
|
||||
|
@ -79,12 +80,12 @@ class Client:
|
|||
) for y in range(self.fieldHeight)
|
||||
)
|
||||
if outputstring != self.lastoutputstring:
|
||||
self.screen.put(outputstring, self.fieldWidth, self.fieldHeight)
|
||||
self.screen.put(outputstring, self.fieldWidth*self.charWidth, self.fieldHeight)
|
||||
self.lastoutputstring = outputstring
|
||||
|
||||
if 'changecells' in data and len(data['changecells']):
|
||||
self.screen.changeCells((
|
||||
(x, y, self.characters.get(sprite, self.defaultChar))
|
||||
(x*self.charWidth, y, self.characters.get(sprite, self.defaultChar))
|
||||
for ((x, y), sprite) in data['changecells']
|
||||
), self.fieldWidth, self.fieldHeight)
|
||||
|
||||
|
@ -92,7 +93,7 @@ class Client:
|
|||
infostring = json.dumps(data['info'], indent=2)
|
||||
infostring += "\n\n" + self.controlsString
|
||||
if infostring != self.lastinfostring:
|
||||
self.screen.putPlayers(infostring, self.fieldWidth+2)
|
||||
self.screen.putPlayers(infostring, self.fieldWidth*self.charWidth+2)
|
||||
self.lastinfostring = infostring
|
||||
self.screen.refresh()
|
||||
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"mapping":{
|
||||
"tree": "T",
|
||||
"wall": "#",
|
||||
"rock": "X",
|
||||
"stone": "o",
|
||||
"pebble": "*",
|
||||
"player": "@",
|
||||
"ground": ".",
|
||||
"grass1": ",",
|
||||
"grass2": "'",
|
||||
"grass3": "`",
|
||||
"rabbit": "r",
|
||||
"water": "~",
|
||||
"floor": "+",
|
||||
"portal": "$",
|
||||
"stairdown": ">",
|
||||
"stairup": "<",
|
||||
"dummy": "d",
|
||||
"spikes": "^",
|
||||
"goblin": "g",
|
||||
"seed": ":",
|
||||
"plant": "Y",
|
||||
"youngplant": "v",
|
||||
"food": "8",
|
||||
"troll": "T",
|
||||
" ": " "
|
||||
},
|
||||
"default": "?",
|
||||
"charwidth": 2
|
||||
}
|
Loading…
Reference in New Issue