Documentation ¶
Index ¶
- type CameraFollowOptions
- type CameraFollowPosition
- type RGBA
- type SpriteSheet
- type Vector2
- func (vector2 Vector2) Add(x, y float64) Vector2
- func (vector2 *Vector2) AddSet(x, y float64) *Vector2
- func (vector2 Vector2) DeltaAdd(x, y, dt float64) Vector2
- func (vector2 *Vector2) DeltaAddSet(x, y, dt float64) *Vector2
- func (vector2 Vector2) DeltaDiv(x, y, dt float64) Vector2
- func (vector2 *Vector2) DeltaDivSet(x, y, dt float64) *Vector2
- func (vector2 Vector2) DeltaMul(x, y, dt float64) Vector2
- func (vector2 *Vector2) DeltaMulSet(x, y, dt float64) *Vector2
- func (vector2 Vector2) DeltaSub(x, y, dt float64) Vector2
- func (vector2 *Vector2) DeltaSubSet(x, y, dt float64) *Vector2
- func (vector2 *Vector2) DivSet(x, y float64) *Vector2
- func (vector2 *Vector2) Get() Vector2
- func (vector2 *Vector2) GetX() float64
- func (vector2 *Vector2) GetY() float64
- func (vector2 Vector2) Mul(x, y float64) Vector2
- func (vector2 *Vector2) MulSet(x, y float64) *Vector2
- func (vector2 *Vector2) Set(x, y float64)
- func (vector2 Vector2) Sub(x, y float64) Vector2
- func (vector2 *Vector2) SubSet(x, y float64) *Vector2
- type WarcApp
- func (warc *WarcApp) CameraPosition() *Vector2
- func (warc *WarcApp) DrawImage(image WarcImage, position Vector2) error
- func (warc *WarcApp) GetDeltaTime() float64
- func (warc *WarcApp) Init()
- func (warc *WarcApp) IsKeyJustPressed(key WarcKey) bool
- func (warc *WarcApp) IsKeyPressed(key WarcKey) bool
- func (warc *WarcApp) LoadImage(filePath string) (WarcImage, error)
- func (warc *WarcApp) Quit()
- func (warc *WarcApp) SetCameraFollow(position, size Vector2, op *CameraFollowOptions)
- func (warc *WarcApp) SetDraw(draw func(warc *WarcApp))
- func (warc *WarcApp) SetStart(start func(*WarcApp))
- func (warc *WarcApp) SetUpdate(update func(*WarcApp))
- func (warc *WarcApp) StartLoop()
- func (warc *WarcApp) StopLoop()
- type WarcImage
- type WarcKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CameraFollowOptions ¶
type CameraFollowOptions struct {
// contains filtered or unexported fields
}
The user-defineed data for what the cacmera should follow
func MakeCameraFollowOptions ¶
func MakeCameraFollowOptions() *CameraFollowOptions
func (*CameraFollowOptions) SetFollow ¶
func (op *CameraFollowOptions) SetFollow(follow CameraFollowPosition)
func (*CameraFollowOptions) SetMargin ¶
func (op *CameraFollowOptions) SetMargin(margin Vector2)
type CameraFollowPosition ¶
type CameraFollowPosition float64 // The relative position of the camera when it's set to follow
const ( FollowTopLeft CameraFollowPosition = iota FollowTopRight FollowBottomLeft FollowBottomRight FollowCenter // Used when app.SetCameraFollow(position, size Vector 2, op *CamerFollowOptions) // is called with `op` set to `nil` FollowDefault = FollowCenter )
The possible values for a CameraFollowPosition
type RGBA ¶
type RGBA struct {
// contains filtered or unexported fields
}
A structure containing an RGBA color value
type SpriteSheet ¶
type SpriteSheet struct {
// contains filtered or unexported fields
}
func MakeSpriteSheet ¶
func MakeSpriteSheet( spriteSize, spriteMargin Vector2, spriteSheet WarcImage, ) SpriteSheet
func (*SpriteSheet) GetIndex ¶
func (sheet *SpriteSheet) GetIndex(index Vector2) (*WarcImage, error)
func (*SpriteSheet) SpriteMargin ¶
func (sheet *SpriteSheet) SpriteMargin() *Vector2
func (*SpriteSheet) SpriteSheet ¶
func (sheet *SpriteSheet) SpriteSheet() *WarcImage
func (*SpriteSheet) SpriteSize ¶
func (sheet *SpriteSheet) SpriteSize() *Vector2
type Vector2 ¶
type Vector2 struct {
X, Y float64
}
Vector2 is typically used for storing coordinates and other 2d values
func MakeVector2 ¶
func MakeVector2() Vector2
Initilize a new Vector2 (technically this is not neccessary, but it adds some cleanliness to code)
func (*Vector2) DeltaAddSet ¶
Add (x, y) to the current Vector2
func (*Vector2) DeltaDivSet ¶
Divide the current Vector2 by (x, y)
func (*Vector2) DeltaMulSet ¶
Multiply the current Vector2 by (x, y)
func (*Vector2) DeltaSubSet ¶
Sub (x, y) to the current Vector2
type WarcApp ¶
type WarcApp struct {
// contains filtered or unexported fields
}
All the data needed to run a `WarcApp`
func (*WarcApp) CameraPosition ¶
func (*WarcApp) GetDeltaTime ¶
Get the delta time of `warcSDL`
func (*WarcApp) IsKeyJustPressed ¶
func (*WarcApp) IsKeyPressed ¶
func (*WarcApp) SetCameraFollow ¶
func (warc *WarcApp) SetCameraFollow(position, size Vector2, op *CameraFollowOptions)
Set the `CameraFollowOptions` for the camera
type WarcImage ¶
type WarcImage struct {
// contains filtered or unexported fields
}
Data needed to render an image
type WarcKey ¶
type WarcKey uint32
const ( Key0 WarcKey = sdl.K_0 Key1 WarcKey = sdl.K_1 Key2 WarcKey = sdl.K_2 Key3 WarcKey = sdl.K_3 Key4 WarcKey = sdl.K_4 Key5 WarcKey = sdl.K_5 Key6 WarcKey = sdl.K_6 Key7 WarcKey = sdl.K_7 Key8 WarcKey = sdl.K_8 Key9 WarcKey = sdl.K_9 KeyA WarcKey = sdl.K_a KeyB WarcKey = sdl.K_b KeyC WarcKey = sdl.K_c KeyD WarcKey = sdl.K_d KeyE WarcKey = sdl.K_e KeyF WarcKey = sdl.K_f KeyG WarcKey = sdl.K_g KeyH WarcKey = sdl.K_h KeyI WarcKey = sdl.K_i KeyJ WarcKey = sdl.K_j KeyK WarcKey = sdl.K_k KeyL WarcKey = sdl.K_l KeyM WarcKey = sdl.K_m KeyN WarcKey = sdl.K_n KeyO WarcKey = sdl.K_o KeyP WarcKey = sdl.K_p KeyQ WarcKey = sdl.K_q KeyR WarcKey = sdl.K_r KeyS WarcKey = sdl.K_s KeyT WarcKey = sdl.K_t KeyU WarcKey = sdl.K_u KeyV WarcKey = sdl.K_v KeyW WarcKey = sdl.K_w KeyX WarcKey = sdl.K_x KeyY WarcKey = sdl.K_y KeyZ WarcKey = sdl.K_z KeyUp WarcKey = sdl.K_UP KeyDown WarcKey = sdl.K_DOWN KeyLeft WarcKey = sdl.K_LEFT KeyRight WarcKey = sdl.K_RIGHT KeyLShift WarcKey = sdl.K_LSHIFT KeyRShift WarcKey = sdl.K_RSHIFT KeyRCtrl WarcKey = sdl.K_RCTRL KeyLCtrl WarcKey = sdl.K_LCTRL KeyRAlt WarcKey = sdl.K_RALT KeyLAlt WarcKey = sdl.K_LALT KeySpace WarcKey = sdl.K_SPACE )
Click to show internal directories.
Click to hide internal directories.