Documentation
¶
Index ¶
- func GetTime() time.Time
- type CameraController
- func (c *CameraController) GetPosition() (float64, float64)
- func (c *CameraController) GetSensitivity() float64
- func (c *CameraController) Initialize() error
- func (c *CameraController) IsEnabled() bool
- func (c *CameraController) SetPositionCallback(callback func(x, y float64))
- func (c *CameraController) SetSensitivity(sensitivity float64)
- func (c *CameraController) StartCalibration()
- type InputState
- type JSBridge
- func (b *JSBridge) Cleanup()
- func (b *JSBridge) ClearCanvas(color string)
- func (b *JSBridge) DrawCircle(x, y, radius float64, color string)
- func (b *JSBridge) DrawLine(x1, y1, x2, y2, lineWidth float64, color string)
- func (b *JSBridge) DrawRect(x, y, width, height float64, color string)
- func (b *JSBridge) DrawRectOutline(x, y, width, height, lineWidth float64, color string)
- func (b *JSBridge) DrawText(text string, x, y float64, font, color string)
- func (b *JSBridge) DrawTextCentered(text string, x, y float64, font, color string)
- func (b *JSBridge) GetCanvasSize() (int, int)
- func (b *JSBridge) GetContext() js.Value
- func (b *JSBridge) GetCurrentTime() float64
- func (b *JSBridge) GetDevicePixelRatio() float64
- func (b *JSBridge) GetElementByID(id string) js.Value
- func (b *JSBridge) GetFPS(deltaTime float64) float64
- func (b *JSBridge) GetInput() (left, right, fire, fireJustPressed, pauseJustPressed bool)
- func (b *JSBridge) GetInputState() InputState
- func (b *JSBridge) GetLocalStorage(key string) string
- func (b *JSBridge) Initialize(canvasID string) error
- func (b *JSBridge) IsKeyPressed(key string) bool
- func (b *JSBridge) Log(message string)
- func (b *JSBridge) LogError(message string)
- func (b *JSBridge) PlaySound(soundID string)
- func (b *JSBridge) SetCanvasSize(width, height int)
- func (b *JSBridge) SetElementHTML(elementID, html string)
- func (b *JSBridge) SetElementText(elementID, text string)
- func (b *JSBridge) SetLocalStorage(key, value string)
- func (b *JSBridge) SetTitle(title string)
- func (b *JSBridge) ShowAlert(message string)
- func (b *JSBridge) StartAnimationLoop(callback func(float64))
- func (b *JSBridge) UpdateInputState(state *InputState)
- type Renderer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CameraController ¶
type CameraController struct {
// contains filtered or unexported fields
}
CameraController handles camera input for head tracking
func NewCameraController ¶
func NewCameraController() *CameraController
NewCameraController creates a new camera controller
func (*CameraController) GetPosition ¶
func (c *CameraController) GetPosition() (float64, float64)
GetPosition returns the current head position
func (*CameraController) GetSensitivity ¶
func (c *CameraController) GetSensitivity() float64
GetSensitivity returns the current sensitivity
func (*CameraController) Initialize ¶
func (c *CameraController) Initialize() error
Initialize sets up the camera
func (*CameraController) IsEnabled ¶
func (c *CameraController) IsEnabled() bool
IsEnabled returns whether camera is enabled
func (*CameraController) SetPositionCallback ¶
func (c *CameraController) SetPositionCallback(callback func(x, y float64))
SetPositionCallback sets the callback for position updates
func (*CameraController) SetSensitivity ¶
func (c *CameraController) SetSensitivity(sensitivity float64)
SetSensitivity sets the camera sensitivity
func (*CameraController) StartCalibration ¶
func (c *CameraController) StartCalibration()
StartCalibration starts the calibration process
type InputState ¶
type InputState struct {
LeftPressed bool
RightPressed bool
UpPressed bool
DownPressed bool
FirePressed bool
FireJustPressed bool
PauseJustPressed bool
EnterJustPressed bool
}
InputState represents the current input state
type JSBridge ¶
type JSBridge struct {
// contains filtered or unexported fields
}
JSBridge handles JavaScript interop for WASM
func (*JSBridge) ClearCanvas ¶
ClearCanvas clears the entire canvas with the specified color
func (*JSBridge) DrawCircle ¶
DrawCircle draws a filled circle
func (*JSBridge) DrawRectOutline ¶
DrawRectOutline draws a rectangle outline
func (*JSBridge) DrawTextCentered ¶
DrawTextCentered draws centered text
func (*JSBridge) GetCanvasSize ¶
GetCanvasSize returns the canvas dimensions
func (*JSBridge) GetContext ¶
GetContext returns the canvas 2D context
func (*JSBridge) GetCurrentTime ¶
GetCurrentTime returns the current time in milliseconds
func (*JSBridge) GetDevicePixelRatio ¶
GetDevicePixelRatio returns the device pixel ratio
func (*JSBridge) GetElementByID ¶
GetElementByID gets an element by its ID
func (*JSBridge) GetInputState ¶
func (b *JSBridge) GetInputState() InputState
GetInputState returns the current input state
func (*JSBridge) GetLocalStorage ¶
GetLocalStorage gets a value from localStorage
func (*JSBridge) Initialize ¶
Initialize sets up the JavaScript bridge with canvas and event listeners
func (*JSBridge) IsKeyPressed ¶
IsKeyPressed checks if a specific key is currently pressed
func (*JSBridge) SetCanvasSize ¶
SetCanvasSize sets the canvas size explicitly
func (*JSBridge) SetElementHTML ¶
SetElementHTML sets the HTML content of an element
func (*JSBridge) SetElementText ¶
SetElementText sets the text content of an element
func (*JSBridge) SetLocalStorage ¶
SetLocalStorage sets a value in localStorage
func (*JSBridge) StartAnimationLoop ¶
StartAnimationLoop starts the animation loop using requestAnimationFrame
func (*JSBridge) UpdateInputState ¶
func (b *JSBridge) UpdateInputState(state *InputState)
UpdateInputState updates the input state with proper "just pressed" detection
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer handles all game rendering to the canvas
func NewRenderer ¶
NewRenderer creates a new renderer
func (*Renderer) RenderExplosion ¶
RenderExplosion renders an explosion effect
func (*Renderer) RenderGame ¶
RenderGame renders the entire game state
func (*Renderer) SetContext ¶
SetContext sets the rendering context