Documentation ¶
Index ¶
- Variables
- type CaptionScreen
- type CaptionStyle
- type Layout
- func (l Layout) Bottom(name string) float64
- func (l Layout) Contract(name string, horz, vert float64)
- func (l Layout) CreatePanel(name string) Panel
- func (l Layout) DebugRender(win *pixelgl.Window)
- func (l Layout) Left(name string) float64
- func (l Layout) MidX(name string) float64
- func (l Layout) MidY(name string) float64
- func (l Layout) Right(name string) float64
- func (l *Layout) SplitHorz(name, topName, bottomName string, x, margin float64)
- func (l *Layout) SplitVert(name, leftName, rightName string, y, margin float64)
- func (l Layout) Top(name string) float64
- type Panel
- type PanelDef
- type ProgressBar
- func (pb ProgressBar) Enter()
- func (pb ProgressBar) Exit()
- func (pb ProgressBar) GetPosition() (x, y float64)
- func (pb ProgressBar) HandleInput(win *pixelgl.Window)
- func (pb ProgressBar) Render(renderer pixel.Target)
- func (pb *ProgressBar) SetMax(maxHealth float64)
- func (pb *ProgressBar) SetPosition(x, y float64)
- func (pb *ProgressBar) SetValue(health float64)
- func (pb ProgressBar) Update(dt float64) bool
- type ProgressBarIMD
- func (pb ProgressBarIMD) Enter()
- func (pb ProgressBarIMD) Exit()
- func (pb ProgressBarIMD) GetPercentWidth() float64
- func (pb ProgressBarIMD) GetPosition() (x, y float64)
- func (pb ProgressBarIMD) HandleInput(win *pixelgl.Window)
- func (pb ProgressBarIMD) Render(renderer pixel.Target)
- func (pb *ProgressBarIMD) SetMax(maxHealth float64)
- func (pb *ProgressBarIMD) SetPosition(x, y float64)
- func (pb *ProgressBarIMD) SetValue(health float64)
- func (pb ProgressBarIMD) Update(dt float64) bool
- type SelectionMenu
- func (m SelectionMenu) CanScrollDown() bool
- func (m SelectionMenu) CanScrollUp() bool
- func (m SelectionMenu) GetHeight() float64
- func (m SelectionMenu) GetIndex() int
- func (m *SelectionMenu) GetWidth() float64
- func (m *SelectionMenu) HandleInput(window *pixelgl.Window)
- func (m *SelectionMenu) HideCursor()
- func (m SelectionMenu) IsDataSourceEmpty() bool
- func (m *SelectionMenu) MoveDisplayDown()
- func (m *SelectionMenu) MoveDisplayUp()
- func (m *SelectionMenu) MoveDown()
- func (m *SelectionMenu) MoveLeft()
- func (m *SelectionMenu) MoveRight()
- func (m *SelectionMenu) MoveUp()
- func (m *SelectionMenu) OffsetCursorPosition(x, y float64)
- func (m SelectionMenu) OnClick()
- func (m SelectionMenu) Render(renderer *pixelgl.Window)
- func (m SelectionMenu) SelectedItem() interface{}
- func (m *SelectionMenu) SetColumns(columns, maxRows int)
- func (m *SelectionMenu) SetPosition(x, y float64)
- func (m *SelectionMenu) ShowCursor()
- type SimpleCaptionsScreen
- type StackInterface
- type StateStack
- func (ss *StateStack) Clear()
- func (ss StateStack) GetLastIndex() int
- func (ss *StateStack) Pop() StackInterface
- func (ss *StateStack) Push(state StackInterface)
- func (ss *StateStack) PushFITMenu(x, y float64, txt string, choices []string, onSelection func(int, interface{}))
- func (ss *StateStack) PushFitted(x, y float64, txt string) *Textbox
- func (ss *StateStack) PushFixed(x, y, width, height float64, txt, avatarName string, avatarPng pixel.Picture)
- func (ss *StateStack) PushSelectionMenu(x, y, width, height float64, txt string, choices []string, ...)
- func (ss *StateStack) RemoveStateAtIndex(i int)
- func (ss StateStack) Render(renderer *pixelgl.Window)
- func (ss StateStack) Top() *StackInterface
- func (ss *StateStack) Update(dt float64)
- type Textbox
- func TextboxCreateFitted(stack *StateStack, txt string, panelPos pixel.Vec, hasMenu bool) Textbox
- func TextboxCreateFixed(stack *StateStack, txt string, panelPos pixel.Vec, ...) Textbox
- func TextboxFITMenuCreate(stack *StateStack, x, y float64, textBoxText string, choices []string, ...) *Textbox
- func TextboxFITPassedMenuCreate(stack *StateStack, x, y float64, textBoxText string, menu *SelectionMenu) *Textbox
- func TextboxNew(stack *StateStack, txt string, size float64, atlas *text.Atlas, ...) Textbox
- func TextboxWithMenuCreate(stack *StateStack, textBoxText string, panelPos pixel.Vec, ...) *Textbox
- func (t *Textbox) Enter()
- func (t *Textbox) Exit()
- func (t *Textbox) HandleInput(window *pixelgl.Window)
- func (t Textbox) HasReachedLimit() bool
- func (t *Textbox) IsDead() bool
- func (t *Textbox) Next()
- func (t *Textbox) OnClick()
- func (t *Textbox) Render(renderer *pixelgl.Window)
- func (t *Textbox) Update(dt float64) bool
- type TitleScreen
- type XPPopUp
Constants ¶
This section is empty.
Variables ¶
var ( ContinueCaretPng pixel.Picture CursorPng pixel.Picture BasicAtlas12 *text.Atlas BasicAtlasAscii *text.Atlas )
e.g.
tBox := TextboxCreateFixed(
"A nation can survive its fools, and even the ambitious. But it cannot survive treason from within. An enemy at the gates is less formidable, for he is known and carries his banner openly. But the traitor moves amongst those within the gate freely, his sly whispers rustling through all the alleys, heard in the very halls of government itself. For the traitor appears not a traitor; he speaks in accents familiar to his victims, and he wears their face and their arguments, he appeals to the baseness that lies deep in the hearts of all men. He rots the soul of a nation, he works secretly and unknown in the night to undermine the pillars of the city, he infects the body politic so that it can no longer resist. A murderer is less to fear. Jai Hind I Love India <3 ", pixel.V(-150, 200), 300, 100, "Ajinkya", avatarPng, )
Functions ¶
This section is empty.
Types ¶
type CaptionScreen ¶
func CaptionScreenCreate ¶
func CaptionScreenCreate(txt string, position pixel.Vec, scale float64) CaptionScreen
func (CaptionScreen) Exit ¶
func (s CaptionScreen) Exit()
func (CaptionScreen) HandleInput ¶
func (s CaptionScreen) HandleInput(win *pixelgl.Window)
func (CaptionScreen) Render ¶
func (s CaptionScreen) Render(win *pixelgl.Window)
func (CaptionScreen) Update ¶
func (s CaptionScreen) Update(dt float64) bool
type CaptionStyle ¶
type Layout ¶
func LayoutCreate ¶
centerPos would Player TileX, TileY
func (Layout) Contract ¶
Contract will reduce the Panel dimension with give value e.g. Contract('screen', 118, 40)
func (Layout) CreatePanel ¶
func (Layout) DebugRender ¶
DebugRender just for debug
func (*Layout) SplitHorz ¶
e.g. SplitHorz('screen', "top", "bottom", 0.12, 2) // X = from 0 to 1 X represents top height percent
type ProgressBar ¶
type ProgressBar struct { Background *pixel.Sprite Foreground *pixel.Sprite Value, Maximum, HalfWidth, Width float64 // contains filtered or unexported fields }
func ProgressBarCreate ¶
func ProgressBarCreate(x, y float64, value, max float64, background, foreground string) ProgressBar
func (ProgressBar) Enter ¶
func (pb ProgressBar) Enter()
func (ProgressBar) Exit ¶
func (pb ProgressBar) Exit()
func (ProgressBar) GetPosition ¶
func (pb ProgressBar) GetPosition() (x, y float64)
func (ProgressBar) HandleInput ¶
func (pb ProgressBar) HandleInput(win *pixelgl.Window)
TO MATCH StackInterface below
func (ProgressBar) Render ¶
func (pb ProgressBar) Render(renderer pixel.Target)
func (*ProgressBar) SetMax ¶
func (pb *ProgressBar) SetMax(maxHealth float64)
func (*ProgressBar) SetPosition ¶
func (pb *ProgressBar) SetPosition(x, y float64)
func (*ProgressBar) SetValue ¶
func (pb *ProgressBar) SetValue(health float64)
func (ProgressBar) Update ¶
func (pb ProgressBar) Update(dt float64) bool
type ProgressBarIMD ¶
type ProgressBarIMD struct { Background color.RGBA Foreground color.RGBA Value, Maximum, HalfWidth, Height, Width float64 // contains filtered or unexported fields }
func ProgressBarIMDCreate ¶
func (ProgressBarIMD) Enter ¶
func (pb ProgressBarIMD) Enter()
func (ProgressBarIMD) Exit ¶
func (pb ProgressBarIMD) Exit()
func (ProgressBarIMD) GetPercentWidth ¶
func (pb ProgressBarIMD) GetPercentWidth() float64
func (ProgressBarIMD) GetPosition ¶
func (pb ProgressBarIMD) GetPosition() (x, y float64)
func (ProgressBarIMD) HandleInput ¶
func (pb ProgressBarIMD) HandleInput(win *pixelgl.Window)
TO MATCH StackInterface below
func (ProgressBarIMD) Render ¶
func (pb ProgressBarIMD) Render(renderer pixel.Target)
func (*ProgressBarIMD) SetMax ¶
func (pb *ProgressBarIMD) SetMax(maxHealth float64)
func (*ProgressBarIMD) SetPosition ¶
func (pb *ProgressBarIMD) SetPosition(x, y float64)
func (*ProgressBarIMD) SetValue ¶
func (pb *ProgressBarIMD) SetValue(health float64)
func (ProgressBarIMD) Update ¶
func (pb ProgressBarIMD) Update(dt float64) bool
type SelectionMenu ¶
type SelectionMenu struct {
X, Y float64
Columns int //The number of columns the menu has. This defaults to 1
//focusX tells us which column is selected and focusY which element in that column
SpacingY, SpacingX float64 //space btw each items
Scale float64 //menu Scale in size
CursorWidth, CursorHeight float64
IsShowCursor bool
MaxRows int //rows might be 30 but only 5 maxRows are displayed at once
OnSelection func(int, interface{}) //to be called after selection
DataI []interface{}
RenderFunction func(a ...interface{})
// contains filtered or unexported fields
}
func SelectionMenuCreate ¶
func (SelectionMenu) CanScrollDown ¶
func (m SelectionMenu) CanScrollDown() bool
func (SelectionMenu) CanScrollUp ¶
func (m SelectionMenu) CanScrollUp() bool
func (SelectionMenu) GetHeight ¶
func (m SelectionMenu) GetHeight() float64
func (SelectionMenu) GetIndex ¶
func (m SelectionMenu) GetIndex() int
func (*SelectionMenu) GetWidth ¶
func (m *SelectionMenu) GetWidth() float64
func (*SelectionMenu) HandleInput ¶
func (m *SelectionMenu) HandleInput(window *pixelgl.Window)
func (*SelectionMenu) HideCursor ¶
func (m *SelectionMenu) HideCursor()
func (SelectionMenu) IsDataSourceEmpty ¶
func (m SelectionMenu) IsDataSourceEmpty() bool
func (*SelectionMenu) MoveDisplayDown ¶
func (m *SelectionMenu) MoveDisplayDown()
func (*SelectionMenu) MoveDisplayUp ¶
func (m *SelectionMenu) MoveDisplayUp()
func (*SelectionMenu) MoveDown ¶
func (m *SelectionMenu) MoveDown()
func (*SelectionMenu) MoveLeft ¶
func (m *SelectionMenu) MoveLeft()
func (*SelectionMenu) MoveRight ¶
func (m *SelectionMenu) MoveRight()
func (*SelectionMenu) MoveUp ¶
func (m *SelectionMenu) MoveUp()
func (*SelectionMenu) OffsetCursorPosition ¶
func (m *SelectionMenu) OffsetCursorPosition(x, y float64)
func (SelectionMenu) OnClick ¶
func (m SelectionMenu) OnClick()
func (SelectionMenu) Render ¶
func (m SelectionMenu) Render(renderer *pixelgl.Window)
func (SelectionMenu) SelectedItem ¶
func (m SelectionMenu) SelectedItem() interface{}
func (*SelectionMenu) SetColumns ¶
func (m *SelectionMenu) SetColumns(columns, maxRows int)
func (*SelectionMenu) SetPosition ¶
func (m *SelectionMenu) SetPosition(x, y float64)
func (*SelectionMenu) ShowCursor ¶
func (m *SelectionMenu) ShowCursor()
type SimpleCaptionsScreen ¶
func SimpleCaptionsScreenCreate ¶
func SimpleCaptionsScreenCreate(captions []CaptionStyle, position pixel.Vec) SimpleCaptionsScreen
func (SimpleCaptionsScreen) Render ¶
func (s SimpleCaptionsScreen) Render(win *pixelgl.Window)
type StackInterface ¶
type StateStack ¶
type StateStack struct { States []StackInterface Win *pixelgl.Window Globals map[string]interface{} DeltaTime float64 }
A state stack is, simply, a stack of states. Every time you add a new state it goes on top of the stack and is rendered last. aka Last in First out
func StateStackCreate ¶
func StateStackCreate(win *pixelgl.Window) *StateStack
func (*StateStack) Clear ¶
func (ss *StateStack) Clear()
func (StateStack) GetLastIndex ¶
func (ss StateStack) GetLastIndex() int
func (*StateStack) Pop ¶
func (ss *StateStack) Pop() StackInterface
func (*StateStack) Push ¶
func (ss *StateStack) Push(state StackInterface)
func (*StateStack) PushFITMenu ¶
func (ss *StateStack) PushFITMenu(x, y float64, txt string, choices []string, onSelection func(int, interface{}))
PushFITMenu PENDING not getting correct height and width
func (*StateStack) PushFitted ¶
func (ss *StateStack) PushFitted(x, y float64, txt string) *Textbox
func (*StateStack) PushFixed ¶
func (ss *StateStack) PushFixed(x, y, width, height float64, txt, avatarName string, avatarPng pixel.Picture)
func (*StateStack) PushSelectionMenu ¶
func (*StateStack) RemoveStateAtIndex ¶
func (ss *StateStack) RemoveStateAtIndex(i int)
func (StateStack) Render ¶
func (ss StateStack) Render(renderer *pixelgl.Window)
Render only last item in array unless the last item gets Pop() next would show.
func (StateStack) Top ¶
func (ss StateStack) Top() *StackInterface
func (*StateStack) Update ¶
func (ss *StateStack) Update(dt float64)
type Textbox ¶
type Textbox struct { Stack *StateStack Position pixel.Vec Panel Panel Width, Height float64 AppearTween animation.Tween // contains filtered or unexported fields }
func TextboxCreateFitted ¶
TextboxCreateFitted are good for small chats height and width gets set automatically
func TextboxCreateFixed ¶
func TextboxFITMenuCreate ¶
func TextboxFITPassedMenuCreate ¶
func TextboxFITPassedMenuCreate(stack *StateStack, x, y float64, textBoxText string, menu *SelectionMenu) *Textbox
func TextboxNew ¶
func TextboxWithMenuCreate ¶
func (*Textbox) HandleInput ¶
HandleInput takes care of 3 types of textbox's 1 textbox with menu 2 Fixed then we let the blocks render 3 Fitted users marks as read and goes to next text popup
func (Textbox) HasReachedLimit ¶
type TitleScreen ¶
type TitleScreen struct { Stack *StateStack // contains filtered or unexported fields }
func TitleScreenCreate ¶
func TitleScreenCreate(stack *StateStack, win *pixelgl.Window) *TitleScreen
func (TitleScreen) Exit ¶
func (s TitleScreen) Exit()
func (TitleScreen) HandleInput ¶
func (s TitleScreen) HandleInput(win *pixelgl.Window)
func (TitleScreen) Render ¶
func (s TitleScreen) Render(win *pixelgl.Window)
func (TitleScreen) Update ¶
func (s TitleScreen) Update(dt float64) bool
type XPPopUp ¶
type XPPopUp struct {
X, Y float64
Text string
TextColor color.RGBA
Tween animation.Tween
FadeTime,
DisplayTime float64
Pane Panel
// contains filtered or unexported fields
}