progress using my own graphics interface

This commit is contained in:
2026-01-06 00:35:24 -06:00
parent 59a2f08349
commit bbad63c60a
7 changed files with 230 additions and 195 deletions

View File

@@ -2,9 +2,9 @@ package main
import (
"fmt"
"math"
rl "github.com/gen2brain/raylib-go/raylib"
"github.com/ojrac/opensimplex-go"
"math"
)
type Field interface {
@@ -75,9 +75,9 @@ func NewImageField(path string) *ImageField {
h: int(image.Height),
colors: colors,
}
offsetX := int(image.Width)/2
offsetY := int(image.Height)/2
return &ImageField {
offsetX := int(image.Width) / 2
offsetY := int(image.Height) / 2
return &ImageField{
image: image,
pixels: pixels,
offsetX: offsetX,
@@ -92,18 +92,17 @@ func (f *ImageField) Get(x, y float32) float32 {
return Brightness(c)
}
/** LAYER HELPERS **/
type FieldLayer struct {
field Field
field Field
loColor rl.Color
hiColor rl.Color
dirty bool
dirty bool
}
func (fl *FieldLayer) Update(ctx *RenderCtx) {
;
}
func (fl *FieldLayer) Draw(ctx *RenderCtx) {
@@ -136,7 +135,7 @@ func (f *AdderField) Get(x, y float32) float32 {
return z
}
type SinXYField struct {}
type SinXYField struct{}
func (f *SinXYField) Get(x, y float32) float32 {
return float32(0.5 + 0.5*math.Sin(float64(x))*math.Sin(float64(y)))