Projects/Games/Porting to libkdegames v5: Difference between revisions

From KDE Community Wiki
(Created page with "This document describes the changes introduced with libkdegames v5, which first appeared in the KDE 4.9 release. == New components == * '''KgSound''' provides a simple API for ...")
 
No edit summary
Line 4: Line 4:


* '''KgSound''' provides a simple API for playback of short event sounds. Low latency is achieved through the use of OpenAL, with a Phonon fallback if the required libraries are not available.
* '''KgSound''' provides a simple API for playback of short event sounds. Low latency is achieved through the use of OpenAL, with a Phonon fallback if the required libraries are not available.
Also, multiple new components have been added which replace existing components. These can be identified by the common class name prefix "Kg". See [[#Reworked components|]] for details.


== Removed components ==
== Removed components ==
Line 13: Line 15:
* '''KGameSvgDigits''' — If you need SVG digits, include them in your own SVG theme.
* '''KGameSvgDigits''' — If you need SVG digits, include them in your own SVG theme.
* '''KGrid2D''' — You'll need to do the math yourself.
* '''KGrid2D''' — You'll need to do the math yourself.
== Reworked components ==
=== Difficulty ===
'''KGameDifficulty''' has been replaced by the '''KgDifficulty''' and '''KgDifficultyLevel''' classes. KgDifficulty stores the current level by itself, and allows for multiple KgDifficulty instances at the same time, although a singleton is provided by the Kg::difficulty() function. The following table shows how to port KGameDifficulty functions:
{| border="1" cellpadding="5" cellspacing="0" style="border: gray solid 1px; border-collapse: collapse; text-align: left; width:100%;"
|- style="background: #ececec; white-space:nowrap;"
! Replace this...
! ...by this
! Comment
|-
| <tt>KGameDifficulty::standardLevel</tt>
| <tt>KgDifficultyLevel::StandardLevel</tt>
|
|-
| <tt>KGameDifficulty::Medium etc.</tt>
| <tt>KgDifficultyLevel::Medium etc.</tt>
|
|-
| <tt>KGameDifficulty::addStandardLevel</tt>
| <tt>Kg::difficulty()->addStandardLevel</tt>
| As a convenience, consider to use the new <tt>addStandardLevelRange</tt> method.
|}
TODO: finish table, commit the functions in namespace Kg

Revision as of 23:58, 6 March 2012

This document describes the changes introduced with libkdegames v5, which first appeared in the KDE 4.9 release.

New components

  • KgSound provides a simple API for playback of short event sounds. Low latency is achieved through the use of OpenAL, with a Phonon fallback if the required libraries are not available.

Also, multiple new components have been added which replace existing components. These can be identified by the common class name prefix "Kg". See [[#Reworked components|]] for details.

Removed components

  • The KGGZ framework has been removed completely.
  • KGameLCD — Use QLCDNumber instead.
  • KGameMisc — Instead of a random name, we advise to use generic names where appropriate.
  • KGameProgress — Use QProgressBar instead.
  • KGameSvgDigits — If you need SVG digits, include them in your own SVG theme.
  • KGrid2D — You'll need to do the math yourself.

Reworked components

Difficulty

KGameDifficulty has been replaced by the KgDifficulty and KgDifficultyLevel classes. KgDifficulty stores the current level by itself, and allows for multiple KgDifficulty instances at the same time, although a singleton is provided by the Kg::difficulty() function. The following table shows how to port KGameDifficulty functions:

Replace this... ...by this Comment
KGameDifficulty::standardLevel KgDifficultyLevel::StandardLevel
KGameDifficulty::Medium etc. KgDifficultyLevel::Medium etc.
KGameDifficulty::addStandardLevel Kg::difficulty()->addStandardLevel As a convenience, consider to use the new addStandardLevelRange method.

TODO: finish table, commit the functions in namespace Kg