Code Migration Guide

From time to time, the underlying Pixel Vision API may change. This page documents those changes based on the version of the SDK. While we try not to introduce changes that break existing games or throw errors intentionally, it is best to check this page after a new release to understand how to migrate your code to a new version of the Game Creator.

Game Creator v0.7.6a API Changes

Pixel Vision Game Creator leverages version v1.7.6 of the open source Pixel Vision SDK. Here is a quick list of code APIs that have changed and require updating in your game:

  • DrawSprite now requires a DrawMode (DrawMode.Sprite/DrawMode.SpriteAbove or DrawMode.SpriteBelow) instead of a bool for defining to render above or below the tilemap layer.

  • DrawSprites also requires DrawMode instead of a bool to render the sprites above or below the tilemap.

Game Creator v0.7.0a API Changes

Pixel Vision Game Creator leverages version v1.4 of the open source Pixel Vision SDK. Here is a quick list of code APIs that have changed and require updating in your game:

  • ScreenBufferChipis no longer part of the SDK. Remove any references to it in your code.

  • RebuildScreenBuffer() has been deprecated and is no longer a valid API. Calling it will not throw an error but it does nothing.

  • ToggleDisplayWrap() has been deprecated and is now set to true automatically. If you are looking to have sprites offscreen, set the overscan property on the DisplayChip.

The biggest change in v0.7.0a is that you no longer have to use the API Bridge to call core engine APIs. All new APIs are global, so they can be accessed anywhere in a game’s lua code. For example:

apiBridge:DrawSprite(0, 10, 10)

Is now

DrawSprite(0, 10, 10)

For a full list of all the API changes, refer to the following chart:

Old API Bridge New Global API Notes
inputString InputString()
GetKey() GetKeyDown() GetKeyUp() Key() Use new Key Method. Accepts InputState enum for Down and Released (up) values
mousePosition mouseX mouseY MousePosition() Returns x and y values for the mouse position
GetMouseButton() GetMouseButtonDown() GetMouseButtonUp() MouseButton() Use new MouseButton Method. Accepts InputState enum for Down and Released (up) values
paused n/a This has been removed from the engine.
spriteWidth spriteHeight SpriteSize() This returns a x (width) and y (height) value for the sprite size.
displayWidth displayHeight DisplaySize() This returns a x (width) and y (height) value for the display size.
displayWrap n/a The engine now auto wraps pixel data. To hide sprites off screen, use OverscanBorder()
scrollX scrollY ScrollTo() ScrollPosition() You can now get the x & y value of the scroll position by calling the method. Supply an x and y argument to update the position.
DrawSprite() DrawSprite() Works the same as the old api.
DrawSprites() DrawSprites() Works the same as the old API except for a new optional property to hide sprites when they go offscreen.
UpdateTile() Tile() This method allows you to read a tile's properties (spriteID, colorOffset, flag) as well as update them.
DrawFont() DrawFontToBuffer() DrawTextBox() DrawTextBoxToBuffer() DrawText() The new DrawText method accepts a draw mode enum which defines how the text will be draw to the display. You can also wrap any DrawText call with the optional argument.
DrawTileToBuffer() DrawTilesToBuffer n/a This has been removed. The legacy API now uses DrawPixels() with a draw mode of TilemapCache.
ReadFlagAt() Flag()
DrawPixelData() DrawBufferData() DrawPixels() All raw pixel draw calls are now routed through DrawPixels(). You can use the DrawMode enum to define where the pixels are drawn to.
Clear() Clear() The new clear method allows you to define the x, y, width and height of the clear area. Calling it without any arguments will simply clear the entire display similar to how the old API worked.
ChangeBackgroundColor() backgroundColor BackgroundColor() You can now get the current background color by calling the method without any arguments or change it by supplying a color id.
DrawScreenBuffer() RedrawDisplay() The new RedrawDisplay method will automatically call Clear and DrawTilemap in one call.
RebuildScreenBuffer() RebuildTilemap() Calling RebuildTilemap() with no arguments will clear the tilemap cache, including any pixel data you've drawn to it, and rebuild the map based on the existing tiles.
PlaySound() PlaySound() Works the same as the old API.
ButtonDown() ButtonReleased() Button() Uses the new Buttons enum or accepts the old button IDs. Use InputeState enum for Down or Released (up).
SpritesToRawData() n/a This has been removed. Use the Sprite() method to get the raw sprite data based on a sprite ID argument.
TogglePause() n/a This has been removed.
ToggleDisplayWrap() n/a This has been removed.
SaveData() WriteSaveData()
ReadData() ReadSaveData()
LoadSong() PlaySong() PlaySong() These two methods have been combined into a single call. Simply pass in the song id and loop value. Play song now accepts an array of loop IDs to build out a playlist.
PauseSong() PauseSong() Works the same as the old API.
StopSong() StopSong() Works the same as the old API.
RewindSong() RewindSong() Calling this with no arguments acts the same as the old method. You can supply an option position and loop ID to rewind to a specific point in a song's loop.
ReplaceColorID() ReplaceColorIDs n/a This has been removed, use color offset to change a sprite's color or update the colors the sprite uses via the Color or SwapColor APIs.
FormatWordWrap() n/a This has been removed.

You can view a full list of all the APIs here.

results matching ""

    No results matching ""