 
 		@timeManager.targets.push @entities...
 
-		@events.on 'key.c', (ch, key) =>
-			@quit() if key.ctrl
-
 	quit: ->
 		deinitialize @
 		process.exit 0
 
 	goState: (state) ->
+		@events.emit "state.exit.#{@state}", 'exit', @state
 		@state = state
+		@events.emit "state.enter.#{@state}", 'enter', @state
+
 		@renderer.invalidate()
 
 	main: ->
 		async.whilst (-> true),
 			(next) =>
 				switch @state
-					when 'main menu'
+					when 'main-menu'
 						@events.once 'key.s', =>
 							@goState 'game'
 							next()

		initialize @
		@renderer = new Renderer @

		@currentMap = new Map @, 50, 15

		@entities = [

async = require 'async'
{EventEmitter2: EventEmitter} = require 'eventemitter2'
MersenneTwister = require 'mersennetwister'

TimeManager = require './time-manager'
Random = require './random'
{Map} = require './map'

{Dummy, FastDummy, Player} = require './creatures'

{initialize, deinitialize, Renderer} = require './io/tty'

class Game
	constructor: ->
		# console.error 'Starting game...'
		@state = 'main-menu'

		@events = new EventEmitter
			wildcard: yes
			# newListener: yes
