Documentation
¶
Index ¶
Constants ¶
const ( // CursorNone ... CursorNone = iota // CursorArrow ... CursorArrow // CursorCrosshair ... CursorCrosshair // CursorHand ... CursorHand // CursorIBeam ... CursorIBeam // CursorHResize ... CursorHResize // CursorVResize ... CursorVResize )
const MouseSystemPriority = 100
MouseSystemPriority ...
const (
// MouseZoomerPriority ...
MouseZoomerPriority = 110
)
const (
// RenderSystemPriority ...
RenderSystemPriority = -1000
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BytesResource ¶
BytesResource ...
func NewBytesResource ¶
func NewBytesResource(buf *bytes.Buffer) BytesResource
NewBytesResource sends the image to the GPU and returns a `BytesResource` for easy access
type Cursor ¶
type Cursor uint8
Cursor is a reference to a GLFW-cursor - to be used with the `SetCursor` method.
type Mouse ¶
type Mouse struct {
// X is the current x position of the mouse in the game
X float32
// Y is the current y position of the mouse in the game
Y float32
// ScrollX is the current scrolled position on the x component
ScrollX float32
// ScrollY is the current scrolled position on the y component
ScrollY float32
// Action is the currently active Action
Action minieng.Action
// Button is which button is being pressed on the mouse
Button minieng.MouseButton
// Modifier is whether any modifier mouse buttons are being pressed
Modifer minieng.Modifier
}
Mouse is the representation of the physical mouse
type MouseComponent ¶
type MouseComponent struct {
// Clicked is true whenever the Mouse was clicked over
// the entity space in this frame
Clicked bool
// Released is true whenever the left mouse button is released over the
// entity space in this frame
Released bool
// Hovered is true whenever the Mouse is hovering
// the entity space in this frame. This does not necessarily imply that
// the mouse button was pressed down in your entity space.
Hovered bool
// Dragged is true whenever the entity space was left-clicked,
// and then the mouse started moving (while holding)
Dragged bool
// RightClicked is true whenever the entity space was right-clicked
// in this frame
RightClicked bool
// RightDragged is true whenever the entity space was right-clicked,
// and then the mouse started moving (while holding)
RightDragged bool
// RightReleased is true whenever the right mouse button is released over
// the entity space in this frame. This does not necessarily imply that
// the mouse button was pressed down in your entity space.
RightReleased bool
// Enter is true whenever the Mouse entered the entity space in that frame,
// but wasn't in that space during the previous frame
Enter bool
// Leave is true whenever the Mouse was in the space on the previous frame,
// but now isn't
Leave bool
// Position of the mouse at any moment this is generally used
// in conjunction with Track = true
MouseX float32
MouseY float32
// Set manually this to true and your mouse component will track the mouse
// and your entity will always be able to receive an updated mouse
// component even if its space is not under the mouse cursor
// WARNING: you MUST know why you want to use this because it will
// have serious performance impacts if you have many entities with
// a MouseComponent in tracking mode.
// This is ideally used for a really small number of entities
// that must really be aware of the mouse details event when the
// mouse is not hovering them
Track bool
// Modifier is used to store the eventual modifiers that were pressed during
// the same time the different click events occurred
Modifier minieng.Modifier
// contains filtered or unexported fields
}
MouseComponent is the location for the MouseSystem to store its results; to be used / viewed by other Systems
type MouseSystem ¶
type MouseSystem struct {
// contains filtered or unexported fields
}
MouseSystem listens for mouse events, and changes value for MouseComponent accordingly
func (*MouseSystem) Add ¶
func (m *MouseSystem) Add(basic *minieng.BasicEntity, mouse *MouseComponent, space *SpaceComponent, render *RenderComponent)
Add adds a new entity to the MouseSystem.
- RenderComponent is only required if you're using the HUDShader on this Entity.
- SpaceComponent is required whenever you want to know specific mouse-events on this Entity (like hover, click, etc.). If you don't need those, then you can omit the SpaceComponent.
- MouseComponent is always required.
- BasicEntity is always required.
func (*MouseSystem) Priority ¶
func (m *MouseSystem) Priority() int
Priority returns a priority higher than most, to ensure that this System runs before all others
type MouseZoomer ¶
type MouseZoomer struct {
}
MouseZoomer is a System that allows for zooming when the scroll wheel is used
type RenderComponent ¶
type RenderComponent struct {
// Hidden is used to prevent drawing by OpenGL
Hidden bool
Drawable Drawable
// contains filtered or unexported fields
}
RenderComponent ...
func (*RenderComponent) SetZIndex ¶
func (r *RenderComponent) SetZIndex(index float32)
SetZIndex ...
type RenderSystem ¶
type RenderSystem struct {
// contains filtered or unexported fields
}
RenderSystem ...
func (*RenderSystem) Add ¶
func (rs *RenderSystem) Add(basic *minieng.BasicEntity, render *RenderComponent)
Add ...
type SpaceComponent ¶
SpaceComponent ...
type TextureResource ¶
type TextureResource struct {
Texture *glplus.GPTexture
Img *image.RGBA
// contains filtered or unexported fields
}
TextureResource ...
func NewTextureResource ¶
func NewTextureResource(img *image.RGBA) TextureResource
NewTextureResource sends the image to the GPU and returns a `TextureResource` for easy access