grugui

package
v0.0.0-...-8789af9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

grugui draws directly to textures.

It's not the best idea to use it...
which is why i gave it a weird name :3

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

func NewApp

func NewApp(screenWidth, screenHeight int) *App

func (*App) CreateSurface

func (a *App) CreateSurface(width, height int) *Surface

func (*App) Render

func (a *App) Render()

func (*App) Update

func (a *App) Update()

type Context

type Context interface {
	Renderer
	Theme() *Theme
	Input
	RemoveChildSurface(child *Surface)
	AddChildSurface(width, height int) *Surface
}

type Input

type Input interface {
	GetCursorPosition() (int, int)
	GetGlobalCursorPosition() (int, int)
	IsKeyPressed(key input.Key) bool
	IsKeyJustPressed(key input.Key) bool
	IsButtonPressed(button input.MouseButton) bool
	IsButtonJustPressed(button input.MouseButton) bool
}

type Renderer

type Renderer interface {
	SetVisibility(visible bool)
	DrawRect(x, y, width, height int, c color.Color)
	FillRect(x, y, width, height int, c color.Color)
	DrawCircle(x, y, radius int, c color.Color)
	FillCircle(x, y, radius int, c color.Color)
	DrawTriangle(points [3]geom.Point, c color.Color)
	FillTriangle(points [3]geom.Point, c color.Color)
	DrawText(x, y int, text string, c color.Color)
	DrawLine(x1, y1, x2, y2 int, c color.Color)
	DrawRoundedRectangle(x, y, width, height int, c color.Color)
	FillRoundedRectangle(x, y, width, height int, c color.Color)
	TextWidth(text string) int
	TextHeight(text string) int
	UpdateImage(image.Image) error
	ToImage() *image.RGBA
	Clear(color.Color)
	Render()
	Move(int, int)
	Resize(int, int)
	Clip(x, y, width, height int)
	GetX() int
	GetY() int
	Height() int
	Width() int
}

type Surface

type Surface struct {
	Renderer
	// contains filtered or unexported fields
}

func NewSurface

func NewSurface(width, height int) *Surface

func (*Surface) Add

func (s *Surface) Add(v View)

func (*Surface) AddChildSurface

func (s *Surface) AddChildSurface(width, height int) *Surface

func (*Surface) Clip

func (s *Surface) Clip(x, y, width, height int)

func (*Surface) ClipToRect

func (s *Surface) ClipToRect(rect image.Rectangle)

func (*Surface) GetCursorPosition

func (i *Surface) GetCursorPosition() (int, int)

func (*Surface) GetGlobalCursorPosition

func (i *Surface) GetGlobalCursorPosition() (int, int)

func (*Surface) IsButtonJustPressed

func (i *Surface) IsButtonJustPressed(button input.MouseButton) bool

func (*Surface) IsButtonPressed

func (i *Surface) IsButtonPressed(button input.MouseButton) bool

func (*Surface) IsKeyJustPressed

func (i *Surface) IsKeyJustPressed(key input.Key) bool

func (*Surface) IsKeyPressed

func (i *Surface) IsKeyPressed(key input.Key) bool

func (*Surface) RemoveChildSurface

func (s *Surface) RemoveChildSurface(child *Surface)

func (*Surface) Render

func (s *Surface) Render()

func (*Surface) Theme

func (s *Surface) Theme() *Theme

func (*Surface) Update

func (s *Surface) Update()

type Theme

type Theme struct {
	BackgroundColor color.Color
	PrimaryColor    color.Color
	SecondaryColor  color.Color
	TextColor       color.Color
	HandleColor     color.Color
}

func DefaultTheme

func DefaultTheme() *Theme

type View

type View interface {
	Update(ctx Context)
	Render(ctx Context)
}

Directories

Path Synopsis
grugRenderer draws to textures.
grugRenderer draws to textures.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL