Skip to content

Commit

Permalink
LOVE splash screen
Browse files Browse the repository at this point in the history
  • Loading branch information
MikuAuahDark committed Dec 3, 2017
1 parent f4a5958 commit 1e230a5
Show file tree
Hide file tree
Showing 9 changed files with 671 additions and 8 deletions.
31 changes: 25 additions & 6 deletions AquaShine/AquaShine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,24 @@ local TemporaryEntryPoint
function AquaShine.LoadEntryPoint(name, arg)
local scriptdata, title

AquaShine.SleepDisabled = false

if AquaShine._TempTouchEffect and AquaShine.TouchEffect == nil then
AquaShine.TouchEffect, AquaShine._TempTouchEffect = AquaShine._TempTouchEffect, nil
if AquaShine.SplashData then
local data = AquaShine.SplashData
AquaShine.SplashData = nil

if type(data) == "string" then
return AquaShine.LoadEntryPoint(data, {name, arg})
else
TemporaryEntryPoint = data
return data.Start({name, arg})
end
end

AquaShine.SleepDisabled = false
love.window.setDisplaySleepEnabled(true)

if name:sub(1, 1) == ":" then
-- Predefined entry point
if AquaShine.AllowEntryPointPreload then
if AquaShine.Config.AllowEntryPointPreload then
scriptdata, title = assert(assert(AquaShine.PreloadedEntryPoint[name:sub(2)], "Entry point not found")(AquaShine))
else
scriptdata, title = assert(assert(love.filesystem.load(
Expand Down Expand Up @@ -396,6 +403,12 @@ function AquaShine.LoadModule(name, ...)
return x[1]
end

--! @brief Sets the splash screen before loading entry point (for once)
--! @param splash Splash screen Lua file path or table
function AquaShine.SetSplashScreen(file)
AquaShine.SplashData = file
end

function AquaShine.Log() end

----------------------------
Expand Down Expand Up @@ -890,6 +903,7 @@ function love.load(arg)
local clear = love.graphics.clear
function love.graphics.clear(r, g, b, a, ...)
if type(r) == "table" then
-- Canvas clear (table)
local tablist = {r, g, b, a}

for i = 1, select("#", ...) do
Expand All @@ -906,7 +920,7 @@ function love.load(arg)
tablist[i] = t
end

return clear(tablist)
return clear(unpack(tablist))
elseif r then
return clear(r * 255, g * 255, b * 255, (a or 1) * 255)
else
Expand Down Expand Up @@ -953,6 +967,11 @@ function love.load(arg)
-- Notice the argument order
return love.math.decompress(data, fmt)
end

-- Shader:hasUniform
function method.Shader.hasUniform(shader, name)
return not(not(shader:getExternVariable(name)))
end
end

-- Initialization
Expand Down
Binary file added assets/image/splash/heart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image/splash/logo-mask.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image/splash/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 12 additions & 2 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,26 @@
--]]---------------------------------------------------------------------------

-- Version
DEPLS_VERSION = "2.0-beta3"
DEPLS_VERSION_NUMBER = 01010503 -- xxyyzzww. x = major, y = minor, z = patch, w = pre-release counter
DEPLS_VERSION = "2.0-beta4"
DEPLS_VERSION_NUMBER = 01010504 -- xxyyzzww. x = major, y = minor, z = patch, w = pre-release counter

local AquaShine = love._getAquaShineHandle()
local isFused = love.filesystem.isFused()
AquaShine.SetDefaultFont("MTLmr3m.ttf")

if love.filesystem.isFused() then
love._getAquaShineHandle = nil
end

-------------------
-- Splash Screen --
-------------------

if (isFused and not(AquaShine.GetCommandLineConfig("nosplash"))) or (not(isFused) and AquaShine.GetCommandLineConfig("splash")) then
-- Set splash screen
AquaShine.SetSplashScreen("splash/love_splash.lua")
end

--------------------------------
-- Yohane Initialization Code --
--------------------------------
Expand Down
44 changes: 44 additions & 0 deletions splash/love_splash.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
-- LOVE 0.10.1 splash screen (fused only)
-- Demonstration of AquaShine.SetSplashScreen

local AquaShine = ...
local SplashScreen = {}
local o_ten_one = require("splash.o-ten-one")

function SplashScreen.OnDone()
-- SplashScreen.NextArg is correspond to AquaShine.LoadEntryPoint
AquaShine.LoadEntryPoint(SplashScreen.NextArg[1], SplashScreen.NextArg[2])
end

function SplashScreen.Start(arg)
-- arg is correspond to AquaShine.LoadEntryPoint
-- so store it somewhere else
SplashScreen.NextArg = arg
SplashScreen.Splash = o_ten_one()
SplashScreen.Splash.onDone = SplashScreen.OnDone
end

function SplashScreen.Update(deltaT)
return SplashScreen.Splash:update(deltaT * 0.001)
end

function SplashScreen.Draw()
-- Since LOVE splash doesn't respect to AquaShine letterbox
-- Push current stack and call origin
love.graphics.push()
love.graphics.origin()
SplashScreen.Splash:draw()
love.graphics.pop()
end

function SplashScreen.KeyPressed(key)
if key == "escape" or key == "return" or key == "backspace" then
return SplashScreen.Splash:skip()
end
end

function SplashScreen.MousePressed()
return SplashScreen.Splash:skip()
end

return SplashScreen
Binary file added splash/o-ten-one/handy-andy.otf
Binary file not shown.
Loading

0 comments on commit 1e230a5

Please sign in to comment.