Pinky

Write cross-platform computer programs like it's 1991.

What is Pinky?

Pinky is a minimalistic language inspired by languages like BASIC and ZZT script. The reference compiler is around 1000 lines of Python code, so anyone can read it, learn from it, and build on it! Despite the tiny footprint, Pinky has everything you need to make small interactive graphical programs, like games, out of the box.

Each Pinky player (aka virtual machine) is just a thin layer over the host platform. There's practically no memory overhead and only a little computing overhead at startup, for the player itself.

For example

The animated "Welcome!!!" banner above is a Pinky program. Click on it, then use the arrow keys to nudge the text around. The source code is below.

prog_h = 100

WelcomeGame extends Game
  font   : Font
  text_x : int
  text_y : int
end

WelcomeGame_update(game:Game)
end

WelcomeGame_draw(game:WelcomeGame, g:Graphics)
  Graphics_clear(g, 0xFFFFFF)  
  y = game.text_y + 1
  game.text_y = mod(y, prog_h+32)
  Font_drawtext(game.font, g, "Welcome!!!", game.text_x, y-32,
                320/32, prog_h/32)  
  Graphics_flush(g)
end

WelcomeGame_btndown(game:WelcomeGame, btn:int)
  if   btn == BTN_RIGHT then
    game.text_x = game.text_x + 10
  elif btn == BTN_LEFT  then
    game.text_x = game.text_x - 10    
  elif btn == BTN_UP    then
    game.text_y = game.text_y - 10    
  elif btn == BTN_DOWN  then
    game.text_y = game.text_y + 10
  elif btn == BTN_EXIT then
    quit
  end
end

WelcomeGame_btnup(game:WelcomeGame, btn:int)
end

WelcomeGame_init_objs(game:Game)
end

run()
  ascii_font_ss = {
    Image_load(@"font_cnynegrite.png"),
    16, 16, 2, 2} as ImageSheet

  font = ImageSheet_getfont(ascii_font_ss)

  game = {
    "Welcome",
    40,
    0,
    320, prog_h,
    WelcomeGame_update,
    WelcomeGame_draw,
    WelcomeGame_btndown,    
    WelcomeGame_btnup,
    {
    } as Tilemap[],
    {
    } as Tilemap[],
    null,
    null,
    null,
    font,
    0, 0
  } as WelcomeGame

  WelcomeGame_init_objs(game)
  
  App_run(game)
end