A dungeon delver roguelike using Pathfinder 2nd edition rules

Adding hello world code

Changed files
+107
+12
go.mod
··· 1 + module tangled.org/cass.cityboundforest.com/dungeoner 2 + 3 + go 1.25.0 4 + 5 + require github.com/g3n/engine v0.2.0 6 + 7 + require ( 8 + github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210410170116-ea3d685f79fb // indirect 9 + github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect 10 + golang.org/x/image v0.0.0-20210607152325-775e3b0c77b9 // indirect 11 + gopkg.in/yaml.v2 v2.4.0 // indirect 12 + )
+14
go.sum
··· 1 + github.com/g3n/engine v0.2.0 h1:7dmj4c+3xHcBnYrVmRuVf/oZ2JycxJU9Y+2FQj1Af2Y= 2 + github.com/g3n/engine v0.2.0/go.mod h1:rnj8jiLdKEDI8VbveKhmdL4rovjjy+uxNP5YROg2x8g= 3 + github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210410170116-ea3d685f79fb h1:T6gaWBvRzJjuOrdCtg8fXXjKai2xSDqWTcKFUPuw8Tw= 4 + github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210410170116-ea3d685f79fb/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= 5 + github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= 6 + github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= 7 + golang.org/x/image v0.0.0-20210607152325-775e3b0c77b9 h1:D0iM1dTCbD5Dg1CbuvLC/v/agLc79efSj/L35Q3Vqhs= 8 + golang.org/x/image v0.0.0-20210607152325-775e3b0c77b9/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= 9 + golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 10 + golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 11 + gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= 12 + gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 13 + gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 14 + gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
+81
main.go
··· 1 + package main 2 + 3 + import ( 4 + "time" 5 + 6 + "github.com/g3n/engine/app" 7 + "github.com/g3n/engine/camera" 8 + "github.com/g3n/engine/core" 9 + "github.com/g3n/engine/geometry" 10 + "github.com/g3n/engine/gls" 11 + "github.com/g3n/engine/graphic" 12 + "github.com/g3n/engine/gui" 13 + "github.com/g3n/engine/light" 14 + "github.com/g3n/engine/material" 15 + "github.com/g3n/engine/math32" 16 + "github.com/g3n/engine/renderer" 17 + "github.com/g3n/engine/util/helper" 18 + "github.com/g3n/engine/window" 19 + ) 20 + 21 + func main() { 22 + // Create the application and scene 23 + a := app.App() 24 + scene := core.NewNode() 25 + 26 + // Set the scene to be managed by the gui manager 27 + gui.Manager().Set(scene) 28 + 29 + // Create perspective camera 30 + cam := camera.New(1) 31 + cam.SetPosition(0, 0, 3) 32 + scene.Add(cam) 33 + 34 + // Set up orbit control for the camera 35 + camera.NewOrbitControl(cam) 36 + 37 + // Set up callback to update viewport and camera aspect ratio when the window is resized 38 + onResize := func(evname string, ev interface{}) { 39 + // Get framebuffer size and update viewport accordingly 40 + width, height := a.GetSize() 41 + a.Gls().Viewport(0, 0, int32(width), int32(height)) 42 + // Update the camera's aspect ratio 43 + cam.SetAspect(float32(width) / float32(height)) 44 + } 45 + 46 + a.Subscribe(window.OnWindowSize, onResize) 47 + onResize("", nil) 48 + 49 + // Create a blue torus and add it to the scene 50 + geom := geometry.NewTorus(1, 0.4, 12, 32, math32.Pi*2) 51 + mat := material.NewStandard(math32.NewColor("DarkBlue")) 52 + mesh := graphic.NewMesh(geom, mat) 53 + scene.Add(mesh) 54 + 55 + // Create and add a button to the scene 56 + btn := gui.NewButton("Make Red") 57 + btn.SetPosition(100, 40) 58 + btn.SetSize(40, 40) 59 + btn.Subscribe(gui.OnClick, func(name string, ev interface{}) { 60 + mat.SetColor(math32.NewColor("DarkRed")) 61 + }) 62 + scene.Add(btn) 63 + 64 + // Create and add lights to the scene 65 + scene.Add(light.NewAmbient(&math32.Color{1.0, 1.0, 1.0}, 0.8)) 66 + pointLight := light.NewPoint(&math32.Color{1, 1, 1}, 5.0) 67 + pointLight.SetPosition(1, 0, 2) 68 + scene.Add(pointLight) 69 + 70 + // Create and add an axis helper to the scene 71 + scene.Add(helper.NewAxes(0.5)) 72 + 73 + // Set background color to gray 74 + a.Gls().ClearColor(0.5, 0.5, 0.5, 1.0) 75 + 76 + // Run the application 77 + a.Run(func(renderer *renderer.Renderer, deltaTime time.Duration) { 78 + a.Gls().Clear(gls.DEPTH_BUFFER_BIT | gls.STENCIL_BUFFER_BIT | gls.COLOR_BUFFER_BIT) 79 + renderer.Render(scene, cam) 80 + }) 81 + }