function love.load()
	logging = true
	loveMemUsage = collectgarbage("count")
	loveInitLog = "love: "..loveMemUsage.." kB, time: "..os.clock().." seconds"
	arrow = 0

	menu_type = "no"
	debug = false
	debug_collision = false
	editor_mode = false

	textScale = 1
	fps_count = 0
	fps_second = 0
	fps_draw = 0
	fps_total = 0

	love.graphics.setColor(1,1,1)
	love.keyboard.setKeyRepeat(true)
	love.graphics.setDefaultFilter("nearest") -- good pixel

	game = {
		scale = 2,
		width = love.graphics.getWidth(),
		height = love.graphics.getHeight(),
		paused = false
	}

	require "code/require"

	logPrint(loveInitLog)
	loveInitLog = nil
	Canvas = {
		Darkness = CreateDarkness()
	}
	love.graphics.setCanvas(Canvas.Darkness)
	SetDarkness()
	love.graphics.setCanvas()

	Camera.width = game.width
	Camera.height = game.height

	levelList = scandir("./data/levels")
	levelNum = 1
	currLevel = levelList[levelNum]
	logPrint("currLevel: "..currLevel)
	LoadedParticles = {}
	LevelLoadTiles()

	language = "ENG"
	LocaleLoad(language)

	gravity = 0.14
	-- Debug and log stuff
	memoryUsage, dtcount = 0, 0
	logPrint("mothback: "..collectgarbage("count").." kB, Loading time: "..os.clock().." seconds")

	main_Player = Player:New(75,50)

	--Kupo:New(100,150)
	--Kupo:New(300,150)
	HookAnchor:New(200,89)
	HookAnchor:New(400,89)
	Fairy:New(200,88)
	--CursedBook:New(180,68)

	--love.audio.play(music.placeholder)
end

function love.update(dt)
	-- audio update
	love.audio.update()
	-- fps counter
	if fps_second >= 1 then
		fps_second = fps_second - 1
		fps_draw = fps_count
		fps_count = 0
		fps_total = fps_total + 1
	end
	fps_second = fps_second + dt
	fps_count = fps_count + 1
	current_dt = dt

	if DemoRecording or DemoPlayback then Demo:Step()	end

	-- things per second
	dtcount = dtcount + dt
	if dtcount >= 1 then
		if secs == nil then secs = 0 end
		secs = secs + 1
		dtcount = dtcount - 1
		if debug or logging then
			memoryUsage = math.floor(collectgarbage("count"))
		end
		logWrite("Second "..secs..": "..memoryUsage.." kB")
	end

	--keypressed
	if Keybind:CheckPressed(Keybind.menu.pause) then
    if do_pause then
			do_pause = false
		else
			menu_type = "pause"
			MenuInit(menu_type)
		end
  end

	--MenuStep
	if menu_type ~= nil then MenuStep(menu_type) end

	--editor
	if editor_mode then
		EditorStep()
	else
		GameStep()
	end
end


function love.wheelmoved(_, y)
	if editor_mode then
		EditorScroll(y)
	end
end

function love.draw()
	if game.width ~= love.graphics.getWidth() or game.height ~= love.graphics.getHeight() then
		game.width = love.graphics.getWidth()
		game.height = love.graphics.getHeight()
		game_resize = true
	else
		game_resize = false
	end

	if editor_mode then
		EditorDraw()
	else
		GameDraw()
	end

	if menu_type ~= nil then MenuDraw(menu_type) end

	love.graphics.print(game.scale,10,40)

	if DemoRecording or DemoPlayback then Demo:Draw() end
end
