Documentation ¶
Index ¶
- Constants
- type Sketch
- func (s *Sketch) CanvasCoords(x, y float64) gaul.Point
- func (s *Sketch) CanvasRect() gaul.Rect
- func (s *Sketch) Clear()
- func (s *Sketch) Draw(screen *ebiten.Image)
- func (s *Sketch) DrawControls(ctx *canvas.Context)
- func (s *Sketch) DumpState()
- func (s *Sketch) FullWidth() float64
- func (s *Sketch) Height() float64
- func (s *Sketch) Init()
- func (s *Sketch) Layout(int, int) (int, int)
- func (s *Sketch) PlaceControls(_ float64, _ float64, ctx *canvas.Context)
- func (s *Sketch) PointInSketchArea(x, y float64) bool
- func (s *Sketch) RandomHeight() float64
- func (s *Sketch) RandomWidth() float64
- func (s *Sketch) RandomizeSlider(name string)
- func (s *Sketch) RandomizeSliders()
- func (s *Sketch) SketchCoords(x, y float64) gaul.Point
- func (s *Sketch) Slider(name string) float64
- func (s *Sketch) Toggle(name string) bool
- func (s *Sketch) Update() error
- func (s *Sketch) UpdateControls()
- func (s *Sketch) Width() float64
- type SketchDrawer
- type SketchUpdater
- type Slider
- func (s *Slider) CheckAndUpdate(ctx *canvas.Canvas) (bool, error)
- func (s *Slider) Draw(ctx *canvas.Context)
- func (s *Slider) GetPercentage() float64
- func (s *Slider) GetRect() gaul.Rect
- func (s *Slider) IsInside(x float64, y float64) bool
- func (s *Slider) Randomize()
- func (s *Slider) SetFont(ff *canvas.FontFamily)
- func (s *Slider) StringVal() string
- func (s *Slider) Update(x float64)
- type Toggle
Constants ¶
View Source
const ( SliderHeight = 4.0 SliderHPadding = 2.0 SliderVPadding = 2.0 SliderMouseWheelThreshold = 0.5 SliderBackgroundColor = "#1e1e1e" SliderOutlineColor = "#ffdb00" SliderFillColor = "#ffdb00" SliderTextColor = "#ffffff" SliderGradientStart = "cyan" SliderGradientEnd = "magenta" ToggleHeight = 5.5 ToggleHPadding = 3.0 ToggleVPadding = 2.0 ToggleBackgroundColor = "#1e1e1e" ToggleOutlineColor = "#ffdb00" ToggleFillColor = "#ffdb00" ToggleTextColor = "#ffffff" ButtonHeight = 5.5 TextHeight = 5.5 FontSize = 10 )
View Source
const ( DefaultTitle = "Sketch" DefaultPrefix = "sketch" DefaultBackgroundColor = "#1e1e1e" DefaultOutlineColor = "#ffdb00" DefaultSketchOutlineColor = "" ControlAreaMargin = 1.0 MmPerPx = 0.26458333 DefaultDPI = 96.0 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Sketch ¶
type Sketch struct { Title string `json:"Title"` Prefix string `json:"Prefix"` SketchWidth float64 `json:"SketchWidth"` SketchHeight float64 `json:"SketchHeight"` ControlWidth float64 `json:"ControlWidth"` ControlBackgroundColor string `json:"ControlBackgroundColor"` ControlOutlineColor string `json:"ControlOutlineColor"` SketchBackgroundColor string `json:"SketchBackgroundColor"` SketchOutlineColor string `json:"SketchOutlineColor"` DisableClearBetweenFrames bool `json:"DisableClearBetweenFrames"` ShowFPS bool `json:"ShowFPS"` RasterDPI float64 `json:"RasterDPI"` RandomSeed int64 `json:"RandomSeed"` Sliders []Slider `json:"Sliders"` Toggles []Toggle `json:"Toggles"` Updater SketchUpdater `json:"-"` Drawer SketchDrawer `json:"-"` DidControlsChange bool `json:"-"` Rand gaul.Rng `json:"-"` ToggleControlMap map[string]int `json:"-"` Tick int64 `json:"-"` ControlCanvas *canvas.Canvas `json:"-"` SketchCanvas *canvas.Canvas `json:"-"` FontFamily *canvas.FontFamily `json:"-"` FontFace *canvas.FontFace `json:"-"` // contains filtered or unexported fields }
func NewSketchFromFile ¶
func (*Sketch) CanvasCoords ¶
CanvasCoords converts window coordinates (pixels, upper left origin) to canvas coordinates (mm, lower left origin)
func (*Sketch) CanvasRect ¶
func (*Sketch) DrawControls ¶
func (*Sketch) PlaceControls ¶
func (*Sketch) PointInSketchArea ¶
PointInSketchArea calculates coordinates in pixels, useful when checkin if mouse clicks are in the sketch area
func (*Sketch) RandomHeight ¶
func (*Sketch) RandomWidth ¶
func (*Sketch) RandomizeSlider ¶
func (*Sketch) RandomizeSliders ¶
func (s *Sketch) RandomizeSliders()
func (*Sketch) SketchCoords ¶
SketchCoords converts canvas coordinates (mm, lower left origin) to sketch coordinates (pixels, upper left origin) this ignores the control area
func (*Sketch) UpdateControls ¶
func (s *Sketch) UpdateControls()
type SketchDrawer ¶
type SketchUpdater ¶
type SketchUpdater func(s *Sketch)
type Slider ¶
type Slider struct { Name string `json:"Name"` Pos gaul.Point `json:"-"` Width float64 `json:"Width"` Height float64 `json:"Height"` MinVal float64 `json:"MinVal"` MaxVal float64 `json:"MaxVal"` Val float64 `json:"Val"` Incr float64 `json:"Incr"` OutlineColor string `json:"OutlineColor"` BackgroundColor string `json:"BackgroundColor"` FillColor string `json:"FillColor"` UseGradientFill bool `json:"UseGradientFill"` GradientStartColor string `json:"GradientStartColor"` GradientEndColor string `json:"GradientEndColor"` TextColor string `json:"TextColor"` DrawRect bool `json:"DrawRect"` DidJustChange bool `json:"-"` // contains filtered or unexported fields }
func (*Slider) GetPercentage ¶
func (*Slider) SetFont ¶
func (s *Slider) SetFont(ff *canvas.FontFamily)
type Toggle ¶
type Toggle struct { Name string `json:"Name"` Pos gaul.Point `json:"-"` Width float64 `json:"Width"` Height float64 `json:"Height"` Checked bool `json:"Checked"` IsButton bool `json:"IsButton"` OutlineColor string `json:"OutlineColor"` BackgroundColor string `json:"BackgroundColor"` FillColor string `json:"FillColor"` TextColor string `json:"TextColor"` DidJustChange bool `json:"-"` // contains filtered or unexported fields }
func (*Toggle) SetFont ¶
func (t *Toggle) SetFont(ff *canvas.FontFamily)
Click to show internal directories.
Click to hide internal directories.