naming convention for most stuff but not all
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
assert(editor == nil)
|
||||
editor = { room_mode = false }
|
||||
|
||||
function EditorStep()
|
||||
function stepEditor()
|
||||
palette = palette or false
|
||||
AnimateTiles()
|
||||
if Keybind:CheckPressed(Keybind.editor.room_mode) then
|
||||
@@ -24,7 +24,7 @@ function EditorStep()
|
||||
palette_scroll_y = 0
|
||||
end
|
||||
end
|
||||
-- TODO:
|
||||
-- TODO:
|
||||
if love.keyboard.isDown('a',"left") then
|
||||
Camera.pos.x = Camera.pos.x - 3/game.scale
|
||||
end
|
||||
@@ -74,7 +74,7 @@ function EditorStep()
|
||||
end
|
||||
end
|
||||
|
||||
function EditorScroll(y)
|
||||
function scrollEditor(y)
|
||||
if palette then
|
||||
if love.keyboard.isDown("lshift") then
|
||||
palette_scroll_y = palette_scroll_y + y
|
||||
@@ -87,23 +87,23 @@ function EditorScroll(y)
|
||||
end
|
||||
end
|
||||
|
||||
function EditorDraw()
|
||||
GameworldDrawPrepare()
|
||||
GameworldDrawBackground()
|
||||
GridDisplay()
|
||||
GameworldDrawForeground()
|
||||
GameworldDrawEnd()
|
||||
EditorDoEdit()
|
||||
function drawEditor()
|
||||
startGameworldDraw()
|
||||
drawGameworldBackground()
|
||||
drawGridDisplay()
|
||||
drawGameworldForeground()
|
||||
endGameworldDraw()
|
||||
doEditorEdit()
|
||||
|
||||
DrawRooms()
|
||||
drawEditorRooms()
|
||||
drawSelectingPaletteTile()
|
||||
|
||||
DrawSelectingPaletteTile()
|
||||
if palette then
|
||||
EditorDoPalette()
|
||||
doEditorPalette()
|
||||
end
|
||||
end
|
||||
|
||||
function EditorDoEdit()
|
||||
function doEditorEdit()
|
||||
local mouse_x = love.mouse.getX()
|
||||
local mouse_y = love.mouse.getY()
|
||||
local horizontal = 1+math.floor(((mouse_x/game.scale) / tileProperties.width) + (Camera.pos.x / tileProperties.width))
|
||||
@@ -145,7 +145,7 @@ function EditorDoEdit()
|
||||
end
|
||||
end
|
||||
if #editor.room_points == 2 then
|
||||
table.insert(LoadedObjects.Rooms, Collision:New(r[1].x,r[1].y,r[2].x,r[2].y))
|
||||
table.insert(LoadedObjects.Rooms, Collision:new(r[1].x,r[1].y,r[2].x,r[2].y))
|
||||
editor.room_points = {}
|
||||
end
|
||||
if editor.room_mode == "delete" then
|
||||
@@ -180,7 +180,7 @@ function EditorDoEdit()
|
||||
end
|
||||
end
|
||||
|
||||
function DrawSelectingPaletteTile()
|
||||
function drawSelectingPaletteTile()
|
||||
if selecting_tile ~= nil and selecting_tile ~= 0 then
|
||||
|
||||
local mouse_x = love.mouse.getX()
|
||||
@@ -199,7 +199,7 @@ function DrawSelectingPaletteTile()
|
||||
end
|
||||
end
|
||||
|
||||
function EditorDoPalette()
|
||||
function doEditorPalette()
|
||||
|
||||
local width = LevelData.tileset:getPixelWidth()/tileProperties.width
|
||||
local height = LevelData.tileset:getPixelHeight()/tileProperties.height
|
||||
@@ -279,3 +279,11 @@ function EditorDoPalette()
|
||||
1 + LevelData.tileset:getPixelHeight()* ((tileProperties.height+1) / tileProperties.height)
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
function drawEditorRooms()
|
||||
for _, room in pairs(LoadedObjects.Rooms) do
|
||||
love.graphics.setColor(0,0,100,1)
|
||||
love.graphics.rectangle("line",room.from.x-Camera.pos.x, room.from.y-Camera.pos.y, room.width, room.height)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user