warc

package module
v0.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: MIT Imports: 3 Imported by: 0

README

warc

A game engine built in go (DO NOT USE)

Documentation

Index

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) Add

func (vector2 Vector2) Add(x, y float64) Vector2

Add (x, y) to the current Vector2

func (*Vector2) AddSet

func (vector2 *Vector2) AddSet(x, y float64) *Vector2

Add (x, y) to the current Vector2

func (Vector2) DeltaAdd

func (vector2 Vector2) DeltaAdd(x, y, dt float64) Vector2

Add (x, y) to the current Vector2

func (*Vector2) DeltaAddSet

func (vector2 *Vector2) DeltaAddSet(x, y, dt float64) *Vector2

Add (x, y) to the current Vector2

func (Vector2) DeltaDiv

func (vector2 Vector2) DeltaDiv(x, y, dt float64) Vector2

Divide the current Vector2 by (x, y)

func (*Vector2) DeltaDivSet

func (vector2 *Vector2) DeltaDivSet(x, y, dt float64) *Vector2

Divide the current Vector2 by (x, y)

func (Vector2) DeltaMul

func (vector2 Vector2) DeltaMul(x, y, dt float64) Vector2

Multiply the current Vector2 by (x, y)

func (*Vector2) DeltaMulSet

func (vector2 *Vector2) DeltaMulSet(x, y, dt float64) *Vector2

Multiply the current Vector2 by (x, y)

func (Vector2) DeltaSub

func (vector2 Vector2) DeltaSub(x, y, dt float64) Vector2

Sub (x, y) to the current Vector2

func (*Vector2) DeltaSubSet

func (vector2 *Vector2) DeltaSubSet(x, y, dt float64) *Vector2

Sub (x, y) to the current Vector2

func (*Vector2) DivSet

func (vector2 *Vector2) DivSet(x, y float64) *Vector2

Divide the current Vector2 by (x, y)

func (*Vector2) Get

func (vector2 *Vector2) Get() Vector2

Get the current Vector2 as immutable

func (*Vector2) GetX

func (vector2 *Vector2) GetX() float64

Get the current Vector2.x as immutable

func (*Vector2) GetY

func (vector2 *Vector2) GetY() float64

Get the current Vector2.y as immutable

func (Vector2) Mul

func (vector2 Vector2) Mul(x, y float64) Vector2

Multiply the current Vector2 by (x, y)

func (*Vector2) MulSet

func (vector2 *Vector2) MulSet(x, y float64) *Vector2

Multiply the current Vector2 by (x, y)

func (*Vector2) Set

func (vector2 *Vector2) Set(x, y float64)

Set the current Vector2 to another value

func (Vector2) Sub

func (vector2 Vector2) Sub(x, y float64) Vector2

Sub (x, y) to the current Vector2

func (*Vector2) SubSet

func (vector2 *Vector2) SubSet(x, y float64) *Vector2

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 (warc *WarcApp) CameraPosition() *Vector2

func (*WarcApp) DrawImage

func (warc *WarcApp) DrawImage(image WarcImage, position Vector2) error

Draw the give `WarcImage` to the renderer

func (*WarcApp) GetDeltaTime

func (warc *WarcApp) GetDeltaTime() float64

Get the delta time of `warcSDL`

func (*WarcApp) Init

func (warc *WarcApp) Init()

Initilize all the data in a `WarcApp`

func (*WarcApp) IsKeyJustPressed

func (warc *WarcApp) IsKeyJustPressed(key WarcKey) bool

func (*WarcApp) IsKeyPressed

func (warc *WarcApp) IsKeyPressed(key WarcKey) bool

func (*WarcApp) LoadImage

func (warc *WarcApp) LoadImage(filePath string) (WarcImage, error)

Load an image path float64 a new `WarcImage`

func (*WarcApp) Quit

func (warc *WarcApp) Quit()

Quit all Warc subsystems

func (*WarcApp) SetCameraFollow

func (warc *WarcApp) SetCameraFollow(position, size Vector2, op *CameraFollowOptions)

Set the `CameraFollowOptions` for the camera

func (*WarcApp) SetDraw

func (warc *WarcApp) SetDraw(draw func(warc *WarcApp))

Set the draw function for the `warcLoop`

func (*WarcApp) SetStart

func (warc *WarcApp) SetStart(start func(*WarcApp))

Set the start function for the `warcLoop`

func (*WarcApp) SetUpdate

func (warc *WarcApp) SetUpdate(update func(*WarcApp))

Set the update function for the `warcLoop`

func (*WarcApp) StartLoop

func (warc *WarcApp) StartLoop()

Start the loop

func (*WarcApp) StopLoop

func (warc *WarcApp) StopLoop()

Quit out of the current loop from the app

type WarcImage

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

Data needed to render an image

func MakeWarcImage

func MakeWarcImage() WarcImage

Create a new `WarcImage` with default values

func (WarcImage) GetSize

func (image WarcImage) GetSize() (Vector2, error)

Get the size of the given `WarcImage` as a `Vector2`

func (*WarcImage) Scale

func (image *WarcImage) Scale() *Vector2

Get the image.scale Vector2

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
)

Jump to

Keyboard shortcuts

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