ki

package
v0.0.0-...-923ccd2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EngineWindowUnit = 1048576
	EngineWindowGaps = 16
)

Variables

View Source
var (
	ENGINE             *sync.Mutex[*Engine] = nil
	RpcExecuteModeHttp                      = lerpc.ClientModeHttpOnly
	RpcSecure          uint32               = 0
)
View Source
var (
	I = -1
	W = []string{"G", "N", "L", "P"}
)
View Source
var (
	GRAPHICS *sync.Mutex[*Graphics] = nil
)
View Source
var (
	POOL *sync.Mutex[*Pool] = nil
)
View Source
var (
	ServerDefaultPort = 12000
)

Functions

func PoolGet

func PoolGet[T any](key string) (result optionals.Optional[*structure.Cached[T]])

func PoolRegister

func PoolRegister[T any](key string, value *structure.Cached[T])

Types

type Client

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

func (*Client) HttpGet

func (client *Client) HttpGet(url string) (data []byte, err error)

func (*Client) HttpGetJson

func (client *Client) HttpGetJson(url string, dst any) (err error)

func (*Client) HttpPost

func (client *Client) HttpPost(url string, data []byte) (result []byte, err error)

func (*Client) HttpPostJson

func (client *Client) HttpPostJson(url string, src any, dst any) (err error)

func (*Client) Init

func (client *Client) Init() *Client

type Controller

type Controller interface {
	Window() Window
	SetWindow(Window)

	Compute() error
	Render() error
}

type ControllerBase

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

func (*ControllerBase) Init

func (controller *ControllerBase) Init() *ControllerBase

func (*ControllerBase) SetWindow

func (controller *ControllerBase) SetWindow(value Window)

func (*ControllerBase) Window

func (controller *ControllerBase) Window() Window

type ControllerGraph

type ControllerGraph struct {
	ControllerBase
	// contains filtered or unexported fields
}

func (*ControllerGraph) AddValue

func (controller *ControllerGraph) AddValue(value float64)

func (*ControllerGraph) Compute

func (controller *ControllerGraph) Compute() (err error)

func (*ControllerGraph) Init

func (controller *ControllerGraph) Init() *ControllerGraph

func (*ControllerGraph) Render

func (controller *ControllerGraph) Render() (err error)

func (*ControllerGraph) SetValue

func (controller *ControllerGraph) SetValue(value []float64)

func (*ControllerGraph) Value

func (controller *ControllerGraph) Value() []float64

type ControllerList

type ControllerList struct {
	ControllerBase
	// contains filtered or unexported fields
}

func (*ControllerList) AddValue

func (controller *ControllerList) AddValue(value string)

func (*ControllerList) Compute

func (controller *ControllerList) Compute() (err error)

func (*ControllerList) Init

func (controller *ControllerList) Init() *ControllerList

func (*ControllerList) Render

func (controller *ControllerList) Render() (err error)

func (*ControllerList) SetValue

func (controller *ControllerList) SetValue(value []string)

func (*ControllerList) Value

func (controller *ControllerList) Value() []string

type ControllerNumber

type ControllerNumber[T structure.Number] struct {
	ControllerBase
	// contains filtered or unexported fields
}

func (*ControllerNumber[T]) AddValue

func (controller *ControllerNumber[T]) AddValue(value T)

func (*ControllerNumber[T]) Compute

func (controller *ControllerNumber[T]) Compute() (err error)

func (*ControllerNumber[T]) Init

func (controller *ControllerNumber[T]) Init() *ControllerNumber[T]

func (*ControllerNumber[T]) Render

func (controller *ControllerNumber[T]) Render() (err error)

func (*ControllerNumber[T]) SetValue

func (controller *ControllerNumber[T]) SetValue(value T)

func (*ControllerNumber[T]) Value

func (controller *ControllerNumber[T]) Value() T

type ControllerPie

type ControllerPie struct {
	ControllerBase
	// contains filtered or unexported fields
}

func (*ControllerPie) Compute

func (controller *ControllerPie) Compute() (err error)

func (*ControllerPie) Init

func (controller *ControllerPie) Init() *ControllerPie

func (*ControllerPie) Render

func (controller *ControllerPie) Render() (err error)

func (*ControllerPie) SetValue

func (controller *ControllerPie) SetValue(value []structure.Pair[string, float64])

func (*ControllerPie) Value

func (controller *ControllerPie) Value() []structure.Pair[string, float64]

type Engine

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

func (*Engine) Client

func (engine *Engine) Client() *Client

func (*Engine) Close

func (engine *Engine) Close() (err error)

func (*Engine) Compute

func (engine *Engine) Compute() (err error)

func (*Engine) ComputeWindows

func (engine *Engine) ComputeWindows() (err error)

func (*Engine) ComputeWindowsStep

func (engine *Engine) ComputeWindowsStep(node *structure.BinaryTreeNode[Window]) (err error)

func (*Engine) Cursor

func (engine *Engine) Cursor() structure.Vector2[int32]

Cursor position vector

func (*Engine) Graphics

func (engine *Engine) Graphics() *Graphics

func (*Engine) HandleCursor

func (engine *Engine) HandleCursor() (err error)

func (*Engine) HandleInputs

func (engine *Engine) HandleInputs() (err error)

func (*Engine) Init

func (engine *Engine) Init() *Engine

func (*Engine) Logic

func (engine *Engine) Logic() *Logic

func (*Engine) Pool

func (engine *Engine) Pool() *Pool

func (*Engine) Render

func (engine *Engine) Render() (err error)

func (*Engine) RenderCursor

func (engine *Engine) RenderCursor() (err error)

func (*Engine) RenderWindowStep

func (engine *Engine) RenderWindowStep(node *structure.BinaryTreeNode[Window]) (err error)

func (*Engine) RenderWindows

func (engine *Engine) RenderWindows() (err error)

func (*Engine) RenderWindowsSelected

func (engine *Engine) RenderWindowsSelected() (err error)

func (*Engine) RpcClient

func (engine *Engine) RpcClient() *lerpc.Client

func (*Engine) Running

func (engine *Engine) Running() bool

func (*Engine) Screen

func (engine *Engine) Screen() structure.Vector2[int32]

Screen render size vector

func (*Engine) Screenshot

func (engine *Engine) Screenshot() (err error)

func (*Engine) Start

func (engine *Engine) Start() (err error)

Start the Ki dashboard engine

func (*Engine) Wait

func (engine *Engine) Wait()

func (*Engine) WindowChildAdd

func (engine *Engine) WindowChildAdd(
	node *structure.BinaryTreeNode[Window],
	value Window,
	axis WindowSplitAxis,
	direction structure.BinaryTreeDirection,
) (result *structure.BinaryTreeNode[Window])

func (*Engine) WindowList

func (engine *Engine) WindowList() (result []Window, err error)

func (*Engine) WindowListWalkNode

func (engine *Engine) WindowListWalkNode(fn func(*structure.BinaryTreeNode[Window]) error) (err error)

func (*Engine) WindowListWalkNodeStep

func (engine *Engine) WindowListWalkNodeStep(node *structure.BinaryTreeNode[Window], fn func(*structure.BinaryTreeNode[Window]) error) (err error)

func (*Engine) WindowRoot

func (engine *Engine) WindowRoot() optionals.Optional[Window]

func (*Engine) WindowRootNode

func (engine *Engine) WindowRootNode() optionals.Optional[*structure.BinaryTreeNode[Window]]

func (*Engine) WindowSelected

func (engine *Engine) WindowSelected() optionals.Optional[Window]

func (*Engine) WindowSelectedNode

func (engine *Engine) WindowSelectedNode() optionals.Optional[*structure.BinaryTreeNode[Window]]

func (*Engine) WindowSplitCommon

func (engine *Engine) WindowSplitCommon(window Window, direction structure.BinaryTreeDirection) (result structure.Pair[structure.Box[int32], structure.Box[int32]])

WindowSplitCommon handles the splitting of windows this returns the box values for the current and newly created window

func (*Engine) WindowTreePrint

func (engine *Engine) WindowTreePrint()

func (*Engine) WindowTreePrintStep

func (engine *Engine) WindowTreePrintStep(node *structure.BinaryTreeNode[Window], level int, step int)

type Graphics

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

func (*Graphics) DrawCircleSector

func (graphics *Graphics) DrawCircleSector(
	pos structure.Vector2[int32],
	radius float64,
	angles structure.Pair[float64, float64],
	color structure.Vector3[uint8],
) (err error)

func (*Graphics) DrawGraph

func (graphics *Graphics) DrawGraph(
	value []float64,
	valueMin float64,
	valueMax float64,
	box structure.Box[int32],
) (err error)

func (*Graphics) DrawLine

func (graphics *Graphics) DrawLine(a, b structure.Vector2[int32], thick float64, fill color.RGBA) (err error)

func (*Graphics) DrawRectangle

func (graphics *Graphics) DrawRectangle(box structure.Box[int32], color color.RGBA) (err error)

func (*Graphics) DrawText

func (graphics *Graphics) DrawText(value string, pos structure.Vector2[int32], fontSize float64) (err error)

func (*Graphics) DrawTextCentered

func (graphics *Graphics) DrawTextCentered(value string, box structure.Box[int32]) (err error)

func (*Graphics) DrawTexture

func (graphics *Graphics) DrawTexture(value rl.Texture2D, position structure.Vector2[int32]) (err error)

func (*Graphics) DrawTextureVector

func (graphics *Graphics) DrawTextureVector(
	value rl.Texture2D,
	position structure.Vector2[int32],
	size structure.Vector2[int32],
) (err error)

func (*Graphics) Font

func (graphics *Graphics) Font() rl.Font

func (*Graphics) Init

func (graphics *Graphics) Init() *Graphics

func (*Graphics) Start

func (graphics *Graphics) Start() (err error)

type Logic

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

func (*Logic) Close

func (logic *Logic) Close() (err error)

func (*Logic) Engine

func (logic *Logic) Engine() *Engine

func (*Logic) Init

func (logic *Logic) Init() *Logic

func (*Logic) RpcDataPull

func (logic *Logic) RpcDataPull(key string) (result any, err error)

func (*Logic) Start

func (logic *Logic) Start() (err error)

type Pool

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

func (*Pool) Get

func (pool *Pool) Get(key string) (result any)

func (*Pool) Init

func (pool *Pool) Init() *Pool

func (*Pool) Register

func (pool *Pool) Register(key string, value any)

type Server

type Server struct {
	lerpc.Server
	// contains filtered or unexported fields
}

func (*Server) Close

func (server *Server) Close() (err error)

func (*Server) HandleDataPull

func (server *Server) HandleDataPull(cmd *proto.ExecuteCommand, res *proto.ExecuteResult)

func (*Server) Init

func (server *Server) Init() *Server

func (*Server) Start

func (server *Server) Start() (err error)

type Window

type Window interface {
	Id() uuid.UUID
	Type() WindowType
	Node() *structure.BinaryTreeNode[Window]
	SetNode(value *structure.BinaryTreeNode[Window])
	IsRoot() bool
	SetIsRoot(bool)
	Side() structure.BinaryTreeDirection
	SetSide(structure.BinaryTreeDirection)
	Position() structure.Vector2[int32]
	SetPosition(vector structure.Vector2[int32])
	PositionAbsolute() structure.Vector2[int32]
	SetPositionAbsolute(structure.Vector2[int32])
	Size() structure.Vector2[int32]
	SetSize(vector structure.Vector2[int32])
	SizeAbsolute() structure.Vector2[int32]
	SetSizeAbsolute(structure.Vector2[int32])
	Gaps() int32
	SetGaps(int32)
	SplitAxis() WindowSplitAxis
	SetSplitAxis(axis WindowSplitAxis)
	Selected() bool
	SetSelected(bool)
	Color() structure.Vector3[uint8]
	SetColor(structure.Vector3[uint8])

	Box() structure.Box[int32]
	BoxAbs() structure.Box[int32]
	BoxRender() structure.Box[int32]

	CursorPosition() structure.Vector2[int32]
	SetCursorPosition(structure.Vector2[int32])

	Controller() Controller
	SetController(Controller)

	Compute() error
	Render() error
}

type WindowImage

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

func (*WindowImage) Box

func (window *WindowImage) Box() structure.Box[int32]

func (*WindowImage) BoxAbs

func (window *WindowImage) BoxAbs() structure.Box[int32]

func (*WindowImage) BoxRender

func (window *WindowImage) BoxRender() structure.Box[int32]

func (*WindowImage) Color

func (window *WindowImage) Color() structure.Vector3[uint8]

func (*WindowImage) Compute

func (window *WindowImage) Compute() (err error)

func (*WindowImage) Controller

func (window *WindowImage) Controller() Controller

func (*WindowImage) CursorPosition

func (window *WindowImage) CursorPosition() structure.Vector2[int32]

func (*WindowImage) Gaps

func (window *WindowImage) Gaps() int32

func (*WindowImage) Id

func (window *WindowImage) Id() uuid.UUID

func (*WindowImage) Init

func (window *WindowImage) Init() *WindowImage

func (*WindowImage) IsRoot

func (window *WindowImage) IsRoot() bool

func (*WindowImage) Node

func (window *WindowImage) Node() *structure.BinaryTreeNode[Window]

func (*WindowImage) Position

func (window *WindowImage) Position() structure.Vector2[int32]

func (*WindowImage) PositionAbsolute

func (window *WindowImage) PositionAbsolute() structure.Vector2[int32]

func (*WindowImage) Render

func (window *WindowImage) Render() (err error)

func (*WindowImage) Selected

func (window *WindowImage) Selected() bool

func (*WindowImage) SetColor

func (window *WindowImage) SetColor(value structure.Vector3[uint8])

func (*WindowImage) SetController

func (window *WindowImage) SetController(value Controller)

func (*WindowImage) SetCursorPosition

func (window *WindowImage) SetCursorPosition(value structure.Vector2[int32])

func (*WindowImage) SetGaps

func (window *WindowImage) SetGaps(value int32)

func (*WindowImage) SetIsRoot

func (window *WindowImage) SetIsRoot(value bool)

func (*WindowImage) SetNode

func (window *WindowImage) SetNode(value *structure.BinaryTreeNode[Window])

func (*WindowImage) SetPosition

func (window *WindowImage) SetPosition(value structure.Vector2[int32])

func (*WindowImage) SetPositionAbsolute

func (window *WindowImage) SetPositionAbsolute(value structure.Vector2[int32])

func (*WindowImage) SetSelected

func (window *WindowImage) SetSelected(value bool)

func (*WindowImage) SetSide

func (window *WindowImage) SetSide(value structure.BinaryTreeDirection)

func (*WindowImage) SetSize

func (window *WindowImage) SetSize(value structure.Vector2[int32])

func (*WindowImage) SetSizeAbsolute

func (window *WindowImage) SetSizeAbsolute(value structure.Vector2[int32])

func (*WindowImage) SetSplitAxis

func (window *WindowImage) SetSplitAxis(value WindowSplitAxis)

func (*WindowImage) Side

func (window *WindowImage) Side() structure.BinaryTreeDirection

func (*WindowImage) Size

func (window *WindowImage) Size() structure.Vector2[int32]

func (*WindowImage) SizeAbsolute

func (window *WindowImage) SizeAbsolute() structure.Vector2[int32]

func (*WindowImage) SplitAxis

func (window *WindowImage) SplitAxis() WindowSplitAxis

func (*WindowImage) Type

func (window *WindowImage) Type() WindowType

type WindowSplit

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

func (*WindowSplit) Box

func (window *WindowSplit) Box() structure.Box[int32]

func (*WindowSplit) BoxAbs

func (window *WindowSplit) BoxAbs() structure.Box[int32]

func (*WindowSplit) BoxRender

func (window *WindowSplit) BoxRender() structure.Box[int32]

func (*WindowSplit) Color

func (window *WindowSplit) Color() structure.Vector3[uint8]

func (*WindowSplit) Compute

func (window *WindowSplit) Compute() (err error)

func (*WindowSplit) Controller

func (window *WindowSplit) Controller() Controller

func (*WindowSplit) CursorPosition

func (window *WindowSplit) CursorPosition() structure.Vector2[int32]

func (*WindowSplit) Gaps

func (window *WindowSplit) Gaps() int32

func (*WindowSplit) Id

func (window *WindowSplit) Id() uuid.UUID

func (*WindowSplit) Init

func (window *WindowSplit) Init() *WindowSplit

func (*WindowSplit) IsRoot

func (window *WindowSplit) IsRoot() bool

func (*WindowSplit) Node

func (window *WindowSplit) Node() *structure.BinaryTreeNode[Window]

func (*WindowSplit) Position

func (window *WindowSplit) Position() structure.Vector2[int32]

func (*WindowSplit) PositionAbsolute

func (window *WindowSplit) PositionAbsolute() structure.Vector2[int32]

func (*WindowSplit) Render

func (window *WindowSplit) Render() (err error)

func (*WindowSplit) Selected

func (window *WindowSplit) Selected() bool

func (*WindowSplit) SetColor

func (window *WindowSplit) SetColor(value structure.Vector3[uint8])

func (*WindowSplit) SetController

func (window *WindowSplit) SetController(_ Controller)

func (*WindowSplit) SetCursorPosition

func (window *WindowSplit) SetCursorPosition(value structure.Vector2[int32])

func (*WindowSplit) SetGaps

func (window *WindowSplit) SetGaps(value int32)

func (*WindowSplit) SetIsRoot

func (window *WindowSplit) SetIsRoot(value bool)

func (*WindowSplit) SetNode

func (window *WindowSplit) SetNode(value *structure.BinaryTreeNode[Window])

func (*WindowSplit) SetPosition

func (window *WindowSplit) SetPosition(value structure.Vector2[int32])

func (*WindowSplit) SetPositionAbsolute

func (window *WindowSplit) SetPositionAbsolute(value structure.Vector2[int32])

func (*WindowSplit) SetSelected

func (window *WindowSplit) SetSelected(value bool)

func (*WindowSplit) SetSide

func (window *WindowSplit) SetSide(value structure.BinaryTreeDirection)

func (*WindowSplit) SetSize

func (window *WindowSplit) SetSize(value structure.Vector2[int32])

func (*WindowSplit) SetSizeAbsolute

func (window *WindowSplit) SetSizeAbsolute(value structure.Vector2[int32])

func (*WindowSplit) SetSplitAxis

func (window *WindowSplit) SetSplitAxis(value WindowSplitAxis)

func (*WindowSplit) Side

func (window *WindowSplit) Side() structure.BinaryTreeDirection

func (*WindowSplit) Size

func (window *WindowSplit) Size() structure.Vector2[int32]

func (*WindowSplit) SizeAbsolute

func (window *WindowSplit) SizeAbsolute() structure.Vector2[int32]

func (*WindowSplit) SplitAxis

func (window *WindowSplit) SplitAxis() WindowSplitAxis

func (*WindowSplit) Type

func (window *WindowSplit) Type() WindowType

type WindowSplitAxis

type WindowSplitAxis int8
const (
	WindowSplitHorizontal WindowSplitAxis = iota
	WindowSplitVertical
)

type WindowType

type WindowType int32
const (
	WindowTypeNone WindowType = iota
	WindowTypeSplit
	WindowTypeImage
)

Jump to

Keyboard shortcuts

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