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

Commit

Permalink
Cleaning up bugs in GameEditor and updating default template.
Browse files Browse the repository at this point in the history
  • Loading branch information
jessefreeman committed Dec 29, 2019
1 parent c2014b1 commit 27909b2
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 51 deletions.
68 changes: 40 additions & 28 deletions Disks/PixelVision8System/code.lua
@@ -1,6 +1,6 @@
--[[
Pixel Vision 8 - New Template Script
Copyright (C) 2017, Pixel Vision 8 (http://pixelvision8.com)
Copyright (C) 2017, Pixel Vision 8 (@pixelvision8)
Created by Jesse Freeman (@jessefreeman)
This project was designed to display some basic instructions when you create
Expand All @@ -11,50 +11,62 @@
https://www.pixelvision8.com/getting-started
]]--

-- This this is an empty game, we will the following text. We combined two sets of fonts into
-- the default.font.png. Use uppercase for larger characters and lowercase for a smaller one.
--[[
This this is an empty game, we will the following text. We combined two sets
of fonts into the default.font.png. Use uppercase for larger characters and
lowercase for a smaller one.
]]--
local message = "EMPTY GAME\n\n\nThis is an empty game template.\n\n\nVisit 'pixelvision8.com' to learn more about creating games from scratch."

-- The Init() method is part of the game's lifecycle and called a game starts. We are going to
-- use this method to configure background color, ScreenBufferChip and draw a text box.
--[[
The Init() method is part of the game's lifecycle and called a game starts.
We are going to use this method to configure background color,
ScreenBufferChip and draw a text box.
]]--
function Init()

-- Here we are manually changing the background color
BackgroundColor(0)
-- Here we are manually changing the background color
BackgroundColor(0)

local display = Display()
local display = Display()

-- We are going to render the message in a box as tiles. To do this, we need to wrap the
-- text, then split it into lines and draw each line.
local wrap = WordWrap(message, (display.x / 8) - 2)
local lines = SplitLines(wrap)
local total = #lines
local startY = ((display.y / 8) - 1) - total
-- We are going to render the message in a box as tiles. To do this, we
-- need to wrap the text, then split it into lines and draw each line.
local wrap = WordWrap(message, (display.x / 8) - 2)
local lines = SplitLines(wrap)
local total = #lines
local startY = ((display.y / 8) - 1) - total

-- We want to render the text from the bottom of the screen so we offset it and loop backwards.
for i = total, 1, - 1 do
DrawText(lines[i], 1, startY + (i - 1), DrawMode.Tile, "large", 15)
end
-- We want to render the text from the bottom of the screen so we offset
-- it and loop backwards.
for i = total, 1, - 1 do
DrawText(lines[i], 1, startY + (i - 1), DrawMode.Tile, "large", 15)
end

end

-- The Update() method is part of the game's life cycle. The engine calls Update() on every frame
-- before the Draw() method. It accepts one argument, timeDelta, which is the difference in
-- milliseconds since the last frame.
--[[
The Update() method is part of the game's life cycle. The engine calls
Update() on every frame before the Draw() method. It accepts one argument,
timeDelta, which is the difference in milliseconds since the last frame.
]]--
function Update(timeDelta)

-- TODO add your own update logic here
-- TODO add your own update logic here

end

-- The Draw() method is part of the game's life cycle. It is called after Update() and is where
-- all of our draw calls should go. We'll be using this to render sprites to the display.
--[[
The Draw() method is part of the game's life cycle. It is called after
Update() and is where all of our draw calls should go. We'll be using this
to render sprites to the display.
]]--
function Draw()

-- We can use the RedrawDisplay() method to clear the screen and redraw the tilemap in a
-- single call.
RedrawDisplay()
-- We can use the RedrawDisplay() method to clear the screen and redraw
-- the tilemap in a single call.
RedrawDisplay()

-- TODO add your own draw logic here.
-- TODO add your own draw logic here.

end
10 changes: 3 additions & 7 deletions Disks/PixelVision8System/data.json
Expand Up @@ -6,8 +6,7 @@
"backgroundColor": 0,
"maskColor": "#FF00FF",
"unique": false,
"debug": false,

"debug": false
},
"DisplayChip":
{
Expand All @@ -16,14 +15,13 @@
"overscanX": 1,
"overscanY": 1,
"layers": 6

},
"FontChip":
{
},
"GameChip":
{
"lockSpecs": false,
"lockSpecs": true,
"maxSize": 512,
"saveSlots": 8
},
Expand All @@ -40,7 +38,6 @@
"totalSounds": 32,
"channelTypes": [-1, -1, -1, -1, -1]
},

"SpriteChip": {
"maxSpriteCount": 0,
"unique": false,
Expand All @@ -54,7 +51,6 @@
"columns": 256,
"rows": 256,
"totalFlags": 16,
"autoImport": false,

"autoImport": false
}
}
18 changes: 4 additions & 14 deletions Runners/GameRunner/GameRunner.Desktop.csproj
Expand Up @@ -67,8 +67,12 @@
<EmbeddedResource Include="Icon.icns">
<LogicalName>Icon.icns</LogicalName>
</EmbeddedResource>
<Content Include="Icon.icns" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\bios.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<!-- Shader Effects -->
<Content Include="..\..\Effects\*.*">
<Link>Content\Effects\%(FileName)%(Extension)</Link>
Expand All @@ -87,25 +91,11 @@
<Link>Content\LoadTool\%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Content\bios.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Icon.icns" />
</ItemGroup>
<ItemGroup>
<Content Include="..\..\Disks\PixelVision8System\*.*">
<Link>Content\DefaultGame\%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="..\..\Effects\*.*">
<Link>Content\Effects\%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Runners/PixelVision8/Runner/Editors/GameEditor.cs
Expand Up @@ -744,7 +744,7 @@ public int[] FlipPixelData(int[] data, bool flipH = false, bool flipV = false, i
// return gameChip.Sprites(ids, width);
// }

public int TotalSprites(bool ignoreEmpty = true)
public int TotalSprites(bool ignoreEmpty = false)
{
return gameChip.TotalSprites(ignoreEmpty);
}
Expand Down
1 change: 0 additions & 1 deletion SDK/Engine/Chips/Game/GameChip.cs
Expand Up @@ -301,7 +301,6 @@ public string Color(int id, string value = null)
/// </returns>
public int TotalColors(bool ignoreEmpty = false)
{
// TODO this shouldn't use the supported colors
return ignoreEmpty ? colorChip.totalUsedColors : colorChip.total;
}

Expand Down

0 comments on commit 27909b2

Please sign in to comment.