A dungeon delver roguelike using Pathfinder 2nd edition rules
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Adding example code

+106
+12
go.mod
··· 1 + module tangled.sh/cass.cityboundforest.com/pathdelver 2 + 3 + go 1.24.5 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=
+80
main.go
··· 1 + package main 2 + 3 + import ( 4 + "github.com/g3n/engine/app" 5 + "github.com/g3n/engine/camera" 6 + "github.com/g3n/engine/core" 7 + "github.com/g3n/engine/geometry" 8 + "github.com/g3n/engine/gls" 9 + "github.com/g3n/engine/graphic" 10 + "github.com/g3n/engine/gui" 11 + "github.com/g3n/engine/light" 12 + "github.com/g3n/engine/material" 13 + "github.com/g3n/engine/math32" 14 + "github.com/g3n/engine/renderer" 15 + "github.com/g3n/engine/util/helper" 16 + "github.com/g3n/engine/window" 17 + "time" 18 + ) 19 + 20 + func main() { 21 + // Create application and scene 22 + a := app.App() 23 + scene := core.NewNode() 24 + 25 + // Set the scene to be managed by the gui manager 26 + gui.Manager().Set(scene) 27 + 28 + // Create perspective camera 29 + cam := camera.New(1) 30 + cam.SetPosition(0, 0, 3) 31 + scene.Add(cam) 32 + 33 + // Set up orbit control for the camera 34 + camera.NewOrbitControl(cam) 35 + 36 + // Set up callback to update viewport and camera aspect ratio when the window is resized 37 + onResize := func(evname string, ev any) { 38 + // Get framebuffer size and update viewport accordingly 39 + width, height := a.GetSize() 40 + a.Gls().Viewport(0, 0, int32(width), int32(height)) 41 + // Update the camera's aspect ratio 42 + cam.SetAspect(float32(width) / float32(height)) 43 + } 44 + 45 + a.Subscribe(window.OnWindowSize, onResize) 46 + onResize("", nil) 47 + 48 + // Create a blue torus and add it to the screen 49 + geom := geometry.NewTorus(1, 0.4, 12, 32, math32.Pi * 2) 50 + mat := material.NewStandard(math32.NewColor("DarkBlue")) 51 + mesh := graphic.NewMesh(geom, mat) 52 + scene.Add(mesh) 53 + 54 + // Create and add a button to the scene 55 + btn := gui.NewButton("Make Red") 56 + btn.SetPosition(100, 40) 57 + btn.SetSize(40, 40) 58 + btn.Subscribe(gui.OnClick, func(name string, ev any) { 59 + mat.SetColor(math32.NewColor("DarkRed")) 60 + }) 61 + scene.Add(btn) 62 + 63 + // Create and add lights to the scene 64 + scene.Add(light.NewAmbient(&math32.Color{1.0, 1.0, 1.0}, 8.0)) 65 + pointLight := light.NewPoint(&math32.Color{1.0, 1.0, 1.0}, 5.0) 66 + pointLight.SetPosition(1, 0, 2) 67 + scene.Add(pointLight) 68 + 69 + // Create and add an axis helper to the scene 70 + scene.Add(helper.NewAxes(0.5)) 71 + 72 + // Set background color to gray 73 + a.Gls().ClearColor(0.5, 0.5, 0.5, 1.0) 74 + 75 + // Run the application 76 + a.Run(func(renderer *renderer.Renderer, deltaTime time.Duration) { 77 + a.Gls().Clear(gls.DEPTH_BUFFER_BIT | gls.STENCIL_BUFFER_BIT | gls.COLOR_BUFFER_BIT) 78 + renderer.Render(scene, cam) 79 + }) 80 + }