Documentation ¶
Index ¶
- type ActionDispatcher
- func (ac *ActionDispatcher) CameraZoom(d int)
- func (ac *ActionDispatcher) CloseTowerMenu()
- func (ac *ActionDispatcher) CursorMove(x, y int)
- func (ac *ActionDispatcher) DeselectTower(t string)
- func (ac *ActionDispatcher) Dispatch(a *action.Action)
- func (ac *ActionDispatcher) GoHome()
- func (ac *ActionDispatcher) IncomeTick()
- func (ac *ActionDispatcher) OpenTowerMenu(tid string)
- func (ac *ActionDispatcher) PlaceTower(t, pid string, x, y int)
- func (ac *ActionDispatcher) RemovePlayer(pid string)
- func (ac *ActionDispatcher) RemoveTower(pid, tid string)
- func (ac *ActionDispatcher) SelectTower(t string, x, y int)
- func (ac *ActionDispatcher) SelectedTowerInvalid(i bool)
- func (ac *ActionDispatcher) SummonUnit(unit, pid string, plid, clid int)
- func (ac *ActionDispatcher) TPS()
- func (ac *ActionDispatcher) ToggleStats()
- func (ac *ActionDispatcher) UpdateTower(pid, tid, tt string)
- func (ac *ActionDispatcher) UpdateUnit(pid, ut string)
- type CameraState
- type CameraStore
- type Game
- type HUDState
- type HUDStore
- type ImagesCache
- type Lines
- func (ls *Lines) Draw(screen *ebiten.Image)
- func (ls *Lines) DrawTower(screen *ebiten.Image, c *CameraStore, t *store.Tower)
- func (ls *Lines) DrawTowerHelath(screen *ebiten.Image, c *CameraStore, t *store.Tower)
- func (ls *Lines) DrawUnit(screen *ebiten.Image, c *CameraStore, u *store.Unit)
- func (ls *Lines) Update() error
- type Map
- type SelectedTower
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionDispatcher ¶
type ActionDispatcher struct {
// contains filtered or unexported fields
}
ActionDispatcher is in charge of dispatching actions to the application dispatcher
func NewActionDispatcher ¶
func NewActionDispatcher(d *flux.Dispatcher, s *store.Store, wsSendFn func(a *action.Action), l *slog.Logger) *ActionDispatcher
NewActionDispatcher initializes the action dispatcher with the give dispatcher
func (*ActionDispatcher) CameraZoom ¶
func (ac *ActionDispatcher) CameraZoom(d int)
CameraZoom zooms the camera the direction 'd'
func (*ActionDispatcher) CloseTowerMenu ¶
func (ac *ActionDispatcher) CloseTowerMenu()
CloseTowerMenu when a tower menu needs to be closed
func (*ActionDispatcher) CursorMove ¶
func (ac *ActionDispatcher) CursorMove(x, y int)
CursorMove dispatches an action of moving the Cursor to the new x,y coordinates
func (*ActionDispatcher) DeselectTower ¶
func (ac *ActionDispatcher) DeselectTower(t string)
DeselectTower cleans the current selected tower
func (*ActionDispatcher) Dispatch ¶
func (ac *ActionDispatcher) Dispatch(a *action.Action)
Dispatch is a helper to access to the internal dispatch directly with an action. This should only be used from the WS Handler to forward server actions directly
func (*ActionDispatcher) GoHome ¶
func (ac *ActionDispatcher) GoHome()
GoHome will move the camera to the current player home line
func (*ActionDispatcher) IncomeTick ¶
func (ac *ActionDispatcher) IncomeTick()
IncomeTick a new tick for the income
func (*ActionDispatcher) OpenTowerMenu ¶
func (ac *ActionDispatcher) OpenTowerMenu(tid string)
OpenTowerMenu when a tower is clicked and the menu of the tower is displayed
func (*ActionDispatcher) PlaceTower ¶
func (ac *ActionDispatcher) PlaceTower(t, pid string, x, y int)
PlaceTower places the tower 't' on the position X and Y of the player pid
func (*ActionDispatcher) RemovePlayer ¶
func (ac *ActionDispatcher) RemovePlayer(pid string)
func (*ActionDispatcher) RemoveTower ¶
func (ac *ActionDispatcher) RemoveTower(pid, tid string)
RemoveTower removes the tower tid
func (*ActionDispatcher) SelectTower ¶
func (ac *ActionDispatcher) SelectTower(t string, x, y int)
SelectTower selects the tower 't' on the position x, y
func (*ActionDispatcher) SelectedTowerInvalid ¶
func (ac *ActionDispatcher) SelectedTowerInvalid(i bool)
SelectTower selects the tower 't' on the position x, y
func (*ActionDispatcher) SummonUnit ¶
func (ac *ActionDispatcher) SummonUnit(unit, pid string, plid, clid int)
SummonUnit summons the 'unit' from the player id 'pid' to the line 'plid' and with the current line id 'clid'
func (*ActionDispatcher) TPS ¶
func (ac *ActionDispatcher) TPS()
TPS is the call for every TPS event
func (*ActionDispatcher) ToggleStats ¶
func (ac *ActionDispatcher) ToggleStats()
func (*ActionDispatcher) UpdateTower ¶ added in v1.1.0
func (ac *ActionDispatcher) UpdateTower(pid, tid, tt string)
GoHome will move the camera to the current player home line
func (*ActionDispatcher) UpdateUnit ¶ added in v1.1.0
func (ac *ActionDispatcher) UpdateUnit(pid, ut string)
type CameraState ¶
CameraState is the store data on the Camera
type CameraStore ¶
type CameraStore struct { *flux.ReduceStore Store *store.Store // contains filtered or unexported fields }
CameraStore is in charge of what it's seen on the screen, it also tracks the position of the cursor and the wheel scroll
func NewCameraStore ¶
NewCameraStore creates a new CameraState linked to the Dispatcher d with the Game g and with width w and height h which is the size of the viewport
func (*CameraStore) Draw ¶
func (cs *CameraStore) Draw(screen *ebiten.Image)
func (*CameraStore) Reduce ¶
func (cs *CameraStore) Reduce(state, a interface{}) interface{}
func (*CameraStore) Update ¶
func (cs *CameraStore) Update() error
type Game ¶
type HUDState ¶
type HUDState struct { SelectedTower *SelectedTower OpenTowerMenu *store.Tower LastCursorPosition utils.Object ShowStats bool }
HUDState stores the HUD state
type HUDStore ¶
type HUDStore struct { *flux.ReduceStore // contains filtered or unexported fields }
HUDStore is in charge of keeping track of all the elements on the player HUD that are static and always seen
func NewHUDStore ¶
NewHUDStore creates a new HUDStore with the Dispatcher d and the Game g
type ImagesCache ¶
type ImagesCache struct {
// contains filtered or unexported fields
}
ImagesCache is a simple cache for all the images, so instead of running 'ebiten.NewImageFromImage' we just ran it once and reuse it all the time
func (*ImagesCache) Get ¶
func (i *ImagesCache) Get(key string) *ebiten.Image
Get will return the image from 'key', if it does not exists a 'nil' will be returned
type Lines ¶
type Lines struct {
// contains filtered or unexported fields
}
func (*Lines) DrawTower ¶
func (ls *Lines) DrawTower(screen *ebiten.Image, c *CameraStore, t *store.Tower)
func (*Lines) DrawTowerHelath ¶ added in v1.2.0
func (ls *Lines) DrawTowerHelath(screen *ebiten.Image, c *CameraStore, t *store.Tower)