Documentation
¶
Index ¶
- Constants
- Variables
- func AssignSelector(n int) rl.Rectangle
- func DoHandle(h rl.Vector2, recscr dRectangle, interactive bool) bool
- func DoPromptText(S *State, position rl.Vector2)
- func DrawStatusBar(S *State)
- func HandleResize(S *State, r *dRectangle, h rl.Vector2)
- func LoadFont()
- func NewdRectangle(start rl.Vector2, end rl.Vector2) dRectangle
- func Vector2Divide(v rl.Vector2, i float32) rl.Vector2
- type Brush
- type Canvas
- type File
- type MenuBarButton
- type Picker
- type Prompt
- type State
- func CloseColorDialog(S *State) *State
- func CloseShapeSelector(S *State, shape int) *State
- func CommitSelection(S *State) *State
- func CommitShape(S *State) *State
- func DoColorDialog(S *State) *State
- func DoHandles(S *State) *State
- func DoSelectFragment(S *State) *State
- func DoShapeSelector(S *State) *State
- func DrawMenuBar(S *State) (ret *State)
- func FragmentSelected(S *State) *State
- func MenuPlaceholder(S *State) *State
- func NewFile(S *State) *State
- func OpenColorDialog(S *State) *State
- func OpenFile(S *State) *State
- func OpenShapeSelector(S *State) *State
- func Quit(S *State) *State
- func SaveFile(S *State) *State
- func (S *State) Alert(a string)
- func (S *State) CanGetMouseMovement() bool
- func (S *State) Change(snapshot bool) *State
- func (S *State) Cleanup(all bool)
- func (S *State) DebugMemory()
- func (S *State) DebugSnapshots() (int, int)
- func (S *State) DoPrompt()
- func (S *State) Redo() *State
- func (S *State) Reset()
- func (S *State) ShowPrompt(action string, prompt string, input string)
- func (S *State) Undo() *State
- func (S *State) Unload()
Constants ¶
View Source
const ( S_Line = iota S_Rectangle S_RectangleLines S_Ellipse S_EllipseLines ShapeNumber )
View Source
const ( M_Brush = 1 << iota // Brush enabled M_Dialog // Display a dialog M_Selection // Select a region on canvas M_Handles // Manipulate a region on canvas // Selection is (or is going to be, in case of M_Selection) stored separately from main canvas. // Used for things like clipboard and moving fragments of canvas. Not set e.g. when the region is used to draw a shape. M_ExternalSelection M_Shape )
ModeMask
View Source
const ( D_Shapes = iota D_Color D_Prompt )
Dialog
Variables ¶
View Source
var ( C_Timeout = 0.1 // Don't draw when rl.GetTime() < State.TimeoutT + C_Timeout // Show alert for ... seconds C_AlertTime = 4 C_DefaultThickness = 6 C_DefaultCanvasSize = rl.NewVector2(1920, 1080) C_StatusBarHeight = 20 C_ChangeSnapshotT = 1 // How often to take state snapshots for history [s] C_MaxSnapshots = 16 C_Filter = true // If true, texture filtering with mipmaps will be used. C_HandleSize = 8 // Half of handle size (~radius) C_PromptMargin = 30 C_PromptMinWidth = 200 C_PromptMaxWidth = 800 )
View Source
var ( DragStart rl.Vector2 DragStartDisp rl.Vector2 // Displacement of mouse cursor in relation to handle center StartRec dRectangle IsDragging bool = false Handle rl.Vector2 )
View Source
var F rl.Font
View Source
var MenuBarButtons = []MenuBarButton{ {Name: "New", Function: NewFile}, {Name: "Open", Function: OpenFile}, {Name: "Save", Function: SaveFile}, {Name: "Quit", Function: Quit}, {Name: "Color", Function: OpenColorDialog}, {Name: "Shape", Function: OpenShapeSelector}, }
View Source
var UiBtnFlag = ""
Functions ¶
func AssignSelector ¶
func DoPromptText ¶
func DrawStatusBar ¶
func DrawStatusBar(S *State)
func HandleResize ¶
Types ¶
type Brush ¶
func (*Brush) DoThickness ¶
func (B *Brush) DoThickness()
type Canvas ¶
type MenuBarButton ¶
type Picker ¶
type Picker struct { H float32 // Hue [0..360] S float32 // Saturation [0..1] V float32 // Value [0..1] A float32 // Alpha [0..1] }
func ColorToPicker ¶
type State ¶
type State struct { // Brush Brush Brush Mode int LastMode int Dialog int // D_Prompt Prompt *Prompt BaseSize rl.Vector2 // Used for aspect ratio calculations Selection dRectangle // Canvas space // M_ExternalSelection SelectionTex rl.RenderTexture2D // M_Shape Shape int // Canvas Canvas Canvas MouseOld rl.Vector2 // Don't draw when MouseOld==(Vector2){-1,-1} TimeoutT float32 // Don't draw when GetTime() < TimeoutT + C_Timeout Time float32 // When was this state created OldCanvas rl.Image // Only for history Next *State Previous *State // File File *File AlertTime float32 AlertMessage string }
func CloseColorDialog ¶
func CloseShapeSelector ¶
If shape == -1 then no shape was selected
func CommitSelection ¶
func CommitShape ¶
func DoColorDialog ¶
func DoSelectFragment ¶
func DoShapeSelector ¶
func DrawMenuBar ¶
func FragmentSelected ¶
func MenuPlaceholder ¶
func OpenColorDialog ¶
func OpenShapeSelector ¶
func (*State) CanGetMouseMovement ¶
func (*State) DebugMemory ¶
func (S *State) DebugMemory()
func (*State) DebugSnapshots ¶
Click to show internal directories.
Click to hide internal directories.