Skip to content

Latest commit

 

History

History

playdate

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Playdate Instructions

The Playdate console uses the Sharp Memory Display 2.7".

Playdate Example

Why would I include the entire sprite map if I only need a few icons?

Ease of developer use. The sprite map is small due to the monochrome color pallet. Each icon is read off flash storage as neccessary using little resources.

Lua

Copy the two files in this folder to your project.

  • icon.lua to source/icon.lua
  • memory-table-22-22.png to source/images/memory-table-22-22.png

Currently the icon class defines:

  • local icon1 = Icon(x, y, iconIndex)
  • icon1:setIcon(iconIndex)
  • Inherits Sprite so has all functions
    • icon1:moveTo(x, y)
  • IconAlert, IconAccount, etc...
import "CoreLibs/object"
import "CoreLibs/graphics"
import "CoreLibs/sprites"

import "icon"

local pd <const> = playdate
local gfx <const> = pd.graphics

local icon3 = Icon(224, 120, IconAlphaA)

local function initialize()
    gfx.setColor(gfx.kColorBlack)
    local icon1 = Icon(180, 120, IconDevice)
    icon1:add()
    local icon2 = Icon(202, 120, IconArrowRight)
    icon2:add()
    icon3:add()
end

initialize()

function playdate.update()
    gfx.sprite.update()
    if playdate.buttonIsPressed(playdate.kButtonA) then
        local i = math.random(1, 200)
        icon3:setIcon(i)
        print('Random', i)
    end
end

C

I don't know C... so let me know what to generate.