Documentation ¶
Overview ¶
Package allegro provides bindings to the core functionality of the Allegro 5 API.
In order to improve the readability of this API, many methods are annotated with information pulled directly from Allegro's online C documentation. Note that this means that method names and some other information may be C-specific, but otherwise should still be useful.
A bare-bones program might look something like this:
package main import ( "github.com/dradtke/go-allegro/allegro" ) const FPS int = 60 func main() { var ( display *allegro.Display eventQueue *allegro.EventQueue running bool = true err error ) allegro.Run(func() { // Create a 640x480 window and give it a title. allegro.SetNewDisplayFlags(allegro.WINDOWED) if display, err = allegro.CreateDisplay(640, 480); err == nil { defer display.Destroy() display.SetWindowTitle("Hello World") } else { panic(err) } // Create an event queue. All of the event sources we care about should // register themselves to this queue. if eventQueue, err = allegro.CreateEventQueue(); err == nil { defer eventQueue.Destroy() } else { panic(err) } // Calculate the timeout value based on the desired FPS. timeout := float64(1) / float64(FPS) // Register event sources. eventQueue.Register(display) // Set the screen to black. allegro.ClearToColor(allegro.MapRGB(0, 0, 0)) allegro.FlipDisplay() // Main loop. var event allegro.Event for { if e, found := eventQueue.WaitForEventUntil(allegro.NewTimeout(timeout), &event); found { switch e.(type) { case allegro.DisplayCloseEvent: running = false break // Handle other events here. } } if !running { return } } }) }
Index ¶
- Constants
- Variables
- func AddNewBitmapFlag(flags BitmapFlags)
- func AppName() string
- func Blender() (op BlendingOperation, src, dst BlendingValue)
- func CPUCount() int
- func ClearToColor(c Color)
- func ClippingRectangle() (x, y, w, h int)
- func ConvertMemoryBitmaps()
- func DrawPixel(x, y float32, color Color)
- func FlipDisplay()
- func HoldBitmapDrawing(hold bool)
- func InhibitScreensaver(inhibit bool) error
- func InstallJoystick() error
- func InstallKeyboard() error
- func InstallMouse() error
- func IsBitmapDrawingHeld() bool
- func IsJoystickInstalled() bool
- func IsKeyboardInstalled() bool
- func IsMouseInstalled() bool
- func LastError() error
- func MakeTempFile(template string) string
- func MouseCursorPosition() (int, int, error)
- func MouseNumAxes() uint
- func MouseNumButtons() uint
- func NewDisplayAdapter() int
- func NewDisplayRefreshRate() int
- func NewWindowPosition() (int, int)
- func NewWindowTitle() string
- func NumDisplayModes() int
- func NumJoysticks() int
- func NumVideoAdapters() int
- func OrgName() string
- func PixelBlockHeight(format PixelFormat) int
- func PixelBlockSize(format PixelFormat) int
- func PixelBlockWidth(format PixelFormat) int
- func PutBlendedPixel(x, y int, color Color)
- func PutPixel(x, y int, color Color)
- func RAMSize() int
- func ReconfigureJoysticks() bool
- func RegisterEventType(t C.ALLEGRO_EVENT_TYPE, f func(*Event) interface{})
- func ResetClippingRectangle()
- func ResetDisplayFlags()
- func ResetNewDisplayOptions()
- func ResetNewWindowPosition()
- func Rest(seconds float64)
- func RestoreState(state *State)
- func Run(f func())
- func SeparateBlender() (op BlendingOperation, src, dst BlendingValue, alpha_op BlendingOperation, ...)
- func SetAppName(name string)
- func SetBlendColor(c Color)
- func SetBlender(op BlendingOperation, src, dst BlendingValue)
- func SetClippingRectangle(x, y, width, height int)
- func SetExeName(path string)
- func SetKeyboardLeds(leds int) bool
- func SetLastError(e *Error)
- func SetMemoryInterface(memory_interface *C.ALLEGRO_MEMORY_INTERFACE)
- func SetMouseAxis(which, value int) error
- func SetNewBitmapFlags(flags BitmapFlags)
- func SetNewBitmapFormat(format PixelFormat)
- func SetNewDisplayAdapter(adapter int)
- func SetNewDisplayFlags(flags DisplayFlags)
- func SetNewDisplayOption(option DisplayOption, value int, im Importance)
- func SetNewDisplayRefreshRate(rate int)
- func SetNewWindowPosition(x, y int)
- func SetNewWindowTitle(title string)
- func SetOrgName(name string)
- func SetSeparateBlender(op BlendingOperation, src, dst BlendingValue, alpha_op BlendingOperation, ...)
- func SetTargetBackbuffer(d *Display)
- func SetTargetBitmap(bmp *Bitmap)
- func Time() float64
- func UngrabMouse() error
- func UninstallJoystick()
- func UninstallKeyboard()
- func UninstallMouse()
- func UpdateDisplayRegion(x, y, width, height int)
- func UseTransform(trans *Transform)
- func Version() (major, minor, revision, release uint8)
- func WaitForVSync() error
- type AudioStreamFinished
- type AudioStreamFragment
- type Bitmap
- func (bmp *Bitmap) AsTarget(f func()) *Bitmap
- func (bmp *Bitmap) At(x, y int) color.Color
- func (bmp *Bitmap) BitmapFlags() BitmapFlags
- func (bmp *Bitmap) BitmapFormat() PixelFormat
- func (bmp *Bitmap) Bounds() image.Rectangle
- func (bmp *Bitmap) Clone() (*Bitmap, error)
- func (bmp *Bitmap) ColorModel() color.Model
- func (bmp *Bitmap) Convert()
- func (bmp *Bitmap) ConvertMaskToAlpha(mask_color Color)
- func (bmp *Bitmap) CreateSubBitmap(x, y, w, h int) (*Bitmap, error)
- func (bmp *Bitmap) Destroy()
- func (bmp *Bitmap) Draw(dx, dy float32, flags DrawFlags)
- func (bmp *Bitmap) DrawRegion(sx, sy, sw, sh, dx, dy float32, flags DrawFlags)
- func (bmp *Bitmap) DrawRotated(cx, cy, dx, dy, angle float32, flags DrawFlags)
- func (bmp *Bitmap) DrawScaled(sx, sy, sw, sh, dx, dy, dw, dh float32, flags DrawFlags)
- func (bmp *Bitmap) DrawScaledRotated(cx, cy, dx, dy, xscale, yscale, angle float32, flags DrawFlags)
- func (bmp *Bitmap) DrawTinted(tint Color, dx, dy float32, flags DrawFlags)
- func (bmp *Bitmap) DrawTintedRegion(tint Color, sx, sy, sw, sh, dx, dy float32, flags DrawFlags)
- func (bmp *Bitmap) DrawTintedRotated(tint Color, cx, cy, dx, dy, angle float32, flags DrawFlags)
- func (bmp *Bitmap) DrawTintedScaled(tint Color, sx, sy, sw, sh, dx, dy, dw, dh float32, flags DrawFlags)
- func (bmp *Bitmap) DrawTintedScaledRotated(tint Color, cx, cy, dx, dy, xscale, yscale, angle float32, flags DrawFlags)
- func (bmp *Bitmap) DrawTintedScaledRotatedRegion(sx, sy, sw, sh float32, tint Color, ...)
- func (bmp *Bitmap) Flags() BitmapFlags
- func (bmp *Bitmap) Format() PixelFormat
- func (bmp *Bitmap) Height() int
- func (bmp *Bitmap) IsCompatible() bool
- func (bmp *Bitmap) IsLocked() bool
- func (bmp *Bitmap) IsSubBitmap() bool
- func (bmp *Bitmap) Lock(format PixelFormat, flags LockFlags) (*LockedRegion, error)
- func (bmp *Bitmap) LockBlocked(flags LockFlags) (*LockedRegion, error)
- func (bmp *Bitmap) LockRegion(x, y, width, height int, format PixelFormat, flags LockFlags) (*LockedRegion, error)
- func (bmp *Bitmap) LockRegionBlocked(x, y, width, height int, flags LockFlags) (*LockedRegion, error)
- func (bmp *Bitmap) Parent() (*Bitmap, error)
- func (bmp *Bitmap) ParentBitmap() (*Bitmap, error)
- func (bmp *Bitmap) Pixel(x, y int) Color
- func (bmp *Bitmap) Reparent(parent *Bitmap, x, y, w, h int)
- func (bmp *Bitmap) Save(filename string) error
- func (bmp *Bitmap) Set(x, y int, c color.Color)
- func (bmp *Bitmap) Unlock()
- func (bmp *Bitmap) WhileLocked(format PixelFormat, flags LockFlags, f func()) error
- func (bmp *Bitmap) Width() int
- func (bmp *Bitmap) WithLockedTarget(format PixelFormat, flags LockFlags, f func()) error
- func (bmp *Bitmap) X() int
- func (bmp *Bitmap) Y() int
- type BitmapFlags
- type BlendingOperation
- type BlendingValue
- type Color
- type Config
- func (cfg *Config) AddComment(section, comment string)
- func (cfg *Config) AddSection(name string)
- func (cfg *Config) Destroy()
- func (cfg *Config) Entries(section string) <-chan string
- func (cfg *Config) FirstConfigEntry(section string) (string, *ConfigEntryIterator, error)
- func (cfg *Config) FirstConfigSection() (string, *ConfigSectionIterator)
- func (cfg *Config) Float32Value(section, key string) (float32, error)
- func (cfg *Config) Float64Value(section, key string) (float64, error)
- func (cfg *Config) IntValue(section, key string) (int64, error)
- func (cfg *Config) Merge(add *Config)
- func (cfg *Config) NextConfigEntry(iter *ConfigEntryIterator) (string, error)
- func (cfg *Config) NextConfigSection(iter *ConfigSectionIterator) (string, error)
- func (cfg *Config) RemoveKey(section, key string) bool
- func (cfg *Config) RemoveSection(name string)
- func (cfg *Config) Save(filename string) error
- func (cfg *Config) Sections() <-chan string
- func (cfg *Config) SetValue(section, key, value string)
- func (cfg *Config) UintValue(section, key string) (uint64, error)
- func (cfg *Config) Value(section, key string) (string, error)
- type ConfigEntryIterator
- type ConfigSectionIterator
- type Display
- func (d *Display) AcknowledgeResize() bool
- func (d *Display) Backbuffer() *Bitmap
- func (d *Display) ClipboardHasText() bool
- func (d *Display) ClipboardText() string
- func (d *Display) Destroy()
- func (d *Display) DisplayFormat() PixelFormat
- func (d *Display) DisplayOption(option DisplayOption) int
- func (d *Display) EventSource() *EventSource
- func (d *Display) GrabMouse() error
- func (d *Display) Height() int
- func (d *Display) HideMouseCursor() error
- func (d *Display) RefreshRate() int
- func (d *Display) Resize(width, height int) error
- func (d *Display) SetClipboardText(text string)
- func (d *Display) SetDisplayFlag(flags DisplayFlags, onoff bool) error
- func (d *Display) SetDisplayIcon(icon *Bitmap)
- func (d *Display) SetDisplayIcons(icons []*Bitmap)
- func (d *Display) SetMouseCursor(cursor *MouseCursor) error
- func (d *Display) SetMouseXY(x, y int) error
- func (d *Display) SetSystemMouseCursor(cursor SystemMouseCursor) error
- func (d *Display) SetWindowPosition(x, y int)
- func (d *Display) SetWindowTitle(title string)
- func (d *Display) ShowMouseCursor() error
- func (d *Display) Width() int
- func (d *Display) WindowPosition() (int, int)
- type DisplayCloseEvent
- type DisplayExposeEvent
- type DisplayFlags
- type DisplayFoundEvent
- type DisplayLostEvent
- type DisplayMode
- type DisplayOption
- type DisplayOrientation
- type DisplayOrientationEvent
- type DisplayResizeEvent
- type DisplaySwitchInEvent
- type DisplaySwitchOutEvent
- type DrawFlags
- type Error
- type Event
- type EventGenerator
- type EventQueue
- func (queue *EventQueue) Destroy()
- func (queue *EventQueue) DropNextEvent() bool
- func (queue *EventQueue) Flush()
- func (queue *EventQueue) GetNextEvent(event *Event) (interface{}, error)
- func (queue *EventQueue) IsEmpty() bool
- func (queue *EventQueue) PeekNextEvent(event *Event) (interface{}, error)
- func (queue *EventQueue) Register(obs ...EventGenerator)
- func (queue *EventQueue) RegisterEventSource(source *EventSource)
- func (queue *EventQueue) Unregister(ob EventGenerator)
- func (queue *EventQueue) UnregisterEventSource(source *EventSource)
- func (queue *EventQueue) WaitForEvent(event *Event) interface{}
- func (queue *EventQueue) WaitForEventTimed(event *Event, secs float32) (interface{}, bool)
- func (queue *EventQueue) WaitForEventUntil(timeout *Timeout, event *Event) (interface{}, bool)
- type EventSource
- type File
- func (f *File) ClearError()
- func (f *File) Close() error
- func (f *File) Eof() bool
- func (f *File) Flush() error
- func (f *File) Getc() (byte, error)
- func (f *File) HasError() bool
- func (f *File) LoadBitmap(ident string) (*Bitmap, error)
- func (f *File) LoadBitmapFlags(ident string, flags BitmapFlags) (*Bitmap, error)
- func (f *File) LoadConfig() (*Config, error)
- func (f *File) Putc(b byte) byte
- func (f *File) Read(b []byte) (n int, err error)
- func (f *File) SaveBitmap(ident string, bmp *Bitmap) error
- func (f *File) SaveConfig(cfg *Config) error
- func (f *File) Seek(offset int64, whence int) (ret int64, err error)
- func (f *File) Size() (int64, error)
- func (f *File) Slice(initial_size int, mode FileMode) (*File, error)
- func (f *File) Tell() (int64, error)
- func (f *File) Ungetc(b byte) byte
- func (f *File) Write(b []byte) (n int, err error)
- type FileMode
- type Importance
- type JoyFlags
- type Joystick
- func (j *Joystick) Active() bool
- func (j *Joystick) AxisName(stick, axis int) (string, error)
- func (j *Joystick) ButtonName(stick int) (string, error)
- func (j *Joystick) Name() string
- func (j *Joystick) NumAxes(stick int) int
- func (j *Joystick) NumButtons() int
- func (j *Joystick) NumSticks() int
- func (j *Joystick) Release()
- func (j *Joystick) State() *JoystickState
- func (j *Joystick) StickFlags(stick int) JoyFlags
- func (j *Joystick) StickName(stick int) (string, error)
- type JoystickAxisEvent
- type JoystickButtonDownEvent
- type JoystickButtonUpEvent
- type JoystickConfigurationEvent
- type JoystickState
- type KeyCharEvent
- type KeyCode
- type KeyDownEvent
- type KeyModifier
- type KeyUpEvent
- type Keyboard
- type KeyboardState
- type LockFlags
- type LockedRegion
- type MonitorInfo
- type MouseAxesEvent
- type MouseButtonDownEvent
- type MouseButtonUpEvent
- type MouseCursor
- type MouseEnterDisplayEvent
- type MouseLeaveDisplayEvent
- type MouseState
- func (state *MouseState) Axis(axis int) int
- func (state *MouseState) ButtonDown(button int) bool
- func (state *MouseState) Buttons() int
- func (state *MouseState) Get()
- func (state *MouseState) Pressure() float32
- func (state *MouseState) W() int
- func (state *MouseState) X() int
- func (state *MouseState) Y() int
- func (state *MouseState) Z() int
- type MouseWarpedEvent
- type PixelFormat
- type State
- type StateFlags
- type SystemID
- type SystemMouseCursor
- type Timeout
- type Timer
- func (t *Timer) AddCount(diff int64)
- func (t *Timer) Count() int64
- func (t *Timer) Destroy()
- func (t *Timer) EventSource() *EventSource
- func (t *Timer) IsStarted() bool
- func (t *Timer) SetCount(count int64)
- func (t *Timer) SetSpeed(speed float64)
- func (t *Timer) Speed() float64
- func (t *Timer) Start()
- func (t *Timer) Stop()
- type TimerEvent
- type Transform
- func (t *Transform) CheckInverse(tol float32) bool
- func (t *Transform) Compose(other *Transform)
- func (t *Transform) Coordinates(x, y float32) (float32, float32)
- func (t *Transform) Copy() *Transform
- func (t *Transform) Identity()
- func (t *Transform) Invert()
- func (t *Transform) Rotate(theta float32)
- func (t *Transform) Scale(sx, sy float32)
- func (t *Transform) Translate(x, y float32)
- type UserEvent
Constants ¶
const ( WINDOWED DisplayFlags = C.ALLEGRO_WINDOWED FULLSCREEN = C.ALLEGRO_FULLSCREEN FULLSCREEN_WINDOW = C.ALLEGRO_FULLSCREEN_WINDOW RESIZABLE = C.ALLEGRO_RESIZABLE OPENGL = C.ALLEGRO_OPENGL OPENGL_3_0 = C.ALLEGRO_OPENGL_3_0 OPENGL_FORWARD_COMPATIBLE = C.ALLEGRO_OPENGL_FORWARD_COMPATIBLE FRAMELESS = C.ALLEGRO_FRAMELESS NOFRAME = C.ALLEGRO_NOFRAME GENERATE_EXPOSE_EVENTS = C.ALLEGRO_GENERATE_EXPOSE_EVENTS )
const ( COLOR_SIZE DisplayOption = C.ALLEGRO_COLOR_SIZE RED_SIZE = C.ALLEGRO_RED_SIZE GREEN_SIZE = C.ALLEGRO_GREEN_SIZE BLUE_SIZE = C.ALLEGRO_BLUE_SIZE ALPHA_SIZE = C.ALLEGRO_ALPHA_SIZE RED_SHIFT = C.ALLEGRO_RED_SHIFT GREEN_SHIFT = C.ALLEGRO_GREEN_SHIFT BLUE_SHIFT = C.ALLEGRO_BLUE_SHIFT ALPHA_SHIFT = C.ALLEGRO_ALPHA_SHIFT ACC_RED_SIZE = C.ALLEGRO_ACC_RED_SIZE ACC_GREEN_SIZE = C.ALLEGRO_ACC_GREEN_SIZE ACC_BLUE_SIZE = C.ALLEGRO_ACC_BLUE_SIZE ACC_ALPHA_SIZE = C.ALLEGRO_ACC_ALPHA_SIZE STEREO = C.ALLEGRO_STEREO AUX_BUFFERS = C.ALLEGRO_AUX_BUFFERS DEPTH_SIZE = C.ALLEGRO_DEPTH_SIZE STENCIL_SIZE = C.ALLEGRO_STENCIL_SIZE SAMPLE_BUFFERS = C.ALLEGRO_SAMPLE_BUFFERS SAMPLES = C.ALLEGRO_SAMPLES RENDER_METHOD = C.ALLEGRO_RENDER_METHOD FLOAT_COLOR = C.ALLEGRO_FLOAT_COLOR FLOAT_DEPTH = C.ALLEGRO_FLOAT_DEPTH SINGLE_BUFFER = C.ALLEGRO_SINGLE_BUFFER SWAP_METHOD = C.ALLEGRO_SWAP_METHOD COMPATIBLE_DISPLAY = C.ALLEGRO_COMPATIBLE_DISPLAY UPDATE_DISPLAY_REGION = C.ALLEGRO_UPDATE_DISPLAY_REGION VSYNC = C.ALLEGRO_VSYNC MAX_BITMAP_SIZE = C.ALLEGRO_MAX_BITMAP_SIZE SUPPORT_NPOT_BITMAP = C.ALLEGRO_SUPPORT_NPOT_BITMAP CAN_DRAW_INTO_BITMAP = C.ALLEGRO_CAN_DRAW_INTO_BITMAP SUPPORT_SEPARATE_ALPHA = C.ALLEGRO_SUPPORT_SEPARATE_ALPHA )
const ( REQUIRE Importance = C.ALLEGRO_REQUIRE SUGGEST = C.ALLEGRO_SUGGEST DONTCARE = C.ALLEGRO_DONTCARE )
const ( DISPLAY_ORIENTATION_0_DEGREES DisplayOrientation = C.ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES DISPLAY_ORIENTATION_90_DEGREES = C.ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES DISPLAY_ORIENTATION_180_DEGREES = C.ALLEGRO_DISPLAY_ORIENTATION_180_DEGREES DISPLAY_ORIENTATION_270_DEGREES = C.ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES DISPLAY_ORIENTATION_FACE_UP = C.ALLEGRO_DISPLAY_ORIENTATION_FACE_UP DISPLAY_ORIENTATION_FACE_DOWN = C.ALLEGRO_DISPLAY_ORIENTATION_FACE_DOWN )
const ( FLIP_NONE DrawFlags = 0 FLIP_HORIZONTAL = C.ALLEGRO_FLIP_HORIZONTAL FLIP_VERTICAL = C.ALLEGRO_FLIP_VERTICAL )
const ( ALPHA_TEST BitmapFlags = C.ALLEGRO_ALPHA_TEST FORCE_LOCKING = C.ALLEGRO_FORCE_LOCKING KEEP_BITMAP_FORMAT = C.ALLEGRO_KEEP_BITMAP_FORMAT KEEP_INDEX = C.ALLEGRO_KEEP_INDEX MAG_LINEAR = C.ALLEGRO_MAG_LINEAR MEMORY_BITMAP = C.ALLEGRO_MEMORY_BITMAP MIN_LINEAR = C.ALLEGRO_MIN_LINEAR MIPMAP = C.ALLEGRO_MIPMAP NO_PREMULTIPLIED_ALPHA = C.ALLEGRO_NO_PREMULTIPLIED_ALPHA NO_PRESERVE_TEXTURE = C.ALLEGRO_NO_PRESERVE_TEXTURE VIDEO_BITMAP = C.ALLEGRO_VIDEO_BITMAP )
const ( LOCK_READONLY LockFlags = C.ALLEGRO_LOCK_READONLY LOCK_WRITEONLY = C.ALLEGRO_LOCK_WRITEONLY LOCK_READWRITE = C.ALLEGRO_LOCK_READWRITE )
const ( PIXEL_FORMAT_ANY PixelFormat = C.ALLEGRO_PIXEL_FORMAT_ANY PIXEL_FORMAT_ANY_NO_ALPHA = C.ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA PIXEL_FORMAT_ANY_WITH_ALPHA = C.ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA PIXEL_FORMAT_ANY_15_NO_ALPHA = C.ALLEGRO_PIXEL_FORMAT_ANY_15_NO_ALPHA PIXEL_FORMAT_ANY_16_NO_ALPHA = C.ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA PIXEL_FORMAT_ANY_16_WITH_ALPHA = C.ALLEGRO_PIXEL_FORMAT_ANY_16_WITH_ALPHA PIXEL_FORMAT_ANY_24_NO_ALPHA = C.ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA PIXEL_FORMAT_ANY_32_NO_ALPHA = C.ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA PIXEL_FORMAT_ANY_32_WITH_ALPHA = C.ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA PIXEL_FORMAT_ARGB_8888 = C.ALLEGRO_PIXEL_FORMAT_ARGB_8888 PIXEL_FORMAT_RGBA_8888 = C.ALLEGRO_PIXEL_FORMAT_RGBA_8888 PIXEL_FORMAT_ARGB_4444 = C.ALLEGRO_PIXEL_FORMAT_ARGB_4444 PIXEL_FORMAT_RGB_888 = C.ALLEGRO_PIXEL_FORMAT_RGB_888 PIXEL_FORMAT_RGB_565 = C.ALLEGRO_PIXEL_FORMAT_RGB_565 PIXEL_FORMAT_RGB_555 = C.ALLEGRO_PIXEL_FORMAT_RGB_555 PIXEL_FORMAT_RGBA_5551 = C.ALLEGRO_PIXEL_FORMAT_RGBA_5551 PIXEL_FORMAT_ARGB_1555 = C.ALLEGRO_PIXEL_FORMAT_ARGB_1555 PIXEL_FORMAT_ABGR_8888 = C.ALLEGRO_PIXEL_FORMAT_ABGR_8888 PIXEL_FORMAT_XBGR_8888 = C.ALLEGRO_PIXEL_FORMAT_XBGR_8888 PIXEL_FORMAT_BGR_888 = C.ALLEGRO_PIXEL_FORMAT_BGR_888 PIXEL_FORMAT_BGR_565 = C.ALLEGRO_PIXEL_FORMAT_BGR_565 PIXEL_FORMAT_BGR_555 = C.ALLEGRO_PIXEL_FORMAT_BGR_555 PIXEL_FORMAT_RGBX_8888 = C.ALLEGRO_PIXEL_FORMAT_RGBX_8888 PIXEL_FORMAT_XRGB_8888 = C.ALLEGRO_PIXEL_FORMAT_XRGB_8888 PIXEL_FORMAT_ABGR_F32 = C.ALLEGRO_PIXEL_FORMAT_ABGR_F32 PIXEL_FORMAT_ABGR_8888_LE = C.ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE PIXEL_FORMAT_RGBA_4444 = C.ALLEGRO_PIXEL_FORMAT_RGBA_4444 )
const ( ADD BlendingOperation = C.ALLEGRO_ADD DEST_MINUS_SRC = C.ALLEGRO_DEST_MINUS_SRC SRC_MINUS_DEST = C.ALLEGRO_SRC_MINUS_DEST )
const ( ZERO BlendingValue = C.ALLEGRO_ZERO ONE = C.ALLEGRO_ONE ALPHA = C.ALLEGRO_ALPHA INVERSE_ALPHA = C.ALLEGRO_INVERSE_ALPHA )
const ( KEY_A KeyCode = C.ALLEGRO_KEY_A KEY_B = C.ALLEGRO_KEY_B KEY_C = C.ALLEGRO_KEY_C KEY_D = C.ALLEGRO_KEY_D KEY_E = C.ALLEGRO_KEY_E KEY_F = C.ALLEGRO_KEY_F KEY_G = C.ALLEGRO_KEY_G KEY_H = C.ALLEGRO_KEY_H KEY_I = C.ALLEGRO_KEY_I KEY_J = C.ALLEGRO_KEY_J KEY_K = C.ALLEGRO_KEY_K KEY_L = C.ALLEGRO_KEY_L KEY_M = C.ALLEGRO_KEY_M KEY_N = C.ALLEGRO_KEY_N KEY_O = C.ALLEGRO_KEY_O KEY_P = C.ALLEGRO_KEY_P KEY_Q = C.ALLEGRO_KEY_Q KEY_R = C.ALLEGRO_KEY_R KEY_S = C.ALLEGRO_KEY_S KEY_T = C.ALLEGRO_KEY_T KEY_U = C.ALLEGRO_KEY_U KEY_V = C.ALLEGRO_KEY_V KEY_W = C.ALLEGRO_KEY_W KEY_X = C.ALLEGRO_KEY_X KEY_Y = C.ALLEGRO_KEY_Y KEY_Z = C.ALLEGRO_KEY_Z KEY_0 = C.ALLEGRO_KEY_0 KEY_1 = C.ALLEGRO_KEY_1 KEY_2 = C.ALLEGRO_KEY_2 KEY_3 = C.ALLEGRO_KEY_3 KEY_4 = C.ALLEGRO_KEY_4 KEY_5 = C.ALLEGRO_KEY_5 KEY_6 = C.ALLEGRO_KEY_6 KEY_7 = C.ALLEGRO_KEY_7 KEY_8 = C.ALLEGRO_KEY_8 KEY_9 = C.ALLEGRO_KEY_9 KEY_PAD_0 = C.ALLEGRO_KEY_PAD_0 KEY_PAD_1 = C.ALLEGRO_KEY_PAD_1 KEY_PAD_2 = C.ALLEGRO_KEY_PAD_2 KEY_PAD_3 = C.ALLEGRO_KEY_PAD_3 KEY_PAD_4 = C.ALLEGRO_KEY_PAD_4 KEY_PAD_5 = C.ALLEGRO_KEY_PAD_5 KEY_PAD_6 = C.ALLEGRO_KEY_PAD_6 KEY_PAD_7 = C.ALLEGRO_KEY_PAD_7 KEY_PAD_8 = C.ALLEGRO_KEY_PAD_8 KEY_PAD_9 = C.ALLEGRO_KEY_PAD_9 KEY_F1 = C.ALLEGRO_KEY_F1 KEY_F2 = C.ALLEGRO_KEY_F2 KEY_F3 = C.ALLEGRO_KEY_F3 KEY_F4 = C.ALLEGRO_KEY_F4 KEY_F5 = C.ALLEGRO_KEY_F5 KEY_F6 = C.ALLEGRO_KEY_F6 KEY_F7 = C.ALLEGRO_KEY_F7 KEY_F8 = C.ALLEGRO_KEY_F8 KEY_F9 = C.ALLEGRO_KEY_F9 KEY_F10 = C.ALLEGRO_KEY_F10 KEY_F11 = C.ALLEGRO_KEY_F11 KEY_F12 = C.ALLEGRO_KEY_F12 KEY_ESCAPE = C.ALLEGRO_KEY_ESCAPE KEY_TILDE = C.ALLEGRO_KEY_TILDE KEY_MINUS = C.ALLEGRO_KEY_MINUS KEY_EQUALS = C.ALLEGRO_KEY_EQUALS KEY_BACKSPACE = C.ALLEGRO_KEY_BACKSPACE KEY_TAB = C.ALLEGRO_KEY_TAB KEY_OPENBRACE = C.ALLEGRO_KEY_OPENBRACE KEY_CLOSEBRACE = C.ALLEGRO_KEY_CLOSEBRACE KEY_ENTER = C.ALLEGRO_KEY_ENTER KEY_SEMICOLON = C.ALLEGRO_KEY_SEMICOLON KEY_QUOTE = C.ALLEGRO_KEY_QUOTE KEY_BACKSLASH = C.ALLEGRO_KEY_BACKSLASH KEY_BACKSLASH2 = C.ALLEGRO_KEY_BACKSLASH2 KEY_COMMA = C.ALLEGRO_KEY_COMMA KEY_FULLSTOP = C.ALLEGRO_KEY_FULLSTOP KEY_SLASH = C.ALLEGRO_KEY_SLASH KEY_SPACE = C.ALLEGRO_KEY_SPACE KEY_INSERT = C.ALLEGRO_KEY_INSERT KEY_DELETE = C.ALLEGRO_KEY_DELETE KEY_HOME = C.ALLEGRO_KEY_HOME KEY_END = C.ALLEGRO_KEY_END KEY_PGUP = C.ALLEGRO_KEY_PGUP KEY_PGDN = C.ALLEGRO_KEY_PGDN KEY_LEFT = C.ALLEGRO_KEY_LEFT KEY_RIGHT = C.ALLEGRO_KEY_RIGHT KEY_UP = C.ALLEGRO_KEY_UP KEY_DOWN = C.ALLEGRO_KEY_DOWN KEY_PAD_SLASH = C.ALLEGRO_KEY_PAD_SLASH KEY_PAD_ASTERISK = C.ALLEGRO_KEY_PAD_ASTERISK KEY_PAD_MINUS = C.ALLEGRO_KEY_PAD_MINUS KEY_PAD_PLUS = C.ALLEGRO_KEY_PAD_PLUS KEY_PAD_DELETE = C.ALLEGRO_KEY_PAD_DELETE KEY_PAD_ENTER = C.ALLEGRO_KEY_PAD_ENTER KEY_PRINTSCREEN = C.ALLEGRO_KEY_PRINTSCREEN KEY_PAUSE = C.ALLEGRO_KEY_PAUSE KEY_ABNT_C1 = C.ALLEGRO_KEY_ABNT_C1 KEY_YEN = C.ALLEGRO_KEY_YEN KEY_KANA = C.ALLEGRO_KEY_KANA KEY_CONVERT = C.ALLEGRO_KEY_CONVERT KEY_NOCONVERT = C.ALLEGRO_KEY_NOCONVERT KEY_AT = C.ALLEGRO_KEY_AT KEY_CIRCUMFLEX = C.ALLEGRO_KEY_CIRCUMFLEX KEY_COLON2 = C.ALLEGRO_KEY_COLON2 KEY_KANJI = C.ALLEGRO_KEY_KANJI KEY_LSHIFT = C.ALLEGRO_KEY_LSHIFT KEY_RSHIFT = C.ALLEGRO_KEY_RSHIFT KEY_LCTRL = C.ALLEGRO_KEY_LCTRL KEY_RCTRL = C.ALLEGRO_KEY_RCTRL KEY_ALT = C.ALLEGRO_KEY_ALT KEY_ALTGR = C.ALLEGRO_KEY_ALTGR KEY_LWIN = C.ALLEGRO_KEY_LWIN KEY_RWIN = C.ALLEGRO_KEY_RWIN KEY_MENU = C.ALLEGRO_KEY_MENU KEY_SCROLLLOCK = C.ALLEGRO_KEY_SCROLLLOCK KEY_NUMLOCK = C.ALLEGRO_KEY_NUMLOCK KEY_CAPSLOCK = C.ALLEGRO_KEY_CAPSLOCK KEY_PAD_EQUALS = C.ALLEGRO_KEY_PAD_EQUALS KEY_BACKQUOTE = C.ALLEGRO_KEY_BACKQUOTE KEY_SEMICOLON2 = C.ALLEGRO_KEY_SEMICOLON2 KEY_COMMAND = C.ALLEGRO_KEY_COMMAND )
const ( KEYMOD_SHIFT KeyModifier = C.ALLEGRO_KEYMOD_SHIFT KEYMOD_CTRL = C.ALLEGRO_KEYMOD_CTRL KEYMOD_ALT = C.ALLEGRO_KEYMOD_ALT KEYMOD_LWIN = C.ALLEGRO_KEYMOD_LWIN KEYMOD_RWIN = C.ALLEGRO_KEYMOD_RWIN KEYMOD_MENU = C.ALLEGRO_KEYMOD_MENU KEYMOD_ALTGR = C.ALLEGRO_KEYMOD_ALTGR KEYMOD_COMMAND = C.ALLEGRO_KEYMOD_COMMAND KEYMOD_SCROLLLOCK = C.ALLEGRO_KEYMOD_SCROLLLOCK KEYMOD_NUMLOCK = C.ALLEGRO_KEYMOD_NUMLOCK KEYMOD_CAPSLOCK = C.ALLEGRO_KEYMOD_CAPSLOCK KEYMOD_INALTSEQ = C.ALLEGRO_KEYMOD_INALTSEQ KEYMOD_ACCENT1 = C.ALLEGRO_KEYMOD_ACCENT1 KEYMOD_ACCENT2 = C.ALLEGRO_KEYMOD_ACCENT2 KEYMOD_ACCENT3 = C.ALLEGRO_KEYMOD_ACCENT3 KEYMOD_ACCENT4 = C.ALLEGRO_KEYMOD_ACCENT4 )
const ( MouseCursorDefault SystemMouseCursor = C.ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT MouseCursorArrow = C.ALLEGRO_SYSTEM_MOUSE_CURSOR_ARROW MouseCursorBusy = C.ALLEGRO_SYSTEM_MOUSE_CURSOR_BUSY MouseCursorQuestion = C.ALLEGRO_SYSTEM_MOUSE_CURSOR_QUESTION MouseCursorEdit = C.ALLEGRO_SYSTEM_MOUSE_CURSOR_EDIT MouseCursorMove = C.ALLEGRO_SYSTEM_MOUSE_CURSOR_MOVE MouseCursorResizeN = C.ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_N MouseCursorResizeW = C.ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_W MouseCursorResizeS = C.ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_S MouseCursorResizeE = C.ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_E MouseCursorResizeNw = C.ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NW MouseCursorResizeSw = C.ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_SW MouseCursorResizeSe = C.ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_SE MouseCursorResizeNe = C.ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NE MouseCursorProgress = C.ALLEGRO_SYSTEM_MOUSE_CURSOR_PROGRESS MouseCursorPrecision = C.ALLEGRO_SYSTEM_MOUSE_CURSOR_PRECISION MouseCursorLink = C.ALLEGRO_SYSTEM_MOUSE_CURSOR_LINK MouseCursorAltSelect = C.ALLEGRO_SYSTEM_MOUSE_CURSOR_ALT_SELECT )
const ( STATE_NEW_DISPLAY_PARAMETERS StateFlags = C.ALLEGRO_STATE_NEW_DISPLAY_PARAMETERS STATE_NEW_BITMAP_PARAMETERS = C.ALLEGRO_STATE_NEW_BITMAP_PARAMETERS STATE_DISPLAY = C.ALLEGRO_STATE_DISPLAY STATE_TARGET_BITMAP = C.ALLEGRO_STATE_TARGET_BITMAP STATE_BLENDER = C.ALLEGRO_STATE_BLENDER STATE_TRANSFORM = C.ALLEGRO_STATE_TRANSFORM STATE_NEW_FILE_INTERFACE = C.ALLEGRO_STATE_NEW_FILE_INTERFACE STATE_BITMAP = C.ALLEGRO_STATE_BITMAP STATE_ALL = C.ALLEGRO_STATE_ALL )
const ( SYSTEM_ID_UNKNOWN SystemID = C.ALLEGRO_SYSTEM_ID_UNKNOWN SYSTEM_ID_XGLX = C.ALLEGRO_SYSTEM_ID_XGLX SYSTEM_ID_WINDOWS = C.ALLEGRO_SYSTEM_ID_WINDOWS SYSTEM_ID_MACOSX = C.ALLEGRO_SYSTEM_ID_MACOSX SYSTEM_ID_ANDROID = C.ALLEGRO_SYSTEM_ID_ANDROID SYSTEM_ID_IPHONE = C.ALLEGRO_SYSTEM_ID_IPHONE SYSTEM_ID_GP2XWIZ = C.ALLEGRO_SYSTEM_ID_GP2XWIZ SYSTEM_ID_RASPBERRYPI = C.ALLEGRO_SYSTEM_ID_RASPBERRYPI SYSTEM_ID_SDL = C.ALLEGRO_SYSTEM_ID_SDL )
Variables ¶
var ( BitmapIsNull = errors.New("bitmap is null") BitmapHasNoParent = errors.New("bitmap has no parent") )
var EmptyQueue = errors.New("event queue is empty")
Functions ¶
func AddNewBitmapFlag ¶
func AddNewBitmapFlag(flags BitmapFlags)
A convenience function which does the same as
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_add_new_bitmap_flag
func AppName ¶
func AppName() string
Returns the global application name string.
See https://liballeg.org/a5docs/5.2.6/system.html#al_get_app_name
func Blender ¶
func Blender() (op BlendingOperation, src, dst BlendingValue)
Returns the active blender for the current thread. You can pass NULL for values you are not interested in.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_blender
func CPUCount ¶
func CPUCount() int
Returns the number of CPU cores that the system Allegro is running on has and which could be detected, or a negative number if detection failed. Even if a positive number is returned, it might be that it is not correct. For example, Allegro running on a virtual machine will return the amount of CPU's of the VM, and not that of the underlying system.
See https://liballeg.org/a5docs/5.2.6/system.html#al_get_cpu_count
func ClearToColor ¶
func ClearToColor(c Color)
Clear the complete target bitmap, but confined by the clipping rectangle.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_clear_to_color
func ClippingRectangle ¶
func ClippingRectangle() (x, y, w, h int)
Gets the clipping rectangle of the target bitmap.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_clipping_rectangle
func ConvertMemoryBitmaps ¶
func ConvertMemoryBitmaps()
If you create a bitmap when there is no current display (for example because you have not called al_create_display in the current thread) and are using the ALLEGRO_CONVERT_BITMAP bitmap flag (which is set by default) then the bitmap will be created successfully, but as a memory bitmap. This function converts all such bitmaps to proper video bitmaps belonging to the current display.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_convert_memory_bitmaps
func DrawPixel ¶
Draws a single pixel at x, y. This function, unlike al_put_pixel, does blending and, unlike al_put_blended_pixel, respects the transformations (that is, the pixel's position is transformed, but its size is unaffected - it remains a pixel). This function can be slow if called often; if you need to draw a lot of pixels consider using al_draw_prim with ALLEGRO_PRIM_POINT_LIST from the primitives addon.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_draw_pixel
func FlipDisplay ¶
func FlipDisplay()
Copies or updates the front and back buffers so that what has been drawn previously on the currently selected display becomes visible on screen. Pointers to the special back buffer bitmap remain valid and retain their semantics as the back buffer, although the contents may have changed.
See https://liballeg.org/a5docs/5.2.6/display.html#al_flip_display
func HoldBitmapDrawing ¶
func HoldBitmapDrawing(hold bool)
Enables or disables deferred bitmap drawing. This allows for efficient drawing of many bitmaps that share a parent bitmap, such as sub-bitmaps from a tilesheet or simply identical bitmaps. Drawing bitmaps that do not share a parent is less efficient, so it is advisable to stagger bitmap drawing calls such that the parent bitmap is the same for large number of those calls. While deferred bitmap drawing is enabled, the only functions that can be used are the bitmap drawing functions and font drawing functions. Changing the state such as the blending modes will result in undefined behaviour. One exception to this rule are the non-projection transformations. It is possible to set a new transformation while the drawing is held.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_hold_bitmap_drawing
func InhibitScreensaver ¶
This function allows the user to stop the system screensaver from starting up if true is passed, or resets the system back to the default state (the state at program start) if false is passed. It returns true if the state was set successfully, otherwise false.
See https://liballeg.org/a5docs/5.2.6/display.html#al_inhibit_screensaver
func InstallJoystick ¶
func InstallJoystick() error
Install a joystick driver, returning true if successful. If a joystick driver was already installed, returns true immediately.
See https://liballeg.org/a5docs/5.2.6/joystick.html#al_install_joystick
func InstallKeyboard ¶
func InstallKeyboard() error
Install a keyboard driver. Returns true if successful. If a driver was already installed, nothing happens and true is returned.
See https://liballeg.org/a5docs/5.2.6/keyboard.html#al_install_keyboard
func InstallMouse ¶
func InstallMouse() error
Install a mouse driver.
See https://liballeg.org/a5docs/5.2.6/mouse.html#al_install_mouse
func IsBitmapDrawingHeld ¶
func IsBitmapDrawingHeld() bool
Returns whether the deferred bitmap drawing mode is turned on or off.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_is_bitmap_drawing_held
func IsJoystickInstalled ¶
func IsJoystickInstalled() bool
Returns true if al_install_joystick was called successfully.
See https://liballeg.org/a5docs/5.2.6/joystick.html#al_is_joystick_installed
func IsKeyboardInstalled ¶
func IsKeyboardInstalled() bool
Returns true if al_install_keyboard was called successfully.
See https://liballeg.org/a5docs/5.2.6/keyboard.html#al_is_keyboard_installed
func IsMouseInstalled ¶
func IsMouseInstalled() bool
Returns true if al_install_mouse was called successfully.
See https://liballeg.org/a5docs/5.2.6/mouse.html#al_is_mouse_installed
func LastError ¶
func LastError() error
Some Allegro functions will set an error number as well as returning an error code. Call this function to retrieve the last error number set for the calling thread.
See https://liballeg.org/a5docs/5.2.6/state.html#al_get_errno
func MakeTempFile ¶
Make a temporary randomly named file given a filename 'template'.
See https://liballeg.org/a5docs/5.2.6/file.html#al_make_temp_file
func MouseCursorPosition ¶
On platforms where this information is available, this function returns the global location of the mouse cursor, relative to the desktop. You should not normally use this function, as the information is not useful except for special scenarios as moving a window.
See https://liballeg.org/a5docs/5.2.6/mouse.html#al_get_mouse_cursor_position
func MouseNumAxes ¶
func MouseNumAxes() uint
Return the number of axes on the mouse. The first axis is 0.
See https://liballeg.org/a5docs/5.2.6/mouse.html#al_get_mouse_num_axes
func MouseNumButtons ¶
func MouseNumButtons() uint
Return the number of buttons on the mouse. The first button is 1.
See https://liballeg.org/a5docs/5.2.6/mouse.html#al_get_mouse_num_buttons
func NewDisplayAdapter ¶
func NewDisplayAdapter() int
Gets the video adapter index where new displays will be created by the calling thread, if previously set with al_set_new_display_adapter. Otherwise returns ALLEGRO_DEFAULT_DISPLAY_ADAPTER.
See https://liballeg.org/a5docs/5.2.6/monitor.html#al_get_new_display_adapter
func NewDisplayRefreshRate ¶
func NewDisplayRefreshRate() int
Get the requested refresh rate to be used when creating new displays on the calling thread.
See https://liballeg.org/a5docs/5.2.6/display.html#al_get_new_display_refresh_rate
func NewWindowPosition ¶
Get the position where new non-fullscreen displays created by the calling thread will be placed.
See https://liballeg.org/a5docs/5.2.6/display.html#al_get_new_window_position
func NewWindowTitle ¶
func NewWindowTitle() string
Returns the title that will be used when a new display is created. This returns the value that al_set_window_title was called with. If that function wasn't called yet, the value of al_get_app_name is returned as a default. The current implementation returns a pointer to a static buffer of which you should make a copy if you want to modify it.
See https://liballeg.org/a5docs/5.2.6/display.html#al_get_new_window_title
func NumDisplayModes ¶
func NumDisplayModes() int
Get the number of available fullscreen display modes for the current set of display parameters. This will use the values set with al_set_new_display_refresh_rate, and al_set_new_display_flags to find the number of modes that match. Settings the new display parameters to zero will give a list of all modes for the default driver.
See https://liballeg.org/a5docs/5.2.6/fullscreen_mode.html#al_get_num_display_modes
func NumJoysticks ¶
func NumJoysticks() int
Return the number of joysticks currently on the system (or potentially on the system). This number can change after al_reconfigure_joysticks is called, in order to support hotplugging.
See https://liballeg.org/a5docs/5.2.6/joystick.html#al_get_num_joysticks
func NumVideoAdapters ¶
func NumVideoAdapters() int
Get the number of video "adapters" attached to the computer. Each video card attached to the computer counts as one or more adapters. An adapter is thus really a video port that can have a monitor connected to it.
See https://liballeg.org/a5docs/5.2.6/monitor.html#al_get_num_video_adapters
func OrgName ¶
func OrgName() string
Returns the global organization name string.
See https://liballeg.org/a5docs/5.2.6/system.html#al_get_org_name
func PixelBlockHeight ¶
func PixelBlockHeight(format PixelFormat) int
Return the height of the the pixel block for this format.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_pixel_block_height
func PixelBlockSize ¶
func PixelBlockSize(format PixelFormat) int
Return the number of bytes that a block of pixels with this format occupies.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_pixel_block_size
func PixelBlockWidth ¶
func PixelBlockWidth(format PixelFormat) int
Return the width of the the pixel block for this format.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_pixel_block_width
func PutBlendedPixel ¶
Like al_put_pixel, but the pixel color is blended using the current blenders before being drawn.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_put_blended_pixel
func PutPixel ¶
Draw a single pixel on the target bitmap. This operation is slow on non-memory bitmaps. Consider locking the bitmap if you are going to use this function multiple times on the same bitmap. This function is not affected by the transformations or the color blenders.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_put_pixel
func RAMSize ¶
func RAMSize() int
Returns the size in MB of the random access memory that the system Allegro is running on has and which could be detected, or a negative number if detection failed. Even if a positive number is returned, it might be that it is not correct. For example, Allegro running on a virtual machine will return the amount of RAM of the VM, and not that of the underlying system.
See https://liballeg.org/a5docs/5.2.6/system.html#al_get_ram_size
func ReconfigureJoysticks ¶
func ReconfigureJoysticks() bool
Allegro is able to cope with users connecting and disconnected joystick devices on-the-fly. On existing platforms, the joystick event source will generate an event of type ALLEGRO_EVENT_JOYSTICK_CONFIGURATION when a device is plugged in or unplugged. In response, you should call al_reconfigure_joysticks.
See https://liballeg.org/a5docs/5.2.6/joystick.html#al_reconfigure_joysticks
func RegisterEventType ¶
func RegisterEventType(t C.ALLEGRO_EVENT_TYPE, f func(*Event) interface{})
RegisterEventType() lets modules register their own event types.
func ResetClippingRectangle ¶
func ResetClippingRectangle()
Equivalent to calling `al_set_clipping_rectangle(0, 0, w, h)' where w and h are the width and height of the target bitmap respectively.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_reset_clipping_rectangle
func ResetDisplayFlags ¶
func ResetDisplayFlags()
func ResetNewDisplayOptions ¶
func ResetNewDisplayOptions()
This undoes any previous call to al_set_new_display_option on the calling thread.
See https://liballeg.org/a5docs/5.2.6/display.html#al_reset_new_display_options
func ResetNewWindowPosition ¶
func ResetNewWindowPosition()
func Rest ¶
func Rest(seconds float64)
Waits for the specified number of seconds. This tells the system to pause the current thread for the given amount of time. With some operating systems, the accuracy can be in the order of 10ms. That is, even
func RestoreState ¶
func RestoreState(state *State)
Restores part of the state of the current thread from the given ALLEGRO_STATE object.
See https://liballeg.org/a5docs/5.2.6/state.html#al_restore_state
func Run ¶
func Run(f func())
On OS X, you may run into an NSInternalInconsistencyException if you attempt to initialize and use Allegro from the main() function directly. To get around that, the Run() function is used in conjunction with the allegro_main module and al_run_main().
Note: this has not been fully tested as I do not have access to OS X, so please let me know if it doesn't work for you.
For more information, go to https://github.com/dradtke/go-allegro/issues/3.
func SeparateBlender ¶
func SeparateBlender() (op BlendingOperation, src, dst BlendingValue, alpha_op BlendingOperation, alpha_src, alpha_dst BlendingValue)
Returns the active blender for the current thread. You can pass NULL for values you are not interested in.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_separate_blender
func SetAppName ¶
func SetAppName(name string)
Sets the global application name.
See https://liballeg.org/a5docs/5.2.6/system.html#al_set_app_name
func SetBlendColor ¶
func SetBlendColor(c Color)
Sets the color to use for blending when using the ALLEGRO_CONST_COLOR or ALLEGRO_INVERSE_CONST_COLOR blend functions. See al_set_blender for more information.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_set_blend_color
func SetBlender ¶
func SetBlender(op BlendingOperation, src, dst BlendingValue)
Sets the function to use for blending for the current thread.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_set_blender
func SetClippingRectangle ¶
func SetClippingRectangle(x, y, width, height int)
Set the region of the target bitmap or display that pixels get clipped to. The default is to clip pixels to the entire bitmap.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_set_clipping_rectangle
func SetExeName ¶
func SetExeName(path string)
This override the executable name used by al_get_standard_path for ALLEGRO_EXENAME_PATH and ALLEGRO_RESOURCES_PATH.
See https://liballeg.org/a5docs/5.2.6/system.html#al_set_exe_name
func SetKeyboardLeds ¶
Overrides the state of the keyboard LED indicators. Set leds to a combination of the keyboard modifier flags to enable the corresponding LED indicators (ALLEGRO_KEYMOD_NUMLOCK, ALLEGRO_KEYMOD_CAPSLOCK and ALLEGRO_KEYMOD_SCROLLLOCK are supported) or to -1 to return to default behavior. False is returned if the current keyboard driver cannot set LED indicators.
See https://liballeg.org/a5docs/5.2.6/keyboard.html#al_set_keyboard_leds
func SetLastError ¶
func SetLastError(e *Error)
Set the error number for the calling thread.
See https://liballeg.org/a5docs/5.2.6/state.html#al_set_errno
func SetMemoryInterface ¶
func SetMemoryInterface(memory_interface *C.ALLEGRO_MEMORY_INTERFACE)
Override the memory management functions with implementations of al_malloc_with_context, al_free_with_context, al_realloc_with_context and al_calloc_with_context. The context arguments may be used for debugging. The new functions should be thread safe.
See https://liballeg.org/a5docs/5.2.6/memory.html#al_set_memory_interface
func SetMouseAxis ¶
Set the given mouse axis to the given value.
See https://liballeg.org/a5docs/5.2.6/mouse.html#al_set_mouse_axis
func SetNewBitmapFlags ¶
func SetNewBitmapFlags(flags BitmapFlags)
Sets the flags to use for newly created bitmaps. Valid flags are:
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_set_new_bitmap_flags
func SetNewBitmapFormat ¶
func SetNewBitmapFormat(format PixelFormat)
Sets the pixel format (ALLEGRO_PIXEL_FORMAT) for newly created bitmaps. The default format is 0 and means the display driver will choose the best format.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_set_new_bitmap_format
func SetNewDisplayAdapter ¶
func SetNewDisplayAdapter(adapter int)
Sets the adapter to use for new displays created by the calling thread. The adapter has a monitor attached to it. Information about the monitor can be gotten using al_get_num_video_adapters and al_get_monitor_info.
See https://liballeg.org/a5docs/5.2.6/monitor.html#al_set_new_display_adapter
func SetNewDisplayFlags ¶
func SetNewDisplayFlags(flags DisplayFlags)
Sets various flags to be used when creating new displays on the calling thread. flags is a bitfield containing any reasonable combination of the following:
See https://liballeg.org/a5docs/5.2.6/display.html#al_set_new_display_flags
func SetNewDisplayOption ¶
func SetNewDisplayOption(option DisplayOption, value int, im Importance)
Set an extra display option, to be used when creating new displays on the calling thread. Display options differ from display flags, and specify some details of the context to be created within the window itself. These mainly have no effect on Allegro itself, but you may want to specify them, for example if you want to use multisampling.
See https://liballeg.org/a5docs/5.2.6/display.html#al_set_new_display_option
func SetNewDisplayRefreshRate ¶
func SetNewDisplayRefreshRate(rate int)
Sets the refresh rate to use when creating new displays on the calling thread. If the refresh rate is not available, al_create_display will fail. A list of modes with refresh rates can be found with al_get_num_display_modes and al_get_display_mode.
See https://liballeg.org/a5docs/5.2.6/display.html#al_set_new_display_refresh_rate
func SetNewWindowPosition ¶
func SetNewWindowPosition(x, y int)
Sets where the top left pixel of the client area of newly created windows (non-fullscreen) will be on screen, for displays created by the calling thread. Negative values are allowed on some multihead systems.
See https://liballeg.org/a5docs/5.2.6/display.html#al_set_new_window_position
func SetNewWindowTitle ¶
func SetNewWindowTitle(title string)
Set the title that will be used when a new display is created. Allegro uses a static buffer of ALLEGRO_NEW_WINDOW_TITLE_MAX_SIZE to store this, so the length of the titme you set must be less than this.
See https://liballeg.org/a5docs/5.2.6/display.html#al_set_new_window_title
func SetOrgName ¶
func SetOrgName(name string)
Sets the global organization name.
See https://liballeg.org/a5docs/5.2.6/system.html#al_set_org_name
func SetSeparateBlender ¶
func SetSeparateBlender(op BlendingOperation, src, dst BlendingValue, alpha_op BlendingOperation, alpha_src, alpha_dst BlendingValue)
Like al_set_blender, but allows specifying a separate blending operation for the alpha channel. This is useful if your target bitmap also has an alpha channel and the two alpha channels need to be combined in a different way than the color components.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_set_separate_blender
func SetTargetBackbuffer ¶
func SetTargetBackbuffer(d *Display)
Same as al_set_target_bitmap(al_get_backbuffer(display));
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_set_target_backbuffer
func SetTargetBitmap ¶
func SetTargetBitmap(bmp *Bitmap)
This function selects the bitmap to which all subsequent drawing operations in the calling thread will draw to. To return to drawing to a display, set the backbuffer of the display as the target bitmap, using al_get_backbuffer. As a convenience, you may also use al_set_target_backbuffer.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_set_target_bitmap
func Time ¶
func Time() float64
Return the number of seconds since the Allegro library was initialised. The return value is undefined if Allegro is uninitialised. The resolution depends on the used driver, but typically can be in the order of microseconds.
func UngrabMouse ¶
func UngrabMouse() error
Stop confining the mouse cursor to any display belonging to the program.
See https://liballeg.org/a5docs/5.2.6/mouse.html#al_ungrab_mouse
func UninstallJoystick ¶
func UninstallJoystick()
Uninstalls the active joystick driver. All outstanding ALLEGRO_JOYSTICK structures are invalidated. If no joystick driver was active, this function does nothing.
See https://liballeg.org/a5docs/5.2.6/joystick.html#al_uninstall_joystick
func UninstallKeyboard ¶
func UninstallKeyboard()
Uninstalls the active keyboard driver, if any. This will automatically unregister the keyboard event source with any event queues.
See https://liballeg.org/a5docs/5.2.6/keyboard.html#al_uninstall_keyboard
func UninstallMouse ¶
func UninstallMouse()
Uninstalls the active mouse driver, if any. This will automatically unregister the mouse event source with any event queues.
See https://liballeg.org/a5docs/5.2.6/mouse.html#al_uninstall_mouse
func UpdateDisplayRegion ¶
func UpdateDisplayRegion(x, y, width, height int)
Does the same as al_flip_display, but tries to update only the specified region. With many drivers this is not possible, but for some it can improve performance. If this is not supported, this function falls back to the behavior of al_flip_display. You can query the support for this function using al_get_display_option(display, ALLEGRO_UPDATE_DISPLAY_REGION).
See https://liballeg.org/a5docs/5.2.6/display.html#al_update_display_region
func UseTransform ¶
func UseTransform(trans *Transform)
Sets the transformation to be used for the the drawing operations on the target bitmap (each bitmap maintains its own transformation). Every drawing operation after this call will be transformed using this transformation. Call this function with an identity transformation to return to the default behaviour.
See https://liballeg.org/a5docs/5.2.6/transformations.html#al_use_transform
func Version ¶
func Version() (major, minor, revision, release uint8)
Returns the (compiled) version of the Allegro library, packed into a single integer as groups of 8 bits in the form (major << 24) | (minor << 16) | (revision << 8) | release.
See https://liballeg.org/a5docs/5.2.6/system.html#al_get_allegro_version
func WaitForVSync ¶
func WaitForVSync() error
Wait for the beginning of a vertical retrace. Some driver/card/monitor combinations may not be capable of this.
See https://liballeg.org/a5docs/5.2.6/display.html#al_wait_for_vsync
Types ¶
type AudioStreamFinished ¶
type AudioStreamFinished interface {
// contains filtered or unexported methods
}
type AudioStreamFragment ¶
type AudioStreamFragment interface {
// contains filtered or unexported methods
}
type Bitmap ¶
type Bitmap C.ALLEGRO_BITMAP
func CreateBitmap ¶
Creates a new bitmap using the bitmap format and flags for the current thread. Blitting between bitmaps of differing formats, or blitting between memory bitmaps and display bitmaps may be slow.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_create_bitmap
func ImageToBitmap ¶
ImageToBitmap() converts any image.Image to an Allegro bitmap.
This method is experimental and hasn't been tested nor optimized.
func LoadBitmap ¶
Loads an image file into a new ALLEGRO_BITMAP. The file type is determined by the extension, except if the file has no extension in which case al_identify_bitmap is used instead.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_load_bitmap
func LoadBitmapFlags ¶
func LoadBitmapFlags(filename string, flags BitmapFlags) (*Bitmap, error)
Loads an image file into a new ALLEGRO_BITMAP. The file type is determined by the extension, except if the file has no extension in which case al_identify_bitmap is used instead.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_load_bitmap_flags
func TargetBitmap ¶
func TargetBitmap() *Bitmap
Return the target bitmap of the calling thread.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_target_bitmap
func (*Bitmap) AsTarget ¶
AsTarget() is a utility method for temporarily setting a bitmap as the target bitmap, running the provided function, and then undoing the change after the function exits. This is very useful for calling functions that operate on the target bitmap, e.g. the drawing methods provided by the primitives addon.
func (*Bitmap) BitmapFlags ¶
func (bmp *Bitmap) BitmapFlags() BitmapFlags
func (*Bitmap) BitmapFormat ¶
func (bmp *Bitmap) BitmapFormat() PixelFormat
func (*Bitmap) Clone ¶
Create a new bitmap with al_create_bitmap, and copy the pixel data from the old bitmap across. The newly created bitmap will be created with the current new bitmap flags, and not the ones that were used to create the original bitmap. If the new bitmap is a memory bitmap, its projection bitmap is reset to be orthographic.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_clone_bitmap
func (*Bitmap) Convert ¶
func (bmp *Bitmap) Convert()
Converts the bitmap to the current bitmap flags and format. The bitmap will be as if it was created anew with al_create_bitmap but retain its contents. All of this bitmap's sub-bitmaps are also converted. If the new bitmap type is memory, then the bitmap's projection bitmap is reset to be orthographic.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_convert_bitmap
func (*Bitmap) ConvertMaskToAlpha ¶
Convert the given mask color to an alpha channel in the bitmap. Can be used to convert older 4.2-style bitmaps with magic pink to alpha-ready bitmaps.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_convert_mask_to_alpha
func (*Bitmap) CreateSubBitmap ¶
Creates a sub-bitmap of the parent, at the specified coordinates and of the specified size. A sub-bitmap is a bitmap that shares drawing memory with a pre-existing (parent) bitmap, but possibly with a different size and clipping settings.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_create_sub_bitmap
func (*Bitmap) Destroy ¶
func (bmp *Bitmap) Destroy()
Destroys the given bitmap, freeing all resources used by it. This function does nothing if the bitmap argument is NULL.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_destroy_bitmap
func (*Bitmap) Draw ¶
Draws an unscaled, unrotated bitmap at the given position to the current target bitmap (see al_set_target_bitmap).
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_draw_bitmap
func (*Bitmap) DrawRegion ¶
Draws a region of the given bitmap to the target bitmap.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_draw_bitmap_region
func (*Bitmap) DrawRotated ¶
Draws a rotated version of the given bitmap to the target bitmap. The bitmap is rotated by 'angle' radians clockwise.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_draw_rotated_bitmap
func (*Bitmap) DrawScaled ¶
Draws a scaled version of the given bitmap to the target bitmap.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_draw_scaled_bitmap
func (*Bitmap) DrawScaledRotated ¶
func (bmp *Bitmap) DrawScaledRotated(cx, cy, dx, dy, xscale, yscale, angle float32, flags DrawFlags)
Like al_draw_rotated_bitmap, but can also scale the bitmap.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_draw_scaled_rotated_bitmap
func (*Bitmap) DrawTinted ¶
Like al_draw_bitmap but multiplies all colors in the bitmap with the given color. For example:
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_draw_tinted_bitmap
func (*Bitmap) DrawTintedRegion ¶
Like al_draw_bitmap_region but multiplies all colors in the bitmap with the given color.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_draw_tinted_bitmap_region
func (*Bitmap) DrawTintedRotated ¶
Like al_draw_rotated_bitmap but multiplies all colors in the bitmap with the given color.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_draw_tinted_rotated_bitmap
func (*Bitmap) DrawTintedScaled ¶
func (bmp *Bitmap) DrawTintedScaled(tint Color, sx, sy, sw, sh, dx, dy, dw, dh float32, flags DrawFlags)
Like al_draw_scaled_bitmap but multiplies all colors in the bitmap with the given color.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_draw_tinted_scaled_bitmap
func (*Bitmap) DrawTintedScaledRotated ¶
func (bmp *Bitmap) DrawTintedScaledRotated(tint Color, cx, cy, dx, dy, xscale, yscale, angle float32, flags DrawFlags)
Like al_draw_scaled_rotated_bitmap but multiplies all colors in the bitmap with the given color.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_draw_tinted_scaled_rotated_bitmap
func (*Bitmap) DrawTintedScaledRotatedRegion ¶
func (bmp *Bitmap) DrawTintedScaledRotatedRegion(sx, sy, sw, sh float32, tint Color, cx, cy, dx, dy, xscale, yscale, angle float32, flags DrawFlags)
Like al_draw_tinted_scaled_rotated_bitmap but you specify an area within the bitmap to be drawn.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_draw_tinted_scaled_rotated_bitmap_region
func (*Bitmap) Flags ¶
func (bmp *Bitmap) Flags() BitmapFlags
Return the flags used to create the bitmap.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_bitmap_flags
func (*Bitmap) Format ¶
func (bmp *Bitmap) Format() PixelFormat
Returns the pixel format of a bitmap.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_bitmap_format
func (*Bitmap) Height ¶
Returns the height of a bitmap in pixels.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_bitmap_height
func (*Bitmap) IsCompatible ¶
D3D and OpenGL allow sharing a texture in a way so it can be used for multiple windows. Each ALLEGRO_BITMAP created with al_create_bitmap however is usually tied to a single ALLEGRO_DISPLAY. This function can be used to know if the bitmap is compatible with the given display, even if it is a different display to the one it was created with. It returns true if the bitmap is compatible (things like a cached texture version can be used) and false otherwise (blitting in the current display will be slow).
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_is_compatible_bitmap
func (*Bitmap) IsLocked ¶
Returns whether or not a bitmap is already locked.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_is_bitmap_locked
func (*Bitmap) IsSubBitmap ¶
Returns true if the specified bitmap is a sub-bitmap, false otherwise.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_is_sub_bitmap
func (*Bitmap) Lock ¶
func (bmp *Bitmap) Lock(format PixelFormat, flags LockFlags) (*LockedRegion, error)
Lock an entire bitmap for reading or writing. If the bitmap is a display bitmap it will be updated from system memory after the bitmap is unlocked (unless locked read only). Returns NULL if the bitmap cannot be locked, e.g. the bitmap was locked previously and not unlocked. This function also returns NULL if the format is a compressed format.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_lock_bitmap
func (*Bitmap) LockBlocked ¶
func (bmp *Bitmap) LockBlocked(flags LockFlags) (*LockedRegion, error)
Like al_lock_bitmap, but allows locking bitmaps with a blocked pixel format (i.e. a format for which al_get_pixel_block_width or al_get_pixel_block_height do not return 1) in that format. To that end, this function also does not allow format conversion. For bitmap formats with a block size of 1, this function is identical to calling al_lock_bitmap(bmp, al_get_bitmap_format(bmp), flags).
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_lock_bitmap_blocked
func (*Bitmap) LockRegion ¶
func (bmp *Bitmap) LockRegion(x, y, width, height int, format PixelFormat, flags LockFlags) (*LockedRegion, error)
Like al_lock_bitmap, but only locks a specific area of the bitmap. If the bitmap is a video bitmap, only that area of the texture will be updated when it is unlocked. Locking only the region you indend to modify will be faster than locking the whole bitmap.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_lock_bitmap_region
func (*Bitmap) LockRegionBlocked ¶
func (bmp *Bitmap) LockRegionBlocked(x, y, width, height int, flags LockFlags) (*LockedRegion, error)
Like al_lock_bitmap_blocked, but allows locking a sub-region, for performance. Unlike al_lock_bitmap_region the region specified in terms of blocks and not pixels.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_lock_bitmap_region_blocked
func (*Bitmap) Parent ¶
Returns the bitmap this bitmap is a sub-bitmap of. Returns NULL if this bitmap is not a sub-bitmap. This function always returns the real bitmap, and never a sub-bitmap. This might NOT match what was passed to al_create_sub_bitmap. Consider this code, for instance:
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_parent_bitmap
func (*Bitmap) ParentBitmap ¶
func (*Bitmap) Pixel ¶
Get a pixel's color value from the specified bitmap. This operation is slow on non-memory bitmaps. Consider locking the bitmap if you are going to use this function multiple times on the same bitmap.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_pixel
func (*Bitmap) Reparent ¶
For a sub-bitmap, changes the parent, position and size. This is the same as destroying the bitmap and re-creating it with al_create_sub_bitmap - except the bitmap pointer stays the same. This has many uses, for example an animation player could return a single bitmap which can just be re-parented to different animation frames without having to re-draw the contents. Or a sprite atlas could re-arrange its sprites without having to invalidate all existing bitmaps.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_reparent_bitmap
func (*Bitmap) Save ¶
Saves an ALLEGRO_BITMAP to an image file. The file type is determined by the extension.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_save_bitmap
func (*Bitmap) Unlock ¶
func (bmp *Bitmap) Unlock()
Unlock a previously locked bitmap or bitmap region. If the bitmap is a video bitmap, the texture will be updated to match the system memory copy (unless it was locked read only).
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_unlock_bitmap
func (*Bitmap) WhileLocked ¶
func (bmp *Bitmap) WhileLocked(format PixelFormat, flags LockFlags, f func()) error
Convenience method for acting on a locked Bitmap, which will automatically be unlocked after the function completes.
func (*Bitmap) Width ¶
Returns the width of a bitmap in pixels.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_bitmap_width
func (*Bitmap) WithLockedTarget ¶
func (bmp *Bitmap) WithLockedTarget(format PixelFormat, flags LockFlags, f func()) error
func (*Bitmap) X ¶
For a sub-bitmap, return it's x position within the parent.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_bitmap_x
func (*Bitmap) Y ¶
For a sub-bitmap, return it's y position within the parent.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_bitmap_y
type BitmapFlags ¶
type BitmapFlags int
func NewBitmapFlags ¶
func NewBitmapFlags() BitmapFlags
Returns the flags used for newly created bitmaps.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_new_bitmap_flags
type BlendingOperation ¶
type BlendingOperation int
type BlendingValue ¶
type BlendingValue int
type Color ¶
type Color C.ALLEGRO_COLOR
func BlendColor ¶
func BlendColor() Color
Returns the color currently used for constant color blending (white by default).
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_blend_color
func MapRGB ¶
Convert r, g, b (ranging from 0-255) into an ALLEGRO_COLOR, using 255 for alpha.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_map_rgb
func MapRGBA ¶
Convert r, g, b, a (ranging from 0-255) into an ALLEGRO_COLOR.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_map_rgba
func MapRGBAf ¶
Convert r, g, b, a (ranging from 0.0f-1.0f) into an ALLEGRO_COLOR.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_map_rgba_f
func MapRGBf ¶
Convert r, g, b, (ranging from 0.0f-1.0f) into an ALLEGRO_COLOR, using 1.0f for alpha.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_map_rgb_f
func NewColor ¶
NewColor converts a Go image.Color to an Allegro color value. If the parameter is itself an Allegro color value, then it is cast and returned; otherwise, a new value is constructed using MapRGBAf.
func (Color) UnmapRGB ¶
Retrieves components of an ALLEGRO_COLOR, ignoring alpha. Components will range from 0-255.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_unmap_rgb
func (Color) UnmapRGBA ¶
Retrieves components of an ALLEGRO_COLOR. Components will range from 0-255.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_unmap_rgba
func (Color) UnmapRGBAf ¶
Retrieves components of an ALLEGRO_COLOR. Components will range from 0.0f-1.0f.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_unmap_rgba_f
type Config ¶
type Config C.ALLEGRO_CONFIG
func CreateConfig ¶
func CreateConfig() *Config
Create an empty configuration structure.
See https://liballeg.org/a5docs/5.2.6/config.html#al_create_config
func LoadConfig ¶
Read a configuration file from disk. Returns NULL on error. The configuration structure should be destroyed with al_destroy_config.
See https://liballeg.org/a5docs/5.2.6/config.html#al_load_config_file
func MergeConfig ¶
Merge two configuration structures, and return the result as a new configuration. Values in configuration 'cfg2' override those in 'cfg1'. Neither of the input configuration structures are modified. Comments from 'cfg2' are not retained.
See https://liballeg.org/a5docs/5.2.6/config.html#al_merge_config
func SystemConfig ¶
Returns the system configuration structure. The returned configuration should not be destroyed with al_destroy_config. This is mainly used for configuring Allegro and its addons. You may populate this configuration before Allegro is installed to control things like the logging levels and other features.
See https://liballeg.org/a5docs/5.2.6/system.html#al_get_system_config
func (*Config) AddComment ¶
Add a comment in a section of a configuration. If the section doesn't yet exist, it will be created. The section can be NULL or "" for the global section.
See https://liballeg.org/a5docs/5.2.6/config.html#al_add_config_comment
func (*Config) AddSection ¶
Add a section to a configuration structure with the given name. If the section already exists then nothing happens.
See https://liballeg.org/a5docs/5.2.6/config.html#al_add_config_section
func (*Config) Destroy ¶
func (cfg *Config) Destroy()
Free the resources used by a configuration structure. Does nothing if passed NULL.
See https://liballeg.org/a5docs/5.2.6/config.html#al_destroy_config
func (*Config) Entries ¶
Entries() returns a read-only channel of entries in the config file. This makes it easy to iterate over them like so:
for entry := range cfg.Entries("Section Title") { // do stuff }
func (*Config) FirstConfigEntry ¶
func (cfg *Config) FirstConfigEntry(section string) (string, *ConfigEntryIterator, error)
Returns the name of the first key in the given section in the given config or NULL if the section is empty. The iterator works like the one for al_get_first_config_section.
See https://liballeg.org/a5docs/5.2.6/config.html#al_get_first_config_entry
func (*Config) FirstConfigSection ¶
func (cfg *Config) FirstConfigSection() (string, *ConfigSectionIterator)
Returns the name of the first section in the given config file. Usually this will return an empty string for the global section, even it contains no values. The iterator parameter will receive an opaque iterator which is used by al_get_next_config_section to iterate over the remaining sections.
See https://liballeg.org/a5docs/5.2.6/config.html#al_get_first_config_section
func (*Config) Merge ¶
Merge one configuration structure into another. Values in configuration 'add' override those in 'master'. 'master' is modified. Comments from 'add' are not retained.
See https://liballeg.org/a5docs/5.2.6/config.html#al_merge_config_into
func (*Config) NextConfigEntry ¶
func (cfg *Config) NextConfigEntry(iter *ConfigEntryIterator) (string, error)
Returns the next key for the iterator obtained by al_get_first_config_entry. The iterator works like the one for al_get_next_config_section.
See https://liballeg.org/a5docs/5.2.6/config.html#al_get_next_config_entry
func (*Config) NextConfigSection ¶
func (cfg *Config) NextConfigSection(iter *ConfigSectionIterator) (string, error)
Returns the name of the next section in the given config file or NULL if there are no more sections. The iterator must have been obtained with al_get_first_config_section first.
See https://liballeg.org/a5docs/5.2.6/config.html#al_get_next_config_section
func (*Config) RemoveKey ¶
Remove a key and its associated value in a section of a configuration.
See https://liballeg.org/a5docs/5.2.6/config.html#al_remove_config_key
func (*Config) RemoveSection ¶
Remove a section of a configuration.
See https://liballeg.org/a5docs/5.2.6/config.html#al_remove_config_section
func (*Config) Save ¶
Write out a configuration file to disk. Returns true on success, false on error.
See https://liballeg.org/a5docs/5.2.6/config.html#al_save_config_file
func (*Config) Sections ¶
Sections() returns a read-only channel of sections in the config file. This makes it easy to iterate over them like so:
for section := range cfg.Sections() { // do stuff }
func (*Config) SetValue ¶
Set a value in a section of a configuration. If the section doesn't yet exist, it will be created. If a value already existed for the given key, it will be overwritten. The section can be NULL or "" for the global section.
See https://liballeg.org/a5docs/5.2.6/config.html#al_set_config_value
func (*Config) Value ¶
Gets a pointer to an internal character buffer that will only remain valid as long as the ALLEGRO_CONFIG structure is not destroyed. Copy the value if you need a copy. The section can be NULL or "" for the global section. Returns NULL if the section or key do not exist.
See https://liballeg.org/a5docs/5.2.6/config.html#al_get_config_value
type ConfigEntryIterator ¶
type ConfigEntryIterator (*C.ALLEGRO_CONFIG_ENTRY)
type ConfigSectionIterator ¶
type ConfigSectionIterator (*C.ALLEGRO_CONFIG_SECTION)
type Display ¶
type Display C.ALLEGRO_DISPLAY
func CreateDisplay ¶
Create a display, or window, with the specified dimensions. The parameters of the display are determined by the last calls to al_set_new_display_*. Default parameters are used if none are set explicitly. Creating a new display will automatically make it the active one, with the backbuffer selected for drawing.
See https://liballeg.org/a5docs/5.2.6/display.html#al_create_display
func CurrentDisplay ¶
func CurrentDisplay() *Display
Return the display that is "current" for the calling thread, or NULL if there is none.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_current_display
func (*Display) AcknowledgeResize ¶
When the user receives a resize event from a resizable display, if they wish the display to be resized they must call this function to let the graphics driver know that it can now resize the display. Returns true on success.
See https://liballeg.org/a5docs/5.2.6/display.html#al_acknowledge_resize
func (*Display) Backbuffer ¶
Return a special bitmap representing the back-buffer of the display.
See https://liballeg.org/a5docs/5.2.6/display.html#al_get_backbuffer
func (*Display) ClipboardHasText ¶
This function returns true if and only if the clipboard has text available.
See https://liballeg.org/a5docs/5.2.6/display.html#al_clipboard_has_text
func (*Display) ClipboardText ¶
This function returns a pointer to a string, allocated with al_malloc with the text contents of the clipboard if available. If no text is available on the clipboard then this function returns NULL. You must call al_free on the returned pointer when you don't need it anymore.
See https://liballeg.org/a5docs/5.2.6/display.html#al_get_clipboard_text
func (*Display) Destroy ¶
func (d *Display) Destroy()
Destroy a display.
See https://liballeg.org/a5docs/5.2.6/display.html#al_destroy_display
func (*Display) DisplayFormat ¶
func (d *Display) DisplayFormat() PixelFormat
Gets the pixel format of the display.
See https://liballeg.org/a5docs/5.2.6/display.html#al_get_display_format
func (*Display) DisplayOption ¶
func (d *Display) DisplayOption(option DisplayOption) int
Return an extra display setting of the display.
See https://liballeg.org/a5docs/5.2.6/display.html#al_get_display_option
func (*Display) EventSource ¶
func (d *Display) EventSource() *EventSource
Retrieve the associated event source. See the documentation on events for a list of the events displays will generate.
See https://liballeg.org/a5docs/5.2.6/display.html#al_get_display_event_source
func (*Display) GrabMouse ¶
Confine the mouse cursor to the given display. The mouse cursor can only be confined to one display at a time.
See https://liballeg.org/a5docs/5.2.6/mouse.html#al_grab_mouse
func (*Display) Height ¶
Gets the height of the display. This is like SCREEN_H in Allegro 4.x.
See https://liballeg.org/a5docs/5.2.6/display.html#al_get_display_height
func (*Display) HideMouseCursor ¶
Hide the mouse cursor in the given display. This has no effect on what the current mouse cursor looks like; it just makes it disappear.
See https://liballeg.org/a5docs/5.2.6/mouse.html#al_hide_mouse_cursor
func (*Display) RefreshRate ¶
Gets the refresh rate of the display.
See https://liballeg.org/a5docs/5.2.6/display.html#al_get_display_refresh_rate
func (*Display) Resize ¶
Resize the display. Returns true on success, or false on error. This works on both fullscreen and windowed displays, regardless of the ALLEGRO_RESIZABLE flag.
See https://liballeg.org/a5docs/5.2.6/display.html#al_resize_display
func (*Display) SetClipboardText ¶
This function pastes the text given as an argument to the clipboard.
See https://liballeg.org/a5docs/5.2.6/display.html#al_set_clipboard_text
func (*Display) SetDisplayFlag ¶
func (d *Display) SetDisplayFlag(flags DisplayFlags, onoff bool) error
Enable or disable one of the display flags. The flags are the same as for al_set_new_display_flags. The only flags that can be changed after creation are:
See https://liballeg.org/a5docs/5.2.6/display.html#al_set_display_flag
func (*Display) SetDisplayIcon ¶
Changes the icon associated with the display (window). Same as al_set_display_icons with one icon.
See https://liballeg.org/a5docs/5.2.6/display.html#al_set_display_icon
func (*Display) SetDisplayIcons ¶
Changes the icons associated with the display (window). Multiple icons can be provided for use in different contexts, e.g. window frame, taskbar, alt-tab popup. The number of icons must be at least one.
See https://liballeg.org/a5docs/5.2.6/display.html#al_set_display_icons
func (*Display) SetMouseCursor ¶
func (d *Display) SetMouseCursor(cursor *MouseCursor) error
Set the given mouse cursor to be the current mouse cursor for the given display.
See https://liballeg.org/a5docs/5.2.6/mouse.html#al_set_mouse_cursor
func (*Display) SetMouseXY ¶
Try to position the mouse at the given coordinates on the given display. The mouse movement resulting from a successful move will generate an ALLEGRO_EVENT_MOUSE_WARPED event.
See https://liballeg.org/a5docs/5.2.6/mouse.html#al_set_mouse_xy
func (*Display) SetSystemMouseCursor ¶
func (d *Display) SetSystemMouseCursor(cursor SystemMouseCursor) error
Set the given system mouse cursor to be the current mouse cursor for the given display. If the cursor is currently 'shown' (as opposed to 'hidden') the change is immediately visible.
See https://liballeg.org/a5docs/5.2.6/mouse.html#al_set_system_mouse_cursor
func (*Display) SetWindowPosition ¶
Sets the position on screen of a non-fullscreen display.
See https://liballeg.org/a5docs/5.2.6/display.html#al_set_window_position
func (*Display) SetWindowTitle ¶
Set the title on a display.
See https://liballeg.org/a5docs/5.2.6/display.html#al_set_window_title
func (*Display) ShowMouseCursor ¶
Make a mouse cursor visible in the given display.
See https://liballeg.org/a5docs/5.2.6/mouse.html#al_show_mouse_cursor
func (*Display) Width ¶
Gets the width of the display. This is like SCREEN_W in Allegro 4.x.
See https://liballeg.org/a5docs/5.2.6/display.html#al_get_display_width
func (*Display) WindowPosition ¶
Gets the position of a non-fullscreen display.
See https://liballeg.org/a5docs/5.2.6/display.html#al_get_window_position
type DisplayCloseEvent ¶
type DisplayExposeEvent ¶
type DisplayFlags ¶
type DisplayFlags int
func NewDisplayFlags ¶
func NewDisplayFlags() DisplayFlags
Get the display flags to be used when creating new displays on the calling thread.
See https://liballeg.org/a5docs/5.2.6/display.html#al_get_new_display_flags
type DisplayFoundEvent ¶
type DisplayLostEvent ¶
type DisplayMode ¶
type DisplayMode C.struct_ALLEGRO_DISPLAY_MODE
func GetDisplayMode ¶
func GetDisplayMode(index int) (*DisplayMode, error)
Retrieves a fullscreen mode. Display parameters should not be changed between a call of al_get_num_display_modes and al_get_display_mode. index must be between 0 and the number returned from al_get_num_display_modes-1. mode must be an allocated ALLEGRO_DISPLAY_MODE structure. This function will return NULL on failure, and the mode parameter that was passed in on success.
See https://liballeg.org/a5docs/5.2.6/fullscreen_mode.html#al_get_display_mode
func (*DisplayMode) RefreshRate ¶
func (m *DisplayMode) RefreshRate() int
Refresh rate. May be 0 if unknown.
type DisplayOption ¶
type DisplayOrientation ¶
type DisplayOrientationEvent ¶
type DisplayOrientationEvent interface { Timestamp() float64 Source() *Display Orientation() DisplayOrientation // contains filtered or unexported methods }
type DisplayResizeEvent ¶
type DisplaySwitchInEvent ¶
type DisplaySwitchOutEvent ¶
type Event ¶
type Event C.union_ALLEGRO_EVENT
type EventGenerator ¶
type EventGenerator interface {
EventSource() *EventSource
}
EventGenerator represents anything that can be registered with an event queue.
type EventQueue ¶
type EventQueue C.ALLEGRO_EVENT_QUEUE
func CreateEventQueue ¶
func CreateEventQueue() (*EventQueue, error)
Create a new, empty event queue, returning a pointer to the newly created object if successful. Returns NULL on error.
See https://liballeg.org/a5docs/5.2.6/events.html#al_create_event_queue
func (*EventQueue) Destroy ¶
func (queue *EventQueue) Destroy()
Destroy the event queue specified. All event sources currently registered with the queue will be automatically unregistered before the queue is destroyed.
See https://liballeg.org/a5docs/5.2.6/events.html#al_destroy_event_queue
func (*EventQueue) DropNextEvent ¶
func (queue *EventQueue) DropNextEvent() bool
Drop (remove) the next event from the queue. If the queue is empty, nothing happens. Returns true if an event was dropped.
See https://liballeg.org/a5docs/5.2.6/events.html#al_drop_next_event
func (*EventQueue) Flush ¶
func (queue *EventQueue) Flush()
Drops all events, if any, from the queue.
See https://liballeg.org/a5docs/5.2.6/events.html#al_flush_event_queue
func (*EventQueue) GetNextEvent ¶
func (queue *EventQueue) GetNextEvent(event *Event) (interface{}, error)
Take the next event out of the event queue specified, and copy the contents into ret_event, returning true. The original event will be removed from the queue. If the event queue is empty, return false and the contents of ret_event are unspecified.
See https://liballeg.org/a5docs/5.2.6/events.html#al_get_next_event
func (*EventQueue) IsEmpty ¶
func (queue *EventQueue) IsEmpty() bool
Return true if the event queue specified is currently empty.
See https://liballeg.org/a5docs/5.2.6/events.html#al_is_event_queue_empty
func (*EventQueue) PeekNextEvent ¶
func (queue *EventQueue) PeekNextEvent(event *Event) (interface{}, error)
Copy the contents of the next event in the event queue specified into ret_event and return true. The original event packet will remain at the head of the queue. If the event queue is actually empty, this function returns false and the contents of ret_event are unspecified.
See https://liballeg.org/a5docs/5.2.6/events.html#al_peek_next_event
func (*EventQueue) Register ¶
func (queue *EventQueue) Register(obs ...EventGenerator)
Shorthand method for registering anything with an EventSource() method.
func (*EventQueue) RegisterEventSource ¶
func (queue *EventQueue) RegisterEventSource(source *EventSource)
Register the event source with the event queue specified. An event source may be registered with any number of event queues simultaneously, or none. Trying to register an event source with the same event queue more than once does nothing.
See https://liballeg.org/a5docs/5.2.6/events.html#al_register_event_source
func (*EventQueue) Unregister ¶
func (queue *EventQueue) Unregister(ob EventGenerator)
Shorthand method for registering anything with an EventSource() method.
func (*EventQueue) UnregisterEventSource ¶
func (queue *EventQueue) UnregisterEventSource(source *EventSource)
Unregister an event source with an event queue. If the event source is not actually registered with the event queue, nothing happens.
See https://liballeg.org/a5docs/5.2.6/events.html#al_unregister_event_source
func (*EventQueue) WaitForEvent ¶
func (queue *EventQueue) WaitForEvent(event *Event) interface{}
Wait until the event queue specified is non-empty. If ret_event is not NULL, the first event in the queue will be copied into ret_event and removed from the queue. If ret_event is NULL the first event is left at the head of the queue.
See https://liballeg.org/a5docs/5.2.6/events.html#al_wait_for_event
func (*EventQueue) WaitForEventTimed ¶
func (queue *EventQueue) WaitForEventTimed(event *Event, secs float32) (interface{}, bool)
Wait until the event queue specified is non-empty. If ret_event is not NULL, the first event in the queue will be copied into ret_event and removed from the queue. If ret_event is NULL the first event is left at the head of the queue.
See https://liballeg.org/a5docs/5.2.6/events.html#al_wait_for_event_timed
func (*EventQueue) WaitForEventUntil ¶
func (queue *EventQueue) WaitForEventUntil(timeout *Timeout, event *Event) (interface{}, bool)
Wait until the event queue specified is non-empty. If ret_event is not NULL, the first event in the queue will be copied into ret_event and removed from the queue. If ret_event is NULL the first event is left at the head of the queue.
See https://liballeg.org/a5docs/5.2.6/events.html#al_wait_for_event_until
type EventSource ¶
type EventSource C.ALLEGRO_EVENT_SOURCE
func JoystickEventSource ¶
func JoystickEventSource() *EventSource
Returns the global joystick event source. All joystick events are generated by this event source.
See https://liballeg.org/a5docs/5.2.6/joystick.html#al_get_joystick_event_source
func KeyboardEventSource ¶
func KeyboardEventSource() (*EventSource, error)
Retrieve the keyboard event source. All keyboard events are generated by this event source.
See https://liballeg.org/a5docs/5.2.6/keyboard.html#al_get_keyboard_event_source
func MouseEventSource ¶
func MouseEventSource() (*EventSource, error)
Retrieve the mouse event source. All mouse events are generated by this event source.
See https://liballeg.org/a5docs/5.2.6/mouse.html#al_get_mouse_event_source
func (*EventSource) Data ¶
func (source *EventSource) Data() uintptr
Returns the abstract user data associated with the event source. If no data was previously set, returns NULL.
See https://liballeg.org/a5docs/5.2.6/events.html#al_get_event_source_data
func (*EventSource) DestroyUserEventSource ¶
func (source *EventSource) DestroyUserEventSource()
Destroy an event source initialised with al_init_user_event_source.
See https://liballeg.org/a5docs/5.2.6/events.html#al_destroy_user_event_source
func (*EventSource) EmitUserEvent ¶
func (source *EventSource) EmitUserEvent(data ...uintptr) error
Emit an event from a user event source. The event source must have been initialised with al_init_user_event_source. Returns false if the event source isn't registered with any queues, hence the event wouldn't have been delivered into any queues.
See https://liballeg.org/a5docs/5.2.6/events.html#al_emit_user_event
func (EventSource) InitUserEventSource ¶
func (source EventSource) InitUserEventSource()
Initialise an event source for emitting user events. The space for the event source must already have been allocated.
See https://liballeg.org/a5docs/5.2.6/events.html#al_init_user_event_source
func (*EventSource) SetData ¶
func (source *EventSource) SetData(data uintptr)
Assign the abstract user data to the event source. Allegro does not use the data internally for anything; it is simply meant as a convenient way to associate your own data or objects with events.
See https://liballeg.org/a5docs/5.2.6/events.html#al_set_event_source_data
type File ¶
type File C.ALLEGRO_FILE
func OpenFile ¶
Creates and opens a file (real or virtual) given the path and mode. The current file interface is used to open the file.
func (*File) ClearError ¶
func (f *File) ClearError()
Clear the error indicator for the given file.
See https://liballeg.org/a5docs/5.2.6/file.html#al_fclearerr
func (*File) Eof ¶
Returns true if the end-of-file indicator has been set on the file, i.e. we have attempted to read past the end of the file.
func (*File) Getc ¶
Read and return next byte in the given file. Returns EOF on end of file or if an error occurred.
func (*File) HasError ¶
Returns non-zero if the error indicator is set on the given file, i.e. there was some sort of previous error. The error code may be system or file interface specific.
func (*File) LoadBitmap ¶
Loads an image from an ALLEGRO_FILE stream into a new ALLEGRO_BITMAP. The file type is determined by the passed 'ident' parameter, which is a file name extension including the leading dot. If (and only if) 'ident' is NULL, the file type is determined with al_identify_bitmap_f instead.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_load_bitmap_f
func (*File) LoadBitmapFlags ¶
func (f *File) LoadBitmapFlags(ident string, flags BitmapFlags) (*Bitmap, error)
Loads an image from an ALLEGRO_FILE stream into a new ALLEGRO_BITMAP. The file type is determined by the passed 'ident' parameter, which is a file name extension including the leading dot. If (and only if) 'ident' is NULL, the file type is determined with al_identify_bitmap_f instead.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_load_bitmap_flags_f
func (*File) LoadConfig ¶
Read a configuration file from an already open file.
See https://liballeg.org/a5docs/5.2.6/config.html#al_load_config_file_f
func (*File) Putc ¶
Write a single byte to the given file. The byte written is the value of c cast to an unsigned char.
func (*File) SaveBitmap ¶
Saves an ALLEGRO_BITMAP to an ALLEGRO_FILE stream. The file type is determined by the passed 'ident' parameter, which is a file name extension including the leading dot.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_save_bitmap_f
func (*File) SaveConfig ¶
Write out a configuration file to an already open file.
See https://liballeg.org/a5docs/5.2.6/config.html#al_save_config_file_f
func (*File) Seek ¶
Set the current position of the given file to a position relative to that specified by 'whence', plus 'offset' number of bytes.
func (*File) Slice ¶
Opens a slice (subset) of an already open random access file as if it were a stand alone file. While the slice is open, the parent file handle must not be used in any way.
See https://liballeg.org/a5docs/5.2.6/file.html#al_fopen_slice
func (*File) Tell ¶
Returns the current position in the given file, or -1 on error. errno is set to indicate the error.
type Importance ¶
func NewDisplayOption ¶
func NewDisplayOption(option DisplayOption) (int, Importance)
Retrieve an extra display setting which was previously set with al_set_new_display_option.
See https://liballeg.org/a5docs/5.2.6/display.html#al_get_new_display_option
type JoyFlags ¶
type JoyFlags int
const ( JOYFLAG_DIGITAL JoyFlags = C.ALLEGRO_JOYFLAG_DIGITAL JOYFLAG_ANALOGUE = C.ALLEGRO_JOYFLAG_ANALOGUE )
type Joystick ¶
type Joystick C.ALLEGRO_JOYSTICK
func GetJoystick ¶
Get a handle for a joystick on the system. The number may be from 0 to al_get_num_joysticks-1. If successful a pointer to a joystick object is returned, which represents a physical device. Otherwise NULL is returned.
See https://liballeg.org/a5docs/5.2.6/joystick.html#al_get_joystick
func (*Joystick) Active ¶
Return if the joystick handle is "active", i.e. in the current configuration, the handle represents some physical device plugged into the system. al_get_joystick returns active handles. After reconfiguration, active handles may become inactive, and vice versa.
See https://liballeg.org/a5docs/5.2.6/joystick.html#al_get_joystick_active
func (*Joystick) AxisName ¶
Return the name of the given axis. If the axis doesn't exist, NULL is returned. Indices begin from 0.
See https://liballeg.org/a5docs/5.2.6/joystick.html#al_get_joystick_axis_name
func (*Joystick) ButtonName ¶
Return the name of the given button. If the button doesn't exist, NULL is returned. Indices begin from 0.
See https://liballeg.org/a5docs/5.2.6/joystick.html#al_get_joystick_button_name
func (*Joystick) Name ¶
Return the name of the given joystick.
See https://liballeg.org/a5docs/5.2.6/joystick.html#al_get_joystick_name
func (*Joystick) NumAxes ¶
Return the number of axes on the given "stick". If the stick doesn't exist, 0 is returned.
See https://liballeg.org/a5docs/5.2.6/joystick.html#al_get_joystick_num_axes
func (*Joystick) NumButtons ¶
Return the number of buttons on the joystick.
See https://liballeg.org/a5docs/5.2.6/joystick.html#al_get_joystick_num_buttons
func (*Joystick) NumSticks ¶
Return the number of "sticks" on the given joystick. A stick has one or more axes.
See https://liballeg.org/a5docs/5.2.6/joystick.html#al_get_joystick_num_sticks
func (*Joystick) Release ¶
func (j *Joystick) Release()
This function currently does nothing.
See https://liballeg.org/a5docs/5.2.6/joystick.html#al_release_joystick
func (*Joystick) State ¶
func (j *Joystick) State() *JoystickState
func (*Joystick) StickFlags ¶
Return the flags of the given "stick". If the stick doesn't exist, NULL is returned. Indices begin from 0.
See https://liballeg.org/a5docs/5.2.6/joystick.html#al_get_joystick_stick_flags
type JoystickAxisEvent ¶
type JoystickButtonDownEvent ¶
type JoystickButtonUpEvent ¶
type JoystickConfigurationEvent ¶
type JoystickConfigurationEvent interface { Timestamp() float64 // contains filtered or unexported methods }
type JoystickState ¶
type JoystickState struct { Stick []stickState Button []int // contains filtered or unexported fields }
func (*JoystickState) Get ¶
func (state *JoystickState) Get()
Get the current joystick state.
See https://liballeg.org/a5docs/5.2.6/joystick.html#al_get_joystick_state
type KeyCharEvent ¶
type KeyCode ¶
type KeyCode int
{{{ key codes
func (KeyCode) Name ¶
Converts the given keycode to a description of the key.
See https://liballeg.org/a5docs/5.2.6/keyboard.html#al_keycode_to_name
type KeyDownEvent ¶
type KeyUpEvent ¶
type Keyboard ¶
type Keyboard C.ALLEGRO_KEYBOARD
type KeyboardState ¶
type KeyboardState C.ALLEGRO_KEYBOARD_STATE
func (*KeyboardState) Get ¶
func (state *KeyboardState) Get()
Save the state of the keyboard specified at the time the function is called into the structure pointed to by ret_state.
See https://liballeg.org/a5docs/5.2.6/keyboard.html#al_get_keyboard_state
func (*KeyboardState) IsDown ¶
func (state *KeyboardState) IsDown(key KeyCode) bool
Return true if the key specified was held down in the state specified.
See https://liballeg.org/a5docs/5.2.6/keyboard.html#al_key_down
type LockedRegion ¶
type LockedRegion C.struct_ALLEGRO_LOCKED_REGION
func (*LockedRegion) Data ¶
func (reg *LockedRegion) Data() uintptr
func (*LockedRegion) Format ¶
func (reg *LockedRegion) Format() PixelFormat
func (*LockedRegion) Pitch ¶
func (reg *LockedRegion) Pitch() int
func (*LockedRegion) PixelSize ¶
func (reg *LockedRegion) PixelSize() int
type MonitorInfo ¶
type MonitorInfo C.struct_ALLEGRO_MONITOR_INFO
func GetMonitorInfo ¶
func GetMonitorInfo(adapter int) (*MonitorInfo, error)
Get information about a monitor's position on the desktop. adapter is a number from 0 to al_get_num_video_adapters()-1.
See https://liballeg.org/a5docs/5.2.6/monitor.html#al_get_monitor_info
func (*MonitorInfo) Height ¶
func (m *MonitorInfo) Height() int
func (*MonitorInfo) IsPrimary ¶
func (m *MonitorInfo) IsPrimary() bool
Convenience method for testing whether or not this is the primary monitor. Returns true iff x1 and y1 are both 0.
func (*MonitorInfo) Width ¶
func (m *MonitorInfo) Width() int
func (*MonitorInfo) X1 ¶
func (m *MonitorInfo) X1() int
func (*MonitorInfo) X2 ¶
func (m *MonitorInfo) X2() int
func (*MonitorInfo) Y1 ¶
func (m *MonitorInfo) Y1() int
func (*MonitorInfo) Y2 ¶
func (m *MonitorInfo) Y2() int
type MouseAxesEvent ¶
type MouseButtonDownEvent ¶
type MouseButtonUpEvent ¶
type MouseCursor ¶
type MouseCursor C.ALLEGRO_MOUSE_CURSOR
func CreateMouseCursor ¶
func CreateMouseCursor(bmp *Bitmap, x_focus, y_focus int) (*MouseCursor, error)
Create a mouse cursor from the bitmap provided. x_focus and y_focus describe the bit of the cursor that will represent the actual mouse position.
See https://liballeg.org/a5docs/5.2.6/mouse.html#al_create_mouse_cursor
func (*MouseCursor) Destroy ¶
func (cursor *MouseCursor) Destroy()
Free the memory used by the given cursor.
See https://liballeg.org/a5docs/5.2.6/mouse.html#al_destroy_mouse_cursor
type MouseEnterDisplayEvent ¶
type MouseLeaveDisplayEvent ¶
type MouseState ¶
type MouseState C.struct_ALLEGRO_MOUSE_STATE
func (*MouseState) Axis ¶
func (state *MouseState) Axis(axis int) int
Extract the mouse axis value from the saved state. The axes are numbered from 0, in this order: x-axis, y-axis, z-axis, w-axis.
See https://liballeg.org/a5docs/5.2.6/mouse.html#al_get_mouse_state_axis
func (*MouseState) ButtonDown ¶
func (state *MouseState) ButtonDown(button int) bool
Return true if the mouse button specified was held down in the state specified. Unlike most things, the first mouse button is numbered 1.
See https://liballeg.org/a5docs/5.2.6/mouse.html#al_mouse_button_down
func (*MouseState) Buttons ¶
func (state *MouseState) Buttons() int
func (*MouseState) Get ¶
func (state *MouseState) Get()
Save the state of the mouse specified at the time the function is called into the given structure.
See https://liballeg.org/a5docs/5.2.6/mouse.html#al_get_mouse_state
func (*MouseState) Pressure ¶
func (state *MouseState) Pressure() float32
func (*MouseState) W ¶
func (state *MouseState) W() int
func (*MouseState) X ¶
func (state *MouseState) X() int
func (*MouseState) Y ¶
func (state *MouseState) Y() int
func (*MouseState) Z ¶
func (state *MouseState) Z() int
type MouseWarpedEvent ¶
type PixelFormat ¶
type PixelFormat int
func NewBitmapFormat ¶
func NewBitmapFormat() PixelFormat
Returns the format used for newly created bitmaps.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_new_bitmap_format
func (PixelFormat) PixelFormatBits ¶
func (format PixelFormat) PixelFormatBits() int
Return the number of bits that a pixel of the given format occupies. For blocked pixel formats (e.g. compressed formats), this returns 0.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_pixel_format_bits
func (PixelFormat) PixelSize ¶
func (format PixelFormat) PixelSize() int
Return the number of bytes that a pixel of the given format occupies. For blocked pixel formats (e.g. compressed formats), this returns 0.
See https://liballeg.org/a5docs/5.2.6/graphics.html#al_get_pixel_size
type State ¶
type State C.ALLEGRO_STATE
func StoreState ¶
func StoreState(flags StateFlags) *State
Stores part of the state of the current thread in the given ALLEGRO_STATE object. The flags parameter can take any bit-combination of these flags:
See https://liballeg.org/a5docs/5.2.6/state.html#al_store_state
type StateFlags ¶
type StateFlags int
type SystemID ¶
type SystemID int
func GetSystemID ¶
func GetSystemID() SystemID
Returns the platform that Allegro is running on.
See https://liballeg.org/a5docs/5.2.6/system.html#al_get_system_id
type SystemMouseCursor ¶
type SystemMouseCursor C.ALLEGRO_SYSTEM_MOUSE_CURSOR
type Timeout ¶
type Timeout C.ALLEGRO_TIMEOUT
func NewTimeout ¶
Set timeout value of some number of seconds after the function call.
See https://liballeg.org/a5docs/5.2.6/time.html#al_init_timeout
type Timer ¶
type Timer C.ALLEGRO_TIMER
func CreateTimer ¶
Allocates and initializes a timer. If successful, a pointer to a new timer object is returned, otherwise NULL is returned. speed_secs is in seconds per "tick", and must be positive. The new timer is initially stopped.
See https://liballeg.org/a5docs/5.2.6/timer.html#al_create_timer
func (*Timer) AddCount ¶
Add diff to the timer's counter value. This is similar to writing:
See https://liballeg.org/a5docs/5.2.6/timer.html#al_add_timer_count
func (*Timer) Count ¶
Return the timer's counter value. The timer can be started or stopped.
See https://liballeg.org/a5docs/5.2.6/timer.html#al_get_timer_count
func (*Timer) Destroy ¶
func (t *Timer) Destroy()
Uninstall the timer specified. If the timer is started, it will automatically be stopped before uninstallation. It will also automatically unregister the timer with any event queues.
See https://liballeg.org/a5docs/5.2.6/timer.html#al_destroy_timer
func (*Timer) EventSource ¶
func (t *Timer) EventSource() *EventSource
Retrieve the associated event source. Timers will generate events of type ALLEGRO_EVENT_TIMER.
See https://liballeg.org/a5docs/5.2.6/timer.html#al_get_timer_event_source
func (*Timer) IsStarted ¶
Return true if the timer specified is currently started.
See https://liballeg.org/a5docs/5.2.6/timer.html#al_get_timer_started
func (*Timer) SetCount ¶
Set the timer's counter value. The timer can be started or stopped. The count value may be positive or negative, but will always be incremented by +1 at each tick.
See https://liballeg.org/a5docs/5.2.6/timer.html#al_set_timer_count
func (*Timer) SetSpeed ¶
Set the timer's speed, i.e. the rate at which its counter will be incremented when it is started. This can be done when the timer is started or stopped. If the timer is currently running, it is made to look as though the speed change occurred precisely at the last tick.
See https://liballeg.org/a5docs/5.2.6/timer.html#al_set_timer_speed
func (*Timer) Speed ¶
Return the timer's speed, in seconds. (The same value passed to al_create_timer or al_set_timer_speed.)
See https://liballeg.org/a5docs/5.2.6/timer.html#al_get_timer_speed
func (*Timer) Start ¶
func (t *Timer) Start()
Start the timer specified. From then, the timer's counter will increment at a constant rate, and it will begin generating events. Starting a timer that is already started does nothing. Starting a timer that was stopped will reset the timer's counter, effectively restarting the timer from the beginning.
See https://liballeg.org/a5docs/5.2.6/timer.html#al_start_timer
func (*Timer) Stop ¶
func (t *Timer) Stop()
Stop the timer specified. The timer's counter will stop incrementing and it will stop generating events. Stopping a timer that is already stopped does nothing.
See https://liballeg.org/a5docs/5.2.6/timer.html#al_stop_timer
type TimerEvent ¶
type Transform ¶
type Transform C.ALLEGRO_TRANSFORM
func BuildTransform ¶
Builds a transformation given some parameters. This call is equivalent to calling the transformations in this order: make identity, rotate, scale, translate. This method is faster, however, than actually calling those functions.
See https://liballeg.org/a5docs/5.2.6/transformations.html#al_build_transform
func CurrentTransform ¶
func CurrentTransform() *Transform
Returns the transformation of the current target bitmap, as set by al_use_transform. If there is no target bitmap, this function returns NULL.
See https://liballeg.org/a5docs/5.2.6/transformations.html#al_get_current_transform
func IdentityTransform ¶
func IdentityTransform() *Transform
Convenience function for getting a new identity transformation.
func (*Transform) CheckInverse ¶
Checks if the transformation has an inverse using the supplied tolerance. Tolerance should be a small value between 0 and 1, with 1e-7 being sufficient for most applications.
See https://liballeg.org/a5docs/5.2.6/transformations.html#al_check_inverse
func (*Transform) Compose ¶
Compose (combine) two transformations by a matrix multiplication.
See https://liballeg.org/a5docs/5.2.6/transformations.html#al_compose_transform
func (*Transform) Coordinates ¶
Transform a pair of coordinates.
See https://liballeg.org/a5docs/5.2.6/transformations.html#al_transform_coordinates
func (*Transform) Copy ¶
Makes a copy of a transformation.
See https://liballeg.org/a5docs/5.2.6/transformations.html#al_copy_transform
func (*Transform) Identity ¶
func (t *Transform) Identity()
Sets the transformation to be the identity transformation. This is the default transformation. Use al_use_transform on an identity transformation to return to the default.
See https://liballeg.org/a5docs/5.2.6/transformations.html#al_identity_transform
func (*Transform) Invert ¶
func (t *Transform) Invert()
Inverts the passed transformation. If the transformation is nearly singular (close to not having an inverse) then the returned transformation may be invalid. Use al_check_inverse to ascertain if the transformation has an inverse before inverting it if you are in doubt.
See https://liballeg.org/a5docs/5.2.6/transformations.html#al_invert_transform
func (*Transform) Rotate ¶
Apply a rotation to a transformation.
See https://liballeg.org/a5docs/5.2.6/transformations.html#al_rotate_transform
func (*Transform) Scale ¶
Apply a scale to a transformation.
See https://liballeg.org/a5docs/5.2.6/transformations.html#al_scale_transform
func (*Transform) Translate ¶
Apply a translation to a transformation.
See https://liballeg.org/a5docs/5.2.6/transformations.html#al_translate_transform
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package acodec provides support for Allegro's acodec addon.
|
Package acodec provides support for Allegro's acodec addon. |
Package audio provides support for Allegro's audio addon.
|
Package audio provides support for Allegro's audio addon. |
Package color provides support for Allegro's color addon.
|
Package color provides support for Allegro's color addon. |
Package dialog provides support for Allegro's native dialog addon.
|
Package dialog provides support for Allegro's native dialog addon. |
Package font provides support for Allegro's font addon.
|
Package font provides support for Allegro's font addon. |
ttf
Package ttf provides support for Allegro's TTF font addon.
|
Package ttf provides support for Allegro's TTF font addon. |
Package image provides support for Allegro's image addon.
|
Package image provides support for Allegro's image addon. |
Package memfile provides support for Allegro's memfile addon.
|
Package memfile provides support for Allegro's memfile addon. |
Package physfs provides support for Allegro's PhysicsFS addon.
|
Package physfs provides support for Allegro's PhysicsFS addon. |
Package primitives provides support for Allegro's primitives addon.
|
Package primitives provides support for Allegro's primitives addon. |
Package tiled implements support for the Allegro Tiled addon.
|
Package tiled implements support for the Allegro Tiled addon. |
Package windows provides support for Allegro's Windows-specific functions.
|
Package windows provides support for Allegro's Windows-specific functions. |
Package x11 provides support for Allegro's X11 functions.
|
Package x11 provides support for Allegro's X11 functions. |