-
Notifications
You must be signed in to change notification settings - Fork 0
/
welcomescreen.lua
72 lines (61 loc) · 2.47 KB
/
welcomescreen.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
local TAU = math.pi * 2
local canvas
local particleSystem
local MS = 1
local PSIZE = 40
function loadWelcomeScreen()
--titleImage = love.graphics.newImage("/res/title.png")
font = love.graphics.newFont("res/shafont.ttf", 350)
titleText = love.graphics.newText(font, "SHAMEN")
textColor = {0,0,0}
bgColor = {1.0, 0.51, 0.18, 0.74}
bgoffset = 10
love.graphics.setDefaultFilter('linear', 'linear', 4)
canvas = love.graphics.newCanvas(PSIZE, PSIZE)
canvas:renderTo(function()
--love.graphics.clear(255,255,255,0)
love.graphics.rectangle('fill', 0, 0, PSIZE, PSIZE)
--love.graphics.circle('fill', PSIZE/2, PSIZE/2, PSIZE/2-2, 100)
--love.graphics.polygon('fill', 1, 16, 30, 16, 16, 1)
end)
--canvas = love.graphics.newImage "particle.png"
particleSystem = love.graphics.newParticleSystem(canvas, 4096)
particleSystem:setParticleLifetime(0.1, 10)
particleSystem:setEmissionRate(100)
particleSystem:setSizes(1.5, 0.6)
particleSystem:setLinearAcceleration(10, 10, -10, -10)
particleSystem:setLinearDamping(0.2)
particleSystem:setEmissionArea('uniform', screenWidth / 2, 0)
particleSystem:setDirection(math.rad(90))
particleSystem:setPosition(screenWidth/2, 0)
particleSystem:setSpeed(410, 1000)
particleSystem:setColors(0.388, 0.784, 0, 0.705, 0.5, 0, 0.98, 0.509, 0, 0, 0, 0)
canvas = love.graphics.newCanvas(screenWidth * MS, screenHeight * MS)
end
function updateWelcomeScreen(dt)
particleSystem:update(dt)
end
function drawSky()
love.graphics.setColor(world.skyColor)
love.graphics.rectangle("fill", 0, 0, screenWidth, screenHeight)
end
function drawWelcomeScreen()
drawSky()
canvas:renderTo(function()
--love.graphics.clear(0,0,0,0.01)
love.graphics.setBlendMode('subtract', 'premultiplied')
love.graphics.setColor(0.015, 0.078, 255, 0.039)
love.graphics.rectangle('fill', 0, 0, screenWidth * MS, screenHeight * MS)
love.graphics.setColor(1.0, 1.0, 1.0, 1.0)
love.graphics.setBlendMode('alpha', 'premultiplied')
love.graphics.draw(particleSystem)
end)
love.graphics.setBlendMode('alpha', 'alphamultiply')
love.graphics.setColor(1.0, 1.0, 1.0, 1.0)
love.graphics.draw(canvas, 0, 0, 0, 1/MS, 1/MS)
--draw PRESS ANY KEY TO START GAME
love.graphics.setColor(bgColor)
love.graphics.rectangle("fill", 0, screenHeight/10 - bgoffset, screenWidth, titleText:getHeight() + bgoffset*2)
love.graphics.setColor(textColor)
love.graphics.draw(titleText, (screenWidth - titleText:getWidth()) / 2, screenHeight/10)
end