wasmclient

package
v0.0.0-...-7f6afe6 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2021 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DemuxNoti2ObjFnMap = [...]func(me interface{}, hd w2d_packet.Header, body interface{}) error{
	w2d_idnoti.Invalid:   objRecvNotiFn_Invalid,
	w2d_idnoti.StageInfo: objRecvNotiFn_StageInfo,
	w2d_idnoti.StatsInfo: objRecvNotiFn_StatsInfo,
	w2d_idnoti.StageChat: objRecvNotiFn_StageChat,
}

Functions

func CalcCurrentFrame

func CalcCurrentFrame(difftick int64, fps float64) int

func InitApp

func InitApp()

Types

type Sprite

type Sprite struct {
	ImgCanvas js.Value
	ImgCtx    js.Value
	// one sprite slice size
	W float64
	H float64
	// image count x, y
	XCount int
	YCount int
}

func LoadBallSprite

func LoadBallSprite(teamname string) [gameobjtype.GameObjType_Count]*Sprite

func LoadSpriteRotate

func LoadSpriteRotate(
	srcImageID string,
	start, end, step float64) *Sprite

LoadSpriteRotate load a image and make multi rotated image sptite

func LoadSpriteRotateResize

func LoadSpriteRotateResize(
	srcImageID string,
	start, end, step float64,
	xSliceW, ySliceH float64,
) *Sprite

func LoadSpriteXYN

func LoadSpriteXYN(
	srcImageID string,
	xn, yn int) *Sprite

LoadSpriteXYN load multi image sprite

func LoadSpriteXYNResize

func LoadSpriteXYNResize(
	srcImageID string,
	xn, yn int,
	xSliceW, ySliceH float64,
) *Sprite

func (*Sprite) CalcAlignDstCenter

func (sp *Sprite) CalcAlignDstCenter(dstx, dsty float64) (float64, float64)

func (*Sprite) CalcAlignDstTopLeft

func (sp *Sprite) CalcAlignDstTopLeft(dstx, dsty float64) (float64, float64)

func (*Sprite) Filter

func (sp *Sprite) Filter(index int, value int)

func (*Sprite) GetSliceCount

func (sp *Sprite) GetSliceCount() int

func (*Sprite) GetSliceXY

func (sp *Sprite) GetSliceXY(n int) (float64, float64)

GetSliceXY return nth slice pos

type Sprites

type Sprites struct {
	BallSprites  [teamtype.TeamType_Count][gameobjtype.GameObjType_Count]*Sprite
	EffectSprite [effecttype.EffectType_Count]*Sprite
	CloudSprite  *Sprite
	BGSprite     *Sprite
}

func LoadSprites

func LoadSprites() *Sprites

type Viewport

type Viewport struct {
	Canvas js.Value

	W float64
	H float64
	// contains filtered or unexported fields
}

func NewViewport

func NewViewport() *Viewport

func (*Viewport) AddEventListener

func (vp *Viewport) AddEventListener(evt string, fn func(this js.Value, args []js.Value) interface{})

func (*Viewport) DrawTitle

func (vp *Viewport) DrawTitle()

func (*Viewport) Focus

func (vp *Viewport) Focus()

func (*Viewport) Resized

func (vp *Viewport) Resized()

type WasmClient

type WasmClient struct {
	DoClose func()

	ServerJitter         *actjitter.ActJitter
	ClientJitter         *actjitter.ActJitter
	PingDur              int64
	ServerClientTictDiff int64

	DispInterDur *intervalduration.IntervalDuration

	KeyboardPressedMap *jskeypressmap.KeyPressMap
	// contains filtered or unexported fields
}

func (*WasmClient) CanUseCmd

func (app *WasmClient) CanUseCmd(cmd w2d_idcmd.CommandID) bool

func (*WasmClient) Cleanup

func (app *WasmClient) Cleanup()

func (*WasmClient) DisplayTextInfo

func (app *WasmClient) DisplayTextInfo()

func (*WasmClient) GetEstServerTick

func (app *WasmClient) GetEstServerTick() int64

func (*WasmClient) NetInit

func (app *WasmClient) NetInit(ctx context.Context) (*w2d_obj.RspLogin_data, error)

func (*WasmClient) ReqWithRspFn

func (app *WasmClient) ReqWithRspFn(cmd w2d_idcmd.CommandID, body interface{},
	fn w2d_pid2rspfn.HandleRspFn) error

func (*WasmClient) ReqWithRspFnWithAuth

func (app *WasmClient) ReqWithRspFnWithAuth(cmd w2d_idcmd.CommandID, body interface{},
	fn w2d_pid2rspfn.HandleRspFn) error

func (*WasmClient) ResizeCanvas

func (app *WasmClient) ResizeCanvas()

Jump to

Keyboard shortcuts

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