changed KEY_ENTER into NEWLINE. made separate module for naming keys
This commit is contained in:
parent
f6009eb181
commit
21e88c05d8
|
@ -82,10 +82,11 @@ The idea is to make 3 different kind of areas:
|
|||
|
||||
## TODO first
|
||||
|
||||
- custom getstr
|
||||
- tiled soil
|
||||
- chat colours
|
||||
- trading
|
||||
- currency?
|
||||
- refactor display
|
||||
- authentication
|
||||
- labels
|
||||
- make farming more work
|
||||
|
@ -110,6 +111,7 @@ The idea is to make 3 different kind of areas:
|
|||
|
||||
- world chat
|
||||
- chat scrolling
|
||||
- refactor display
|
||||
- typable commands
|
||||
- fix window resizing
|
||||
- transparent background on sprites
|
||||
|
|
|
@ -67,5 +67,9 @@ class Window:
|
|||
x, y = pos
|
||||
return self.win.getstr(y, x)
|
||||
|
||||
def getCh(self, pos):
|
||||
x, y = pos
|
||||
return self.win.getch(y, x)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,15 +1,6 @@
|
|||
|
||||
(require [asciifarm.client.keymacros [*]])
|
||||
(import [curses])
|
||||
|
||||
(setv prenamedkeys { ; or should this be def?
|
||||
10 "KEY_ENTER"
|
||||
})
|
||||
|
||||
(defn nameFromKey [key]
|
||||
(if (in key prenamedkeys)
|
||||
(get prenamedkeys key)
|
||||
(str (curses.keyname key) "utf-8")))
|
||||
(import [asciifarm.client.keynames [nameFromKey]])
|
||||
|
||||
(defclass InputHandler []
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
import curses
|
||||
|
||||
prenamed = {
|
||||
10: "NEWLINE"
|
||||
}
|
||||
|
||||
def nameFromKey(key):
|
||||
if key in prenamed:
|
||||
return prenamed[key]
|
||||
return str(curses.keyname(key), "utf-8")
|
|
@ -26,7 +26,7 @@
|
|||
(inp ["attack" "east"])
|
||||
(inp ["attack" "west"])])
|
||||
"t" (self.parseMessage (self.display.getString))
|
||||
"KEY_ENTER" (self.parseMessage (self.display.getString))
|
||||
"NEWLINE" (self.parseMessage (self.display.getString))
|
||||
"KEY_PPAGE" (self.display.scrollBack 1)
|
||||
"KEY_NPAGE" (self.display.scrollBack -1)
|
||||
"help" "\
|
||||
|
|
Loading…
Reference in New Issue