Skip to content

Commit

Permalink
✨ シーン InGame の追加,登録処理の追加
Browse files Browse the repository at this point in the history
  • Loading branch information
remyroez committed Oct 13, 2019
1 parent 48305e4 commit 00c3a32
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
21 changes: 21 additions & 0 deletions game/src/Game/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ local Game = require(folderOfThisFile .. 'class')
-- クラス
local Application = require 'Application'
local AudioManager = require 'AudioManager'
local SceneStack = require 'SceneStack'

-- 初期化
function Game:initialize(...)
Expand Down Expand Up @@ -36,44 +37,64 @@ function Game:load(...)
basepath = 'assets',
}
)

-- シーン
self.scene = SceneStack()
self.scene:add(
require 'scenes.InGame' {
app = self,
}
)
end

-- 更新
function Game:update(dt, ...)
self.scene:update(dt)
end

-- 描画
function Game:draw(...)
love.graphics.print('Hello, Game!', 0, 0)

self.scene:draw()
end

-- キー入力
function Game:keypressed(key, scancode, isrepeat)
self.scene:keypressed(key, scancode, isrepeat)
end

-- キー離した
function Game:keyreleased(key, scancode)
--self.scene:keyreleased(key, scancode)
end

-- テキスト入力
function Game:textinput(text)
--self.scene:textinput(text)
end

-- マウス入力
function Game:mousepressed(x, y, button, istouch, presses)
self.scene:mousepressed(x, y, button, istouch, presses)
end

-- マウス離した
function Game:mousereleased(x, y, button, istouch, presses)
--self.scene:mousereleased(x, y, button, istouch, presses)
end

-- マウス移動
function Game:mousemoved(x, y, dx, dy, istouch)
--self.scene:mousemoved(x, y, dx, dy, istouch)
end

-- マウスホイール
function Game:wheelmoved(x, y)
--self.scene:wheelmoved(x, y)
end

-- リサイズ
function Game:resize(width, height)
--self.scene:resize(width, height)
end
41 changes: 41 additions & 0 deletions game/src/scenes/InGame.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

local class = require 'middleclass'
local lume = require 'lume'

-- 基底クラス
local Scene = require 'Scene'

-- インゲーム クラス
local InGame = class('InGame', Scene)

-- 初期化
function InGame:initialize(t)
Scene.initialize(self)

self.app = t.app or {}
end

-- 破棄
function InGame:destroy()
end

-- 更新
function InGame:update(dt)
end

-- 描画
function InGame:draw()
love.graphics.print('Hello, InGame Scene!', 0, 100)
end

-- キー入力
function InGame:keypressed(key, scancode, isrepeat)
self:popScene()
end

-- マウス入力
function InGame:mousepressed(x, y, button, istouch, presses)
self:popScene()
end

return InGame

0 comments on commit 00c3a32

Please sign in to comment.