Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » UppHub » Allegro5 - Allegro game programming library v5.x
Allegro5 - Scope addon [message #37102 is a reply to message #36963] Wed, 22 August 2012 21:11 Go to previous message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
There are some ALLEGRO_* types, which require resource management, such as ALLEGRO_BITMAP, ALLEGRO_DISPLAY, ALLEGRO_EVENT_QUEUE with al_destroy_bitmap, al_destroy_display, al_destroy_event_queue function respectively, etc.

For such cases I created allegro5/scope C++ addon. It consist of:
- al_destroy template function, which invokes appropriate al_destroy_* function, based on argument type:
Toggle example

- Scope template class, which uses al_destroy template function on scope completion:
Toggle example

- ScopeList class, which has container to store ALLEGRO_* types (actually, as void *) and invoke approriate al_destroy_* function (in some predefined order, e.g. al_destroy_display function used last) on scope completion:
Toggle example

Some notes:
The allegro5/allegro_scope.h header file is context sensitive, which means, that you need to include it after other allegro* header files (including addons). This is because of preprocessor, which checks used header files (by already defined header guards, e.g. __al_included_allegro5_allegro_h) to associate their ALLEGRO_* types and al_destroy_* functions (where associations created manually).

How to install:
The allegro5/scope is header-only addon, at the moment, with some defined directory structure for Allegro5 addons. I created allegro5/scope/scope.cpp file as a stub for compatibility with TheIDE, but not required to compile. Therefore, either:
- include the path to base folder with allegro5/scope addon
or
- in terms of TheIDE, create new assembly with following package nests:
AllegroDev;Allegro;Libraries;upp\uppsrc
where AllegroDev is path to base folder with allegro/scope addon; other paths explained above.
And add allegro5/scope package to your applcation package.

In the attachments archive you could find allegro5/scope addon and some example.

[Updated on: Mon, 02 February 2015 16:28]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Added DXF class to write cad DXF files
Next Topic: Something wrong with Dispatcher?
Goto Forum:
  


Current Time: Mon May 13 01:28:54 CEST 2024

Total time taken to generate the page: 0.02526 seconds