Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

Commit

Permalink
Working on fixed to DrawTool but moving back to broken folder since i…
Browse files Browse the repository at this point in the history
…t's not ready yet.
  • Loading branch information
jessefreeman committed Mar 20, 2021
1 parent cfbfcea commit fc65e9e
Show file tree
Hide file tree
Showing 36 changed files with 372 additions and 446 deletions.
2 changes: 1 addition & 1 deletion Content/PixelVisionOS/Tools/BootTool/music.json
Expand Up @@ -4,7 +4,7 @@
"songs": [
{
"songName": "PV8",
"speedInBPM": 160,
"speedInBPM": 130,
"tracks":
[
{
Expand Down
Expand Up @@ -28,7 +28,7 @@ function DrawTool:CreateCanvas()
y = 128
},
1,
256,
pixelVisionOS.colorOffset,
"Draw on the canvas",
pixelVisionOS.emptyColorID
)
Expand Down
Expand Up @@ -304,10 +304,6 @@ function EditColorModal:Open()
table.insert(self.colorCache, Color(pixelVisionOS.colorOffset + (i - 1)))

end
--
-- for i = 1, #self.colorCache do
-- print(i, self.colorCache[i])
-- end

self.canvas:DrawPixels(self.rect.x, self.rect.y, DrawMode.TilemapCache)

Expand Down
Expand Up @@ -206,10 +206,7 @@ function DrawTool:ShowColorPanel()

pixelVisionOS:InvalidateItemPickerDisplay(self.systemColorPickerData)
pixelVisionOS:InvalidateItemPickerPageButton(self.systemColorPickerData)
-- TODO clear page area?

-- editorUI:NewDraw("DrawSprites", {pickerbottompageedge.spriteIDs, 20, 20, pickerbottompageedge.width, false, false, DrawMode.Tile})


DrawMetaSprite(
FindMetaSpriteId("pickerbottompageedge"),
20,
Expand All @@ -233,7 +230,6 @@ function DrawTool:HideColorPanel()

-- Clear bottom of the main window
for i = 1, 8 do
-- editorUI:NewDraw("DrawSprites", {pagebuttonempty.spriteIDs, 11 + i, 20, pagebuttonempty.width, false, false, DrawMode.Tile})
DrawMetaSprite(
FindMetaSpriteId("pagebuttonempty"),
11 + i,
Expand All @@ -244,8 +240,6 @@ function DrawTool:HideColorPanel()
)
end

-- editorUI:NewDraw("DrawSprites", {canvasbottomrightcorner.spriteIDs, 20, 20, canvasbottomrightcorner.width, false, false, DrawMode.Tile})

DrawMetaSprite(
FindMetaSpriteId("canvasbottomrightcorner"),
20,
Expand Down Expand Up @@ -364,9 +358,12 @@ function DrawTool:UpdateColorPanel()
DrawMetaSprite(
self.bgDrawArgs[1],
self.bgDrawArgs[2],
self.bgDrawArgs[3]
self.bgDrawArgs[3],
false,
false,
DrawMode.UI
)
-- editorUI:NewDraw("DrawSprites", self.bgDrawArgs)

end

end
Expand Down
Expand Up @@ -137,7 +137,7 @@ function DrawTool:UpdateSpritePanel()
self.sizeDisplayText = string.format("%02dx%02d", self.lastSpriteSize.x * editorUI.spriteSize.x, self.lastSpriteSize.y * editorUI.spriteSize.y)
end

-- DrawText(self.sizeDisplayText, 224-2, 224-2, DrawMode.Sprite, "medium", 6, -4 )
DrawText(self.sizeDisplayText, 224-2, 224-2, DrawMode.Sprite, "medium", 6, -4 )

end

Expand Down Expand Up @@ -241,22 +241,6 @@ function DrawTool:ChangeSpriteID(value)

end

-- function DrawTool:OnSelectSprite(value)



-- Reset history
-- ClearHistory()

-- print("Sprite", dump(gameEditor:Sprite(value)))

-- print("test", self.spritePickerData)


-- ResetColorInvalidation()

-- end

function DrawTool:OnSpritePickerDrop(src, dest)

if(dest.inDragArea == false) then
Expand Down Expand Up @@ -289,7 +273,7 @@ function DrawTool:OnSpritePickerDrop(src, dest)

local selection = self.selectionSizes[self.spriteMode]

self:BeginUndo()
self:BeginUndo(self)

local srcSprite = gameEditor:ReadGameSpriteData(srcSpriteID, selection.x, selection.y)
local destSprite = gameEditor:ReadGameSpriteData(destSpriteID, selection.x, selection.y)
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

369 changes: 174 additions & 195 deletions ...onOS/System/Tools/DrawTool/sb-sprites.lua → ...nOS/System/Broken/DrawTool/sb-sprites.lua 100755 → 100644

Large diffs are not rendered by default.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions Disks/PixelVisionOS/System/Broken/DrawTool/tilemap.json

Large diffs are not rendered by default.

Expand Up @@ -75,13 +75,8 @@ function PixelVisionOS:CreateColorPicker(rect, tileSize, total, totalPerPage, ma

self:SelectItemPickerIndex(data, value.index, true, false)




data.selectedPixelDrawArgs[1] = self:ReadItemPickerOverPixelData(data, value.x, value.y)

-- print(data.name, "Data", dump(data.selectedPixelDrawArgs))

if(data.onAction ~= nil) then
data.onAction(value.index, doubleClick)
end
Expand Down Expand Up @@ -246,7 +241,7 @@ function PixelVisionOS:DrawColorPickerColorItem(data, id)


if(data.onDrawColor ~= nil) then
print("Draw Color", id)
-- print("Draw Color", id)
data.onDrawColor(data, id, x ,y)
else
data.canvas.DrawSprites(emptycolor.spriteIDs, x, y, emptycolor.width, false, false)
Expand Down Expand Up @@ -286,7 +281,7 @@ function PixelVisionOS:UpdateColorPicker(data)

-- Draw selection sprites when we are not dragging
-- self.editorUI:NewDraw("DrawSprites", data.picker.selectedDrawArgs)
print("-- TODO draw selection", data.picker.cachedMetaSpriteIds.up, data.picker.colorOffset)
-- TODO draw selection", data.picker.cachedMetaSpriteIds.up, data.picker.colorOffset)
DrawMetaSprite(
data.picker.cachedMetaSpriteIds.up,
data.picker.selectedPos.x,
Expand Down Expand Up @@ -401,7 +396,7 @@ function PixelVisionOS:SelectColorPickerIndex(data, value)
-- Calculate the correct page from the position y value
local tmpPage = math.floor((pos.y * 8) / data.pageSize)

print(data.name, value, tmpPage, dump(pos),data.pageSize)
-- print(data.name, value, tmpPage, dump(pos),data.pageSize)

self:OnColorPickerPage(data, tmpPage + 1)

Expand Down Expand Up @@ -476,13 +471,9 @@ function PixelVisionOS:RebuildPickerPages(data, totalPages)
rect = {x = rect.x, y = position.y, w = 8, h = 16}

if(data.totalPages > 0) then
if(pickerbottompageedge ~= nil) then
-- DrawSprites(pickerbottompageedge.spriteIDs, rect.x + 8, rect.y, pickerbottompageedge.width, false, false, DrawMode.TilemapCache)
end
DrawMetaSprite(FindMetaSpriteId("pickerbottompageedge"), rect.x + 8, rect.y, false, false, DrawMode.TilemapCache)
else
if(pickerbottompage ~= nil) then
-- DrawSprites(pickerbottompage.spriteIDs, rect.x + 8, rect.y, pagebuttonempty.width, false, false, DrawMode.TilemapCache)
end
DrawMetaSprite(FindMetaSpriteId("pickerbottompage"), rect.x + 8, rect.y, false, false, DrawMode.TilemapCache)
end

end
Expand Down
Expand Up @@ -18,24 +18,24 @@
function PixelVisionOS:ImportColorsFromGame()

-- Resize the tool's color memory to 512 so it can store the tool and game colors
gameEditor:ResizeToolColorMemory()
-- gameEditor:ResizeToolColorMemory()

-- We'll save the game's mask color
self.maskColor = gameEditor:MaskColor()

self.colorsPerSprite = gameEditor:ColorsPerSprite()

-- Games are capped at 256 colors
self.totalColors = 256
self.totalColors = 128

-- Set the last color to the empty color ID (which accounts for -1 in game color space)
self.emptyColorID = self.totalColors - 1
self.emptyColorID = 63

-- Change the empty color to match the game's mask color
Color(self.emptyColorID, self.maskColor)

-- The color offset is the first position where a game's colors are stored in the tool's memory
self.colorOffset = self.totalColors
self.colorOffset = self.emptyColorID + 1

-- Clear all the tool's colors
for i = 1, self.totalColors do
Expand Down Expand Up @@ -135,7 +135,7 @@ function PixelVisionOS:ImportColorsFromGame()
self.palettesAreEmpty = false
end

Color(index + self.colorOffset, color)
-- Color(index + self.colorOffset, color)

end

Expand Down
Expand Up @@ -357,7 +357,7 @@ end

function PixelVisionOS:InvalidateItemPickerDisplay(data)

-- data.invalidateDisplay = true
data.invalidateDisplay = true

end

Expand Down
2 changes: 1 addition & 1 deletion Disks/PixelVisionOS/System/Libs/pixel-vision-os-v2.lua
Expand Up @@ -25,7 +25,7 @@ LoadScript("pixel-vision-os-title-bar-v2")
LoadScript("pixel-vision-os-message-bar-v2")
LoadScript("pixel-vision-os-modal-v2")
LoadScript("pixel-vision-os-message-modal-v5")
LoadScript("pixel-vision-os-color-utils-v2")
LoadScript("pixel-vision-os-color-utils-v3")
LoadScript("pixel-vision-os-undo-v2")
LoadScript("pixel-vision-os-clipboard-v2")
LoadScript("pixel-vision-os-export-game-v1")
Expand Down
Binary file removed Disks/PixelVisionOS/System/Tools/DrawTool/colors.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 0 additions & 2 deletions SDK/Runner/Parsers/PNGReader.cs
Expand Up @@ -19,12 +19,10 @@
//

using Microsoft.Xna.Framework;
// using PixelVision8.Player;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
// using MonoGame.Framework.Utilities;
using PixelVisionRunner.Utils;

namespace PixelVision8.Runner
Expand Down

0 comments on commit fc65e9e

Please sign in to comment.