Documentation ¶
Index ¶
- Constants
- Variables
- func AddBox(space *cp.Space, pos cp.Vector, mass, width, height float64) *cp.Shape
- func AddCircle(space *cp.Space, pos cp.Vector, mass, radius float64) *cp.Shape
- func AddSegment(space *cp.Space, pos cp.Vector, mass, width, height float64) *cp.Shape
- func AddStaticBox(space *cp.Space, pos cp.Vector, width, height float64) *cp.Shape
- func AddWall(space *cp.Space, body *cp.Body, a, b cp.Vector, radius float64) *cp.Shape
- type DrawOptions
- func (o *DrawOptions) CollisionPointColor() cp.FColor
- func (o *DrawOptions) ConstraintColor() cp.FColor
- func (o *DrawOptions) Data() interface{}
- func (o *DrawOptions) DrawBB(bb cp.BB, outline cp.FColor)
- func (o *DrawOptions) DrawCircle(pos cp.Vector, angle, radius float64, outline, fill cp.FColor, _ interface{})
- func (o *DrawOptions) DrawDot(size float64, pos cp.Vector, fill cp.FColor, _ interface{})
- func (o *DrawOptions) DrawFatSegment(a, b cp.Vector, radius float64, outline, fill cp.FColor, _ interface{})
- func (o *DrawOptions) DrawPolygon(count int, verts []cp.Vector, radius float64, outline, fill cp.FColor, ...)
- func (o *DrawOptions) DrawSegment(a, b cp.Vector, fill cp.FColor, data interface{})
- func (o *DrawOptions) Flags() uint
- func (o *DrawOptions) Flush()
- func (o *DrawOptions) OutlineColor() cp.FColor
- func (o *DrawOptions) ShapeColor(shape *cp.Shape, _ interface{}) cp.FColor
- type Game
Constants ¶
View Source
const ( ScreenHeight = 480 ScreenWidth = 600 )
View Source
const DrawPointLineScale = 1
Variables ¶
View Source
var Grabbable = cp.ShapeFilter{ cp.NO_GROUP, GrabbableMaskBit, GrabbableMaskBit, }
View Source
var GrabbableMaskBit uint = 1 << 31
View Source
var NotGrabbable = cp.ShapeFilter{ cp.NO_GROUP, ^GrabbableMaskBit, ^GrabbableMaskBit, }
Functions ¶
func AddSegment ¶
func AddSegment(space *cp.Space, pos cp.Vector, mass, width, height float64) *cp.Shape
func AddStaticBox ¶
func AddStaticBox(space *cp.Space, pos cp.Vector, width, height float64) *cp.Shape
Types ¶
type DrawOptions ¶
type DrawOptions struct {
// contains filtered or unexported fields
}
func NewDrawOptions ¶
func NewDrawOptions(img *ebiten.Image) *DrawOptions
func (*DrawOptions) CollisionPointColor ¶
func (o *DrawOptions) CollisionPointColor() cp.FColor
func (*DrawOptions) ConstraintColor ¶
func (o *DrawOptions) ConstraintColor() cp.FColor
func (*DrawOptions) Data ¶
func (o *DrawOptions) Data() interface{}
func (*DrawOptions) DrawBB ¶
func (o *DrawOptions) DrawBB(bb cp.BB, outline cp.FColor)
func (*DrawOptions) DrawCircle ¶
func (o *DrawOptions) DrawCircle(pos cp.Vector, angle, radius float64, outline, fill cp.FColor, _ interface{})
func (*DrawOptions) DrawDot ¶
func (o *DrawOptions) DrawDot(size float64, pos cp.Vector, fill cp.FColor, _ interface{})
func (*DrawOptions) DrawFatSegment ¶
func (o *DrawOptions) DrawFatSegment(a, b cp.Vector, radius float64, outline, fill cp.FColor, _ interface{})
func (*DrawOptions) DrawPolygon ¶
func (o *DrawOptions) DrawPolygon(count int, verts []cp.Vector, radius float64, outline, fill cp.FColor, _ interface{})
func (*DrawOptions) DrawSegment ¶
func (o *DrawOptions) DrawSegment(a, b cp.Vector, fill cp.FColor, data interface{})
func (*DrawOptions) Flags ¶
func (o *DrawOptions) Flags() uint
func (*DrawOptions) Flush ¶
func (o *DrawOptions) Flush()
func (*DrawOptions) OutlineColor ¶
func (o *DrawOptions) OutlineColor() cp.FColor
func (*DrawOptions) ShapeColor ¶
func (o *DrawOptions) ShapeColor(shape *cp.Shape, _ interface{}) cp.FColor
type Game ¶
type Game struct { // Space holds all of the shapes and bodies Space *cp.Space // TicksPerSecond is the fixed physics tick rate. Set it higher if objects are going // through each other at the cost of higher CPU usage. TicksPerSecond float64 // Accumulator shows the remaining time from the physics tick. Accumulator float64 // FixedUpdate is an optional callback that is called when a fixed update occurs. FixedUpdate func() // contains filtered or unexported fields }
Game is provided as a convenience for the examples since they all share similar logic.
func (*Game) PhysicsTick ¶
func (g *Game) PhysicsTick()
Click to show internal directories.
Click to hide internal directories.