drpanwe icon

count_burgers

drpanwe | PRO | 03/28/25 09:37:37 PM UTC | 0 ⭐ | 16260 👁️ | Never ⏰ | []
Go |

1.13 KB

|

None

|

0 👍

/

0 👎

package main
 
import (
    "fmt"
    "image"
    "image/color"
    imgdraw "image/draw"
 
    "github.com/clktmr/n64/drivers/display"
    n64draw "github.com/clktmr/n64/drivers/draw"
    "github.com/clktmr/n64/fonts/gomono12"
    _ "github.com/clktmr/n64/machine"
    "github.com/clktmr/n64/rcp/video"
)
 
var burgers int64 = 0
 
func main() {
    // Initialize the N64 system
    video.SetupPAL(false, false)
 
    // Create a framebuffer
    video.SetupPAL(false, false)
    resolution := video.NativeResolution().Div(2)
    disp := display.NewDisplay(resolution, video.BPP16)
 
    // Create a rendering rdp
    rdp := n64draw.NewRdp()
 
    // Create a font face with the gomono12 font
    font := gomono12.NewFace(gomono12.X0000_00ff())
 
    // Main game loop
    for {
        // Clear the screen
        rdp.SetFramebuffer(disp.Swap())
        rdp.Draw(rdp.Bounds(), &image.Uniform{color.Black}, image.Point{}, imgdraw.Src)
 
        // Increment burger counter
        burgers++
 
        // Draw text at position (10, 10) in white
        text := fmt.Sprintf("Burgers: %d", burgers)
        rdp.DrawText(rdp.Bounds(), font, image.Point{10, 10}, color.White, nil, []byte(text))
 
        // Flush the RDP
        rdp.Flush()
    }
}
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎