alt
codecamp
Go Games: Intro to tortuga
Previous
Next
☰
About
Profile
Account
Login
Sign Up
Logout
Run
Test
Mark Complete
# Intro to tortuga Feel free to use any library or framework that you would like to. Tortuga [github.com/dfirebaugh/tortuga](https://github.com/dfirebaugh/tortuga) is designed to have a simple interface that is discoverable from your language server. > note: a language server is a tool that provides information about your code in > your editor. Usually the information will show up in your editor in overlays. The language server for golang is called [gopls](https://pkg.go.dev/golang.org/x/tools/gopls#section-readme). ## Environment setup [Install and configure vscode for Go development](https://learn.microsoft.com/en-us/azure/developer/go/configure-visual-studio-code) ## Documentation [Tortuga go package documentation](https://pkg.go.dev/github.com/dfirebaugh/tortuga)
### Render a basic rectangle ```go package main import ( "github.com/dfirebaugh/tortuga" "github.com/dfirebaugh/tortuga/pkg/math/geom" ) type cart struct { tortuga.Console rect geom.Rect } func (c cart) Update() {} func (c cart) Render() { geom.Fill(c.rect, c.GetDisplay(), c.Color(2)) } var rect geom.Rect func main() { game := tortuga.New() game.SetScaleFactor(4) c := cart{ Console: game, rect: geom.MakeRect( float64(game.GetScreenWidth())/2, float64(game.GetScreenHeight())/2, 10, 10), } game.Run(c) } ```