appwindow

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: BSD-2-Clause Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TabBriefing = iota
	TabUnits
	TabOrders
	TabActions
	TabMap
	TabFormation
	TabAdvance
	TabWithdraw
	TabSurrender
)

Enum for the Tabs in the main window

Variables

This section is empty.

Functions

func Show

func Show(app fyne.App, servername string, l *rp.LoginResponse, conn *grpc.ClientConn, gameServer rp.GameServiceClient, store *store.Store)

Show creates the application UI

Types

type ActionsPanel

type ActionsPanel struct {
	Box *fyne.Container

	Scroll *widget.ScrollContainer

	Header  *widget.Label
	Actions []*actionWidget
	// contains filtered or unexported fields
}

ActionsPanel controls the actions

func (*ActionsPanel) CanvasObject

func (a *ActionsPanel) CanvasObject() fyne.CanvasObject

CanvasObject gets the top level canvas object

type AdvancePanel

type AdvancePanel struct {
	Box *fyne.Container

	Header *widget.Label
	Notes  *widget.Label
	// contains filtered or unexported fields
}

AdvancePanel is the UI for ordering a general advance

func (*AdvancePanel) CanvasObject

func (a *AdvancePanel) CanvasObject() fyne.CanvasObject

CanvasObject returns the top level UI element for the AdvancePanel

type App

type App struct {
	// game state
	ServerName string
	GameName   string
	GameTime   time.Time
	Briefing   string
	Commanders []string
	Commands   []*rp.Command
	Enemy      []*rp.Command
	TeamName   string
	Token      rp.TokenMessage
	Expires    time.Time
	Phase      string
	MapData    *rp.MapData
	// contains filtered or unexported fields
}

App is the top level object to contain the application data

func (*App) GetMap

func (a *App) GetMap() error

GetMap fetches the map from the server

func (*App) GetUnitCommander

func (a *App) GetUnitCommander(unitID int32) *rp.Command

GetUnitCommander gets the commander for the given unit

func (*App) GetUnits

func (a *App) GetUnits() error

GetUnits fetches the units from the server

func (*App) MinSize

func (a *App) MinSize() fyne.Size

MinSize returns the minimum size for the panel objects - helper function for panels to get a consistent sizing hint

func (*App) Phaser

func (a *App) Phaser()

Phaser is a goroutine that loops on a 3 second timer to fetch the game time

func (*App) PlayAudio

func (a *App) PlayAudio(tune string)

PlayAudio plays a tune given the filename of a custom mp3 file

func (*App) PlaySystemAudio

func (a *App) PlaySystemAudio(name string)

PlaySystemAudio plays one of the system tunes

func (*App) Tab

func (a *App) Tab(tab int)

Tab changes the tab on the main screen

func (*App) ToggleTheme

func (a *App) ToggleTheme()

ToggleTheme changes the theme between darkMode and lightMode and back again

type BriefingPanel

type BriefingPanel struct {
	Box    *widget.Box
	Scroll *widget.ScrollContainer

	Header *widget.Label
	Notes  *widget.Label
	// contains filtered or unexported fields
}

BriefingPanel in the UI for the briefing

func (*BriefingPanel) CanvasObject

func (b *BriefingPanel) CanvasObject() fyne.CanvasObject

CanvasObject returns the top level UI element

type FooterBar

type FooterBar struct {
	Box *widget.Box

	Done       bool
	PhaseLabel *widget.Label
	DoneBtn    *widget.Button
	StopWatch  *widget.Label
	// contains filtered or unexported fields
}

FooterBar is the UI for the footer

func (*FooterBar) CanvasObject

func (f *FooterBar) CanvasObject() fyne.CanvasObject

CanvasObject returns the top level UI element in the footer

func (*FooterBar) NotDone

func (f *FooterBar) NotDone()

NotDone sets the done flag back to not done. Use this whenever the player does an action that un-does the fact that they are finished with the turn

func (*FooterBar) ToggleDone

func (f *FooterBar) ToggleDone()

ToggleDone toggles the Done flag to signal that the player is ready for the next phase

type FormationsPanel

type FormationsPanel struct {
	Box    *widget.Box
	Scroll *widget.ScrollContainer
	// contains filtered or unexported fields
}

FormationsPanel is the UI for the formations

func (*FormationsPanel) CanvasObject

func (f *FormationsPanel) CanvasObject() fyne.CanvasObject

CanvasObject returns the top level UI element for the formations panel

type HeaderBar

type HeaderBar struct {
	Box *widget.Box

	TeamName *widget.Label
	GameName *widget.Label
	GameTime *widget.Label
	Toolbar  *widget.Toolbar
	// contains filtered or unexported fields
}

HeaderBar is the UI for the header

func (*HeaderBar) CanvasObject

func (h *HeaderBar) CanvasObject() fyne.CanvasObject

CanvasObject returns the top level UI element for the header

func (*HeaderBar) Recalc

func (h *HeaderBar) Recalc() *HeaderBar

Recalc refreshes the content for the header (game time)

type MapPanel

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

MapPanel is the UI for the map

func (*MapPanel) CanvasObject

func (m *MapPanel) CanvasObject() fyne.CanvasObject

CanvasObject returns the top level UI element for the map

func (*MapPanel) SetCommand

func (m *MapPanel) SetCommand(cmd *rp.Command)

SetCommand sets the currently selected command on the map

func (*MapPanel) Tap

func (m *MapPanel) Tap(x, y int32)

Tap tells the map controller that a tap occurred at a spot

type MapWidget

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

MapWidget is a complete map viewer widget ... or will be when it grows up

func (*MapWidget) ApplyTheme

func (mw *MapWidget) ApplyTheme()

ApplyTheme applies the theme to the mapWidget

func (*MapWidget) CommandsUpdated

func (mw *MapWidget) CommandsUpdated(data fyne.DataMap)

CommandsUpdated is a dataAPI listener for the map

func (*MapWidget) CreateRenderer

func (mw *MapWidget) CreateRenderer() fyne.WidgetRenderer

CreateRenderer builds a new renderer

func (*MapWidget) Hide

func (mw *MapWidget) Hide()

Hide sets the mapWidget to be not visible

func (*MapWidget) MinSize

func (mw *MapWidget) MinSize() fyne.Size

MinSize returns the minSize of the mapWitdget

func (*MapWidget) Move

func (mw *MapWidget) Move(pos fyne.Position)

Move orders the mapWidget to be moved

func (*MapWidget) Position

func (mw *MapWidget) Position() fyne.Position

Position returns the current position of the mapWidget

func (*MapWidget) Resize

func (mw *MapWidget) Resize(size fyne.Size)

Resize resizes the mapWidget

func (*MapWidget) Select

func (mw *MapWidget) Select(id int32) (*rp.Command, bool)

Select selects the command with the given ID

func (*MapWidget) SetCommands

func (mw *MapWidget) SetCommands()

SetCommands rebuilds a new set of gridCommands for this map

func (*MapWidget) Show

func (mw *MapWidget) Show()

Show sets the mapWidget to be visible

func (*MapWidget) Size

func (mw *MapWidget) Size() fyne.Size

Size returns the current size of the mapWidget

func (*MapWidget) Tapped

func (mw *MapWidget) Tapped(event *fyne.PointEvent)

Tapped is called when the user taps the map widget

func (*MapWidget) TappedSecondary

func (mw *MapWidget) TappedSecondary(event *fyne.PointEvent)

TappedSecondary is called when the user right-taps the map widget

func (*MapWidget) Visible

func (mw *MapWidget) Visible() bool

Visible returns whether the mapWidget is visible or not

type OrdersPanel

type OrdersPanel struct {
	Box *fyne.Container

	Scroll *widget.ScrollContainer
	// contains filtered or unexported fields
}

OrdersPanel is the UI for placing commander orders

func (*OrdersPanel) CanvasObject

func (o *OrdersPanel) CanvasObject() fyne.CanvasObject

CanvasObject returns the top level UI element for the orders

type PlotWidget

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

PlotWidget plots a set of data

func (*PlotWidget) AddSet

func (p *PlotWidget) AddSet(data timedata)

AddSet adds a set of data to the plot

func (*PlotWidget) ApplyTheme

func (p *PlotWidget) ApplyTheme()

ApplyTheme applies the theme to the plotWidget

func (*PlotWidget) Clear

func (p *PlotWidget) Clear()

Clear removes all plot data

func (*PlotWidget) CreateRenderer

func (p *PlotWidget) CreateRenderer() fyne.WidgetRenderer

CreateRenderer builds a new renderer

func (*PlotWidget) Hide

func (p *PlotWidget) Hide()

Hide sets the plotWidget to be not visible

func (*PlotWidget) MinSize

func (p *PlotWidget) MinSize() fyne.Size

MinSize returns the minSize of the plotWidget

func (*PlotWidget) Move

func (p *PlotWidget) Move(pos fyne.Position)

Move orders the plotWidget to be moved

func (*PlotWidget) Position

func (p *PlotWidget) Position() fyne.Position

Position returns the current position of the plotWidget

func (*PlotWidget) Resize

func (p *PlotWidget) Resize(size fyne.Size)

Resize resizes the plotWidget

func (*PlotWidget) Show

func (p *PlotWidget) Show()

Show sets the plotWidget to be visible

func (*PlotWidget) Size

func (p *PlotWidget) Size() fyne.Size

Size returns the current size of the plotWidget

func (*PlotWidget) Visible

func (p *PlotWidget) Visible() bool

Visible returns whether the plotWidget is visible or not

type SurrenderPanel

type SurrenderPanel struct {
	Box *fyne.Container

	Header *widget.Label
	Notes  *widget.Label
	// contains filtered or unexported fields
}

SurrenderPanel is the UI for editting surrender terms

func (*SurrenderPanel) CanvasObject

func (s *SurrenderPanel) CanvasObject() fyne.CanvasObject

CanvasObject returns the top level UI element for the SurrenderPanel

type TapIcon

type TapIcon struct {
	widget.Box

	OnTapped    func()
	OnSecondary func()
	// contains filtered or unexported fields
}

TapIcon is an Icon that implements Tappable interface

func NewTapIcon

func NewTapIcon(res fyne.Resource, tapped func(), secondary func()) *TapIcon

NewTapIcon is a wrapper function to create a new tappable icon

func (*TapIcon) CreateRenderer

func (l *TapIcon) CreateRenderer() fyne.WidgetRenderer

CreateRenderer creates a renderer for the TapIcon

func (*TapIcon) Disable

func (l *TapIcon) Disable()

Disable makes it disabled

func (*TapIcon) Enable

func (l *TapIcon) Enable()

Enable makes it enabled

func (*TapIcon) Tapped

func (l *TapIcon) Tapped(*fyne.PointEvent)

Tapped handler for each TapIcon

func (*TapIcon) TappedSecondary

func (l *TapIcon) TappedSecondary(*fyne.PointEvent)

TappedSecondary handler for each TapIcon

type TapLabel

type TapLabel struct {
	widget.Label
	OnTapped    func()
	OnSecondary func()
}

TapLabel is a label that implements Tappable interface

func NewTapLabel

func NewTapLabel(text string, alignment fyne.TextAlign, style fyne.TextStyle, tapped func(), secondary func()) *TapLabel

NewTapLabel is a wrapper function to create a new tappable Label

func (*TapLabel) CreateRenderer

func (l *TapLabel) CreateRenderer() fyne.WidgetRenderer

CreateRenderer creates a renderer for the TapLabel

func (*TapLabel) Tapped

func (l *TapLabel) Tapped(*fyne.PointEvent)

Tapped handler for each tapLabel

func (*TapLabel) TappedSecondary

func (l *TapLabel) TappedSecondary(*fyne.PointEvent)

TappedSecondary handler for each tapLabel

type TapRect

type TapRect struct {
	widget.Box

	OnTapped    func()
	OnSecondary func()
	// contains filtered or unexported fields
}

TapRect is a Rect that implements Tappable interface

func NewTapRect

func NewTapRect(c color.Color, tapped func(), secondary func()) *TapRect

NewTapRect is a wrapper function to create a new tappable rectangle

func (*TapRect) CreateRenderer

func (l *TapRect) CreateRenderer() fyne.WidgetRenderer

CreateRenderer creates a renderer for the TapIcon

func (*TapRect) Tapped

func (l *TapRect) Tapped(*fyne.PointEvent)

Tapped handler for each TapIcon

func (*TapRect) TappedSecondary

func (l *TapRect) TappedSecondary(*fyne.PointEvent)

TappedSecondary handler for each TapIcon

type UnitCommand

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

UnitCommand holds the UI for veiwing units overview

func (*UnitCommand) CanvasObject

func (u *UnitCommand) CanvasObject() fyne.CanvasObject

CanvasObject returns the top level widget in the UnitsPanel

func (*UnitCommand) Populate

func (u *UnitCommand) Populate(command *rp.Command)

Populate refreshes the UnitCommand from the given command data

type UnitDetails

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

UnitDetails holds the UI for veiwing unit details

func (*UnitDetails) CanvasObject

func (u *UnitDetails) CanvasObject() fyne.CanvasObject

CanvasObject returns the top level widget in the UnitsPanel

func (*UnitDetails) Populate

func (u *UnitDetails) Populate(unit *rp.Unit)

Populate refreshes the UnitDetail fields from the given unit data

type UnitOverview

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

UnitOverview holds the UI for veiwing units overview

func (*UnitOverview) CanvasObject

func (u *UnitOverview) CanvasObject() fyne.CanvasObject

CanvasObject returns the top level widget in the UnitsPanel

type UnitsPanel

type UnitsPanel struct {
	Tabs     *widget.TabContainer
	Overview *UnitOverview
	Command  *UnitCommand
	Details  *UnitDetails
	// contains filtered or unexported fields
}

UnitsPanel holds the UI for veiwing units

func (*UnitsPanel) CanvasObject

func (u *UnitsPanel) CanvasObject() fyne.CanvasObject

CanvasObject returns the top level widget in the UnitsPanel

func (*UnitsPanel) ShowCommand

func (u *UnitsPanel) ShowCommand(command *rp.Command)

ShowCommand navigates to the commander details and populates the commander

func (*UnitsPanel) ShowUnit

func (u *UnitsPanel) ShowUnit(unit *rp.Unit)

ShowUnit navigates to the unit details and populates the unit

type WithdrawPanel

type WithdrawPanel struct {
	Box *fyne.Container

	Header *widget.Label
	Notes  *widget.Label
	// contains filtered or unexported fields
}

WithdrawPanel is the UI for ordering a general withdrawal

func (*WithdrawPanel) CanvasObject

func (w *WithdrawPanel) CanvasObject() fyne.CanvasObject

CanvasObject returns the top level UI for the WithdrawPanel

Jump to

Keyboard shortcuts

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