Advertisement
drpanwe

count_burgers

Mar 28th, 2025
681
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 1.13 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "fmt"
  5.     "image"
  6.     "image/color"
  7.     imgdraw "image/draw"
  8.  
  9.     "github.com/clktmr/n64/drivers/display"
  10.     n64draw "github.com/clktmr/n64/drivers/draw"
  11.     "github.com/clktmr/n64/fonts/gomono12"
  12.     _ "github.com/clktmr/n64/machine"
  13.     "github.com/clktmr/n64/rcp/video"
  14. )
  15.  
  16. var burgers int64 = 0
  17.  
  18. func main() {
  19.     // Initialize the N64 system
  20.     video.SetupPAL(false, false)
  21.  
  22.     // Create a framebuffer
  23.     video.SetupPAL(false, false)
  24.     resolution := video.NativeResolution().Div(2)
  25.     disp := display.NewDisplay(resolution, video.BPP16)
  26.  
  27.     // Create a rendering rdp
  28.     rdp := n64draw.NewRdp()
  29.  
  30.     // Create a font face with the gomono12 font
  31.     font := gomono12.NewFace(gomono12.X0000_00ff())
  32.  
  33.     // Main game loop
  34.     for {
  35.         // Clear the screen
  36.         rdp.SetFramebuffer(disp.Swap())
  37.         rdp.Draw(rdp.Bounds(), &image.Uniform{color.Black}, image.Point{}, imgdraw.Src)
  38.  
  39.         // Increment burger counter
  40.         burgers++
  41.  
  42.         // Draw text at position (10, 10) in white
  43.         text := fmt.Sprintf("Burgers: %d", burgers)
  44.         rdp.DrawText(rdp.Bounds(), font, image.Point{10, 10}, color.White, nil, []byte(text))
  45.  
  46.         // Flush the RDP
  47.         rdp.Flush()
  48.     }
  49. }
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement