Commit Graph

3 Commits

Author SHA1 Message Date
aditya-K2
c943b936b9 More Test Cases 2021-11-12 14:26:06 +05:30
aditya-K2
482978897d Added Default Mappings
Following Changes Have been made:

    1.  Rename KMAP -> SPECIAL_KEYS
    2.  Added Default Mappings through KEY_MAPPINGS
	so when the config is read it will change the KEY_MAPPINGS map
	which will be then used by the handler function for events.
2021-11-11 23:24:58 +05:30
aditya-K2
9c039a8681 Reading Mappings from config file
Following Changes have been made in addition to
`1572a460b0`

    1. config.go :

	ReadMappings Reads Array for each function
	Basically we are going to define mappings like this :

	```yml

	    Function :
		- first mapping
		- second mapping
		- third mapping

	`````

    2. kMap.go :

	GetAsciiValues will help us to get e.Rune() for the event for
	the handler function. So basically we will have a keymappings map
	generated which will help us to handle events.

	    for e.g

		if an user has defined following mappings

	````yml

	    togglePlayBack :
		- P
		- p
		- B

	````

		then the keymappings map will look like this

	    []keymappings = {
		GetAsciiValues("P") : togglePlayBack(),
		GetAsciiValues("p") : togglePlayBack(),
		GetAsciiValues("B") : togglePlayBack(),
	    }

	    so when the handler function will get an event e
	    we will just pass it to this keymappings map i.e

		keymappings[e] which will return the function
2021-11-11 22:03:35 +05:30