Site contents

GameX library programmer's manual

Version 1.2b

Useful links

Introduction

If you are a C programmer and looking for a supplement to the Amiga OS Release 3 system libraries that:

  • simplify game creation,
  • provide efficient graphics functions.

then GameX library is what you need! GameX is a set of funcions to:

  • install graphics coprocessor-based animation handler to your screen,
  • draw graphics into your windows (either maskable and shiftable bitplanes or color and position-mappable pixel arrays),
  • insert ViewPorts into your screen at any position,
  • handle joystick,
  • load (and save) IFF (Interchange-File-Format) pictures, brushes, sounds and other files.

Draw graphics

All functions are called by one function called clipBlit(). Just provide:

  1. your RastPort (Note: clipBlit draws only onto non-obscured rectangular window parts),
  2. an area to be affected (Rectangle),
  3. and a pointer to the actual drawing function.

This function respects ClipRegion (InstallClipRegion()) as well as DamageLists (BeginUpdate()/EndUpdate() pair) and actual functions support WriteMask. These functions are:

  • writeChunkyPixels() writes a pixel array into the given rectangle in RastPort. You must prepare wcpData record instance filling it with:
    • your pixels buffer address,
    • and its width in pixels (bytes).
    before calling this function.
  • drawIconQuick() - draw aligned icon into the RastPort,
  • drawDualIcon() and drawDualIconLeft() - draw aligned, dual-layer icon into the RastPort, optionally shifting the front layer. Last bitplane in source bitmap is a mask of transparent pixels. You can shift the front layer left or right by specified positive number of pixels in range of 0-15. Before calling this function fill bltData structure with source and background BitMap, front and back coordinates and foreground shift value.

Joystick

To obtain controller call openJoystick() passing timeout in 1/50 of second (if joystick is idle for this time, the timeout message is sent), and a InputEvent record instance. The function clears any pending messages and reads first joystick event for you. If you want to clear pending messages, call clearIO(). Once got a message, read next by calling readEvent(). When you're done with joystick, close it.

Screen

To open your custom screen use openScreen() function. Just provide ScreenModeRequester filled with mode, dimensions and color depth and optionally your TagItem extension. In return you will receive Screen with UserData containing the animation synchronization signal.

Download section

Here you can download latest version of GameX: