Commit fdf3657f authored by Nono Kros's avatar Nono Kros 🎮
Browse files

Dynamic icon added.

parent f6a16247
local icon = love.image.newImageData("meta/icon.png")
local iconC5 = love.image.newImageData("meta/icon-c5.png")
local iconD5 = love.image.newImageData("meta/icon-d5.png")
local iconE5 = love.image.newImageData("meta/icon-e5.png")
local iconG5 = love.image.newImageData("meta/icon-g5.png")
local iconA5 = love.image.newImageData("meta/icon-a5.png")
local iconResetTimer = 0
local iconResetTimeOut = 0.15
local dynamicIcon = {}
dynamicIcon.update = function(dt)
if iconResetTimer > 0 then
iconResetTimer = iconResetTimer - dt
elseif iconResetTimer < 0 then
-- reset window icon
iconResetTimer = 0
love.window.setIcon(icon)
print("icon resetted")
end
end
dynamicIcon.keypressed = function(key)
if key == "q" then
love.window.setIcon(iconC5)
iconResetTimer = iconResetTimeOut
print("icon changed to c5")
elseif key == "w" then
love.window.setIcon(iconD5)
iconResetTimer = iconResetTimeOut
print("icon changed to d5")
elseif key == "e" then
love.window.setIcon(iconE5)
iconResetTimer = iconResetTimeOut
print("icon changed to e5")
elseif key == "r" then
love.window.setIcon(iconG5)
iconResetTimer = iconResetTimeOut
print("icon changed to g5")
elseif key == "t" then
love.window.setIcon(iconA5)
iconResetTimer = iconResetTimeOut
print("icon changed to a5")
end
end
return dynamicIcon
\ No newline at end of file
function love.draw() love.graphics.print("Hello World!", 400, 300) end
dynamicIcon = require("dynamicIcon")
tone = require("tone")
function love.load()
end
function love.keypressed(key, scancode, isrepeat)
dynamicIcon.keypressed(key)
tone.keypressed(key, true)
end
function love.update(dt)
dynamicIcon.update(dt)
end
function love.draw()
......
@echo off
start %~dp0\loves\win64\lovec %~dp0\.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment