Skip to content

mitsuji/kawakudari_pixel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

kawakudari-pixel

This project implements part of the std15.h API (from c4ij) with pixel, and Kawakudari Game on top of it.

It will allow programming for IchigoJam-like targets that display IchigoJam FONT on screen using a Go programming language.

var frame uint32 = 0
var x int32 = 15
var running bool = true

func run() {
  cfg := pixelgl.WindowConfig{
    Title:  "Kawakudari Pixel",
    Bounds: pixel.R(0, 0, 512, 384),
    VSync:  true,
  }

  win, err := pixelgl.NewWindow(cfg)
  if err != nil {
    panic(err)
  }

  std15 := ij.New(512, 384, 32, 24)
  for !win.Closed() {
    if !running {continue}
    if frame % 5 == 0 {
      if win.Pressed(pixelgl.KeyLeft) {
        x--
      }
      if win.Pressed(pixelgl.KeyRight) {
        x++
      }
      std15.Locate(x,5)
      std15.Putc('0')
      std15.Locate(rand.Int31n(32),23)
      std15.Putc('*')
      std15.Scroll(ij.Up)
      if std15.Scr(x,5) != 0 {
        std15.Locate(0,23)
        std15.Putstr("Game Over...")
        std15.Putnum(int32(frame))
        running = false
      }
    }
    std15.DrawScreen(win)
    frame++
  }
}

func main() {
  rand.Seed(time.Now().UnixNano())
  pixelgl.Run(run)
}

Prerequisite

  • This project using programming language Go, so you need Go build tool properly installd to run example code.
  • In Windows enviroment, you might need install and configure MSYS2 to build and run this project.

How to use

To just run example

$ go run main.go

To build executeble and run example

$ go build
$ ./kawakudari_pixel

License

Creative Commons License CC BY mitsuji.org

This work is licensed under a Creative Commons Attribution 4.0 International License.

About

The project implements part of the std15.h API (from c4ij) with pixel, and Kawakudari Game on top of it.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages