The Game Kit Table of Contents | The Game Kit Index

# Global Functions, Constants, and Defined Types

Library: libgame.so

The Game Kit has just one global function, `set_mouse_position()`. It should be called only by an application that has control of the screen through a BWindowScreen object. Otherwise, the kit borrows constants and types defined for graphics card drivers and by other parts of the BeOS. Those that are not documented for the Interface and Support Kits are listed here.

## Global Functions

### set_mouse_position()

Declared in: <game/WindowScreen.h>

void `set_mouse_position(`int32 x, int32 y`)`

Moves the cursor hot spot to (x, y) in the screen coordinate system, where x is a left-to-right index to a pixel column and y is a top-to-bottom index to a pixel row. The origin of the coordinate system is the left top pixel of the display area of the main screen.

This function should be called only while the application has a direct connection to the frame buffer through a BWindowScreen object.

## Constants

### Control Flags

Declared in: <add-ons/graphics/GraphicsCard.h>

`B_CRT_CONTROL`
`B_GAMMA_CONTROL`
`B_FRAME_BUFFER_CONTROL`

These flags report the driver's ability to control the CRT display, make gamma corrections, and permit nonstandard configurations of the frame buffer. Only the last has any meaning for the Game Kit.

See also: `CardInfo()`

### gs_attributes

Declared in: <game/GameSoundDefs.h>

Constant | Meaning
`B_GS_MAIN_GAIN` | Main gain control, in decibels. The main gain doesn't support ramping.
`B_GS_CD_THROUGH_GAIN` | Gain on the CD through, in decibels.
`B_GS_GAIN` | Gain on the sound, in decibels.
`B_GS_PAN` | Pan position of the sound. -1.0 for far left, 0 for middle, 1.0 for far right.
`B_GS_SAMPLING_RATE` | Sampling rate in hertz.
`B_GS_LOOPING` | If the attribute's value is nonzero, the sound automatically loops. If it's 0, the sound plays through just once.
`B_GS_FIRST_PRIVATE_ATTRIBU TE` | Beginning of private attribute range
`B_GS_FIRST_USER_ATTRIBUTE` | Beginning of user attribute range.

These are the various possible game sound attributes. The range between `B_GS_FIRST_PRIVATE_ATTRIBUTE` and `B_GS_FIRST_USER_ATTRIBUTE` are reserved; if you need custom attributes, use values `B_GS_FIRST_USER_ATTRIBUTE` and higher.

## Defined Types

### frame_buffer_info

Declared in: <add-ons/graphics/GraphicsCard.h>

typedef struct { short `bits_per_pixel` ; short `bytes_per_row` ; short `width` ; short `height` ; short `display_width` ; short `display_height` ; short `display_x` ; short `display_y` ; } `frame_buffer_info`

This structure is used to report the current configuration of the frame buffer.

See also: `FrameBufferInfo()`

### graphics_card_hook

Declared in: <add-ons/graphics/GraphicsCard.h>

typedef void (*`graphics_card_hook`)(void)

This is the general type declaration for a graphics card hook function. Specific hook functions will in fact declare various sets of arguments and all return a `status_t` error code rather than `void`.

See also: `CardHookAt()`, "Graphics Card Hook Functions" on page18

### graphics_card_info

Declared in: <add-ons/graphics/GraphicsCard.h>

typedef struct { short `version`; short `id`; void *`frame_buffer`; char `rgba_order`[4]; short `flags`; short `bits_per_pixel`; short `bytes_per_row`; short `width`; short `height`; } `graphics_card_info`

Drivers use this structure to supply information about themselves and the current configuration of the frame buffer to the Application Server and the BWindowScreen class.

See also: `CardInfo()`

### gs_attribute

Declared in: <game/GameSoundDefs.h>

struct `gs_attribute` { int32 `attribute`; bigtime_t `duration`; float `value`; uint32 `flags`; };

Defines an attribute. An attribute consists of an `attribute` number from `gs_attributes`, a `duration` indicating the period of time, in microseconds, over which the attribute's change takes effect, and a target `value`. Additional `flags` can be specified for the attribute as well; these vary depending on the attribute.

Currently, there are no flags defined for any of the predefined attributes.

### gs_attribute_info

Declared in: <game/GameSoundDefs.h>

struct `gs_attribute_info` { int32 `attribute` ; float `granularity` ; float `minimum` ; float `maximum` ; };

Describes the possible values the `attribute` can take. The `granularity` field indicates how finely the value of the attribute can be controlled, and `minimum` and `maximum` specify the minimum and maximum values the attribute can take on.

### gs_audio_format

Declared in: <game/GameSoundDefs.h>

struct `gs_audio_format` { enum `format` { `B_GS_U8` = 0x11, `B_GS_S16` = 0x2, `B_GS_F` = 0x24, `B_GS_S32` = 0x4 }; float `frame_rate`; uint32 `channel_count`; uint32 `format`; uint32 `byte_order`; size_t `buffer_size`; };

This structure describes the format of a game sound. The format enum lists the possible sound sample formats supported by the Game Kit:

Constant | Meaning
`B_GS_U8` | Unsigned 8-bit integer.
`B_GS_S16` | Signed 16-bit integer.
`B_GS_F` | Floating-point.
`B_GS_S32` | Signed 32-bit integer.

- The `frame_rate` indicates how many frames per second of audio should be played.

- The `channel_count` field indicates the number of audio channels the sound uses.

- The `format` field, which specifies the format of the audio data to be played must be one of the values declared in the `format` enum.

- The `byte_order` field specifies the byte order of the sound to be played.

- The `buffer_size` is used to specify how large the audio buffers used to play the sound should be. You can specify zero if you want the Game Kit to determine an appropriate size for you.

### gs_id

Declared in: <game/GameSoundDefs.h>

typedef int32 gs_id;

This type is used for game sound ID numbers.

The Game Kit Table of Contents | The Game Kit Index

The B e Book,
...in lovely HTML...
for BeOS Release 5.

Copyright © 2000 Be, Inc. All rights reserved..