XFcCore class Reference

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# XFcCore Class Reference

Static core class, contains global functions. More...

List of all members.

## Static Public Member Functions

XFCIMPORT const CHAR * | getPlatformString ()
| Returns platform as a printable CHAR * string.
XFCIMPORT INT32 | getPlatformId ()
| Returns platform as a generic id (see XFCPLATFORM enum).
XFCIMPORT const CHAR * | getCommandlineString ()
| Returns command line as a CHAR string, if applicable to the platform.
XFCIMPORT void | setRenderer (XFcRenderer *aNewRenderer)
| Sets (or changes) the renderer object.
XFCIMPORT void | setController (XFcInput *aNewController)
| Sets (or changes) the input receiver object.
XFCIMPORT INT32 | getTick ()
| Returns the system tick (in milliseconds).
XFCIMPORT INT64 | getTick64 ()
| Returns the system tick (in milliseconds) as an INT64 value.
XFCIMPORT void | quit ()
| Quits the application.
XFCIMPORT void | systemPanic (const CHAR *aPanicMessage)
| Performs system panic; shows dialog for user, tries to shut down cleanly.
XFCIMPORT XFcApp * | getApp ()
| Returns a pointer to the application class.
XFCIMPORT INT32 | getDeviceWidth ()
| Returns graphics device logical width in pixels.
XFCIMPORT INT32 | getDeviceHeight ()
| Returns graphics device logical height in pixels.
XFCIMPORT INT | openCFL (const CHAR *aFileName)
| Opens a compressed file library from filename.
XFCIMPORT void | resetCFLDirectory ()
| Resets the CFL directory.
XFCIMPORT void | setFileOpenStrategy (INT32 aStrategy)
| Changes the default file open strategy.
XFCIMPORT void | compactMemory (UINT32 aFlags)
| Attempts to compact memory pool.
XFCIMPORT UINT32 | getMemoryBlockSize (void *aPtr)
| Returns size of an allocated memory block.
XFCIMPORT UINT32 | getFreePoolMemory ()
| Returns free memory.
XFCIMPORT void * | allocateSystemMemory (const INT32 aSize)
| Performs platform independent memory allocation.
XFCIMPORT void | freeSystemMemory (void *aPtr)
| Performs platform independent memory deallocation.
XFCIMPORT REAL | getBatteryState ()
| Returns percentage of battery left (0..1).
XFCIMPORT void | addScreenButton (const XFcRectangle &aRect, INT32 aScanCode)
| Adds a virtual button on screen.
XFCIMPORT void | resetScreenButtons ()
| Removes all virtual buttons from screen.
XFCIMPORT UINT32 | getControlMappingCount ()
| Returns the number of allocated control mappings.
XFCIMPORT void | getControlMapping (UINT32 aControlIndex, INT32 &aControlCode, INT32 &aHardwareScanCode)
| Returns one control mapping for an index.
XFCIMPORT void | mapControlCode (INT32 aControlCode, INT32 aHardwareScanCode)
| Maps a hardware scan code to a control code.
XFCIMPORT void | unmapControlCode (INT32 aControlCode, INT32 aHardwareScanCode)
| Unmaps the link from a hardware scan code to a control code.
XFCIMPORT void | resetControlMappings ()
| Resets control mappings to default.
XFCIMPORT XFcCommunication * | getCommunicationScheduler ()
| Returns network communication scheduler.
XFCIMPORT XFcCPUInfo * | getCPUInfo ()
| Allocates and returns CPU information class.
XFCIMPORT void | sleep (INT32 aMilliseconds)
| Sleeps the current thread for at least specified amount of milliseconds.
XFCIMPORT INT32 | setExclusiveMode (INT32 aMode, XFcExclusiveModeSettings &aSettings)
| Sets exclusive mode.
XFCIMPORT void | setOutOfMemoryAction (INT32 aMode)
| Sets the action which should be taken when memory allocation fails.
XFCIMPORT void | setIdleMode (INT32 aMode)
| Tells X-Forge whether to let the device go into idle state or not.
XFCIMPORT INT32 | getSilentProfileState ()
| Asks if the device is in silent profile.
XFCIMPORT UINT32 | getDeviceLocale ()
| Asks for the current locale in the device.
XFCIMPORT XFcPrimitiveTranslator * | getPrimitiveTranslator ()
| Returns the primitive translator class for high level 2D vector graphics drawing.
XFCIMPORT XFcPrimitiveDraw * | getPrimitiveDraw ()
| Returns the primitive draw class for low level 2D vector graphics drawing.

## Detailed Description

Static core class, contains global functions.

## Member Function Documentation

XFCIMPORT void XFcCore::addScreenButton | ( | const XFcRectangle & | aRect,
|  | INT32 | aScanCode
| ) | `[static]`

Adds a virtual button on screen.

Please note that this is not a widget, and there is no visual feedback. If stylus touched the defined rectangle, a keydown event is dispatched; when the stylus exits the region, keyup event is dispatched. You can map the scancode to a control code using the mapControlCode call.

See also:
  resetScreenButtons()

XFCIMPORT void* XFcCore::allocateSystemMemory | ( | const INT32 | aSize | ) | `[static]`

Performs platform independent memory allocation.

Note:
  Allocates memory outside the memory pool. The memory must be freed with freeSystemMemory().

XFCIMPORT void XFcCore::compactMemory | ( | UINT32 | aFlags | ) | `[static]`

Attempts to compact memory pool.

Tells the memory manager that now would be a good time to do any house-keeping tasks that may take some time.

Parameters:

  aFlags | reserved; set to 0

XFCIMPORT void XFcCore::freeSystemMemory | ( | void * | aPtr | ) | `[static]`

Performs platform independent memory deallocation.

Note:
  Use this only to free any memory allocated with allocateSystemMemory call.

XFCIMPORT XFcApp* XFcCore::getApp | ( |  | ) | `[static]`

Returns a pointer to the application class.

Returns:
  Pointer to the application class.

Note:
  The application class is a good place to store any application global data that would normally be stored as global static data.

XFCIMPORT REAL XFcCore::getBatteryState | ( |  | ) | `[static]`

Returns percentage of battery left (0..1).

It is advisable to show the battery state inside games; however, the value returned by this call is not reliable enough to warrant any action on low battery situations.

Returns:
  Percentage of battery left, as a REAL number (0..1).

XFCIMPORT const CHAR* XFcCore::getCommandlineString | ( |  | ) | `[static]`

| Returns command line as a CHAR string, if applicable to the platform.

XFCIMPORT XFcCommunication* XFcCore::getCommunicationScheduler | ( |  | ) | `[static]`

| Returns network communication scheduler.

XFCIMPORT void XFcCore::getControlMapping | ( | UINT32 | aControlIndex,
|  | INT32 & | aControlCode,
|  | INT32 & | aHardwareScanCode
| ) | `[static]`

Returns one control mapping for an index.

Returned values aControlCode and aHardwareScanCode are either valid control and hardware scan codes, or both are -1 if the allocated link is not currently in use.

Parameters:

  aControlIndex | index in range [0..n-1], where n is the return value of getControlMappingCount().
  aControlCode | reference to an INT32 where the control code will be written.
  aHardwareScanCode | reference to an INT32 where the hardware scan code will be written.

XFCIMPORT UINT32 XFcCore::getControlMappingCount | ( |  | ) | `[static]`

Returns the number of allocated control mappings.

See also:
  getControlMapping()

XFCIMPORT XFcCPUInfo* XFcCore::getCPUInfo | ( |  | ) | `[static]`

Allocates and returns CPU information class.

Returns:
  XFcCPUInfo object if successful.

  NULL if failed or unsupported.

Note:
  the application must delete the returned object.

XFCIMPORT INT32 XFcCore::getDeviceHeight | ( |  | ) | `[static]`

Returns graphics device logical height in pixels.

Note:
  Since different graphics devices may have different logical sizes compared to physical ones (esp. the FSAA devices), the values returned by these functions are only valid after the creation of a XFcGL object.

Returns:
  device height, in pixels.

XFCIMPORT UINT32 XFcCore::getDeviceLocale | ( |  | ) | `[static]`

Asks for the current locale in the device.

Note that this method is not neccessarily supported on devices that do support several locale settings, and even on those, not all supported locales are returned.

If querying the locale fails or is unsupported, the function returns zero. If the application does not detect a supported locale, it should default to english.

See XFCLOCALES enum for full list of possible return values.

XFCIMPORT INT32 XFcCore::getDeviceWidth | ( |  | ) | `[static]`

Returns graphics device logical width in pixels.

Note:
  Since different graphics devices may have different logical sizes compared to physical ones (esp. the FSAA devices), the values returned by these functions are only valid after the creation of a XFcGL object.

Returns:
  device width, in pixels.

XFCIMPORT UINT32 XFcCore::getFreePoolMemory | ( |  | ) | `[static]`

Returns free memory.

Returns:
  Bytes of free memory in the pool.

XFCIMPORT UINT32 XFcCore::getMemoryBlockSize | ( | void * | aPtr | ) | `[static]`

Returns size of an allocated memory block.

Returns:
  Bytes of memory in the block.

Note:
  If the given pointer is not valid, the operation is undefined.

XFCIMPORT INT32 XFcCore::getPlatformId | ( |  | ) | `[static]`

Returns platform as a generic id (see XFCPLATFORM enum).

Returns:
  Platform type as an enumerated value.

See also:
  XFCPLATFORM

XFCIMPORT const CHAR* XFcCore::getPlatformString | ( |  | ) | `[static]`

Returns platform as a printable CHAR * string.

Returns:
  Printable CHAR * string describing the platform.

XFCIMPORT XFcPrimitiveDraw* XFcCore::getPrimitiveDraw | ( |  | ) | `[static]`

| Returns the primitive draw class for low level 2D vector graphics drawing.

XFCIMPORT XFcPrimitiveTranslator* XFcCore::getPrimitiveTranslator | ( |  | ) | `[static]`

| Returns the primitive translator class for high level 2D vector graphics drawing.

XFCIMPORT INT32 XFcCore::getSilentProfileState | ( |  | ) | `[static]`

Asks if the device is in silent profile.

Returns:
  -1 if unsupported

  0 if device is not in silent profile

  1 if device is in silent profile

XFCIMPORT INT32 XFcCore::getTick | ( |  | ) | `[static]`

Returns the system tick (in milliseconds).

Returns:
  Current tick, in milliseconds.

Note:
  The tick counts milliseconds from the application start-up.

  The granularity of ticks depends on the used platform. Pocketpc has 1ms granularity while symbian platforms have 16-17ms granularity.

  If getTick() is not called for 5 minutes (300000ms) or more, the tick is only advanced by 1ms. This is to avoid any system freezes due to physics running forever or something similar.

See also:
  getTick64()

XFCIMPORT INT64 XFcCore::getTick64 | ( |  | ) | `[static]`

Returns the system tick (in milliseconds) as an INT64 value.

Implemeted for situations where INT32 overflow is a problem.

See also:
  getTick()

XFCIMPORT void XFcCore::mapControlCode | ( | INT32 | aControlCode,
|  | INT32 | aHardwareScanCode
| ) | `[static]`

Maps a hardware scan code to a control code.

When a certain scan code is received from physical buttons, the core can map it to some control code, and calls onControlDown() with the control code. All controls can be re-mapped with this method.

Parameters:

  aControlCode | control code to map to.
  aHardwareScanCode | hardware scan code to map from.

See also:
  unmapControlCode

XFCIMPORT INT XFcCore::openCFL | ( | const CHAR * | aFileName | ) | `[static]`

Opens a compressed file library from filename.

You can open multiple files. If several resource names overlap, only the last opened one is used.

Parameters:

  aFileName | filename of the resource file.

Returns:
  1 if success.

  0 if failure (out of memory, file not found, or corrupted file).

XFCIMPORT void XFcCore::quit | ( |  | ) | `[static]`

| Quits the application. This method never returns. It causes onAppDeinit() to be called, as well as closing any current renderers and so on.

XFCIMPORT void XFcCore::resetCFLDirectory | ( |  | ) | `[static]`

Resets the CFL directory.

In order to change levels or other data, you may want to flush the current CFL directory entries and re-open the CFL files.

Note:
  It's not required to call this method before quitting the application.

XFCIMPORT void XFcCore::resetControlMappings | ( |  | ) | `[static]`

| Resets control mappings to default. Discards any changes done with mapControlCode, and returns to startup defaults (which are platform specific).

XFCIMPORT void XFcCore::resetScreenButtons | ( |  | ) | `[static]`

Removes all virtual buttons from screen.

See also:
  addScreenButton()

XFCIMPORT void XFcCore::setController | ( | XFcInput * | aNewController | ) | `[static]`

| Sets (or changes) the input receiver object.

XFCIMPORT INT32 XFcCore::setExclusiveMode | ( | INT32 | aMode,
|  | XFcExclusiveModeSettings & | aSettings
| ) | `[static]`

Sets exclusive mode.

In exclusive mode application takes over the whole screen and may capture control events that would otherwise be handled by the device. Applications start in exclusive mode.

Parameters:

  aMode | 0 for non exclusive mode, or 1 for exclusive mode.
  aSettings | a reference to a struct that upon successful return describes the part of the framebuffer that is visible on screen.

Returns:
  1 on success.

  0 on failure.

XFCIMPORT void XFcCore::setFileOpenStrategy | ( | INT32 | aStrategy | ) | `[static]`

| Changes the default file open strategy. See XFCFILEOPENSTRATEGY enum. The default strategy is XFCFO_DISKFIRST.

XFCIMPORT void XFcCore::setIdleMode | ( | INT32 | aMode | ) | `[static]`

Tells X-Forge whether to let the device go into idle state or not.

Normally a game would not want the device to go idle while the game is being played. There can be situations, such as cutscenes, which last long enough for the device to turn off backlight. In some situations, such as game menus or pause mode it is, however, desirable to let the device time out in order to save batteries.

See also:
  XFCIDLEMODE enumeration

XFCIMPORT void XFcCore::setOutOfMemoryAction | ( | INT32 | aMode | ) | `[static]`

Sets the action which should be taken when memory allocation fails.

This function sets the global action which should be taken whenever memory allocation fails. The normal mode of action is to do nothing and return NULL from the memory allocation. It may be desirable to set the out of memory action to XFCOMA_PANIC to detect out of memory situations in unexpected situations. XFCOMA_ASSERT can be used to break into debugger in debug builds; finally, XFCOMA_NONE can be used to return to normal operation.

See also:
  XFCOUTOFMEMORYACTION enumeration

XFCIMPORT void XFcCore::setRenderer | ( | XFcRenderer * | aNewRenderer | ) | `[static]`

| Sets (or changes) the renderer object. Causes the old renderer to get a deinitialization call, and the new one to receive an initialization call.

XFCIMPORT void XFcCore::sleep | ( | INT32 | aMilliseconds | ) | `[static]`

Sleeps the current thread for at least specified amount of milliseconds.

It is highly recommended to sleep() as much as possible during idle moments, as this saves device batteries.

Parameters:

  aMilliseconds | amount of milliseconds to sleep at least.

XFCIMPORT void XFcCore::systemPanic | ( | const CHAR * | aPanicMessage | ) | `[static]`

| Performs system panic; shows dialog for user, tries to shut down cleanly. This method is to be used when an error situation is so severe that it is uncertain whether the application is able to continue.

XFCIMPORT void XFcCore::unmapControlCode | ( | INT32 | aControlCode,
|  | INT32 | aHardwareScanCode
| ) | `[static]`

Unmaps the link from a hardware scan code to a control code.

Parameters:

  aControlCode | control code to remove mapping for.
  aHardwareScanCode | hardware scan code to remove mapping for.

See also:
  mapControlCode

|  | X-Forge Documentation Confidential Copyright © 2002-2003 Fathammer |  | Documentation generated with doxygen by Dimitri van Heesch