Advertisement Jump to content
Sign in to follow this  

Can I draw to screen in symbian's exe mode?

This topic is 5055 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I found most games on symbian are using app(dll). But as app can not use global variables, it is very hard to port current programs. I wonder if we can write games in exe format? Can we draw to screen and respond to message in exe mode?

Share this post

Link to post
Share on other sites
I don't know who told you that you cannot use globals in Symbian but he was right.

There is a pretty easy way around this that actually enables you to use global variables nontheless.
What you would want to do is to create a class that should serve as your global class as a member of another class (any would do). The parent class of the global class should probably create the global class on initialiazation as it would any other member class (complex member class that is).
Now here is the magic :
In order for you to access that class from anywhere, thus making it global, you use a mechanism called Tls (thread local storage).
See, every dll has 4 bytes of memory that are globally accessible and can be used for any purpose, like holding a pointer to a global class.
Nothing like an example to illustrate usage :

Assume you declare your global class as CGameProperties, and in this class you declare all sorts of variables that you use.
Further assume that you have an initalization function called InitL() in the class that owns the instance of CGameProperties
This is how you set the Tls to the address of that class :

//Create the global class as a local instance of the current class
iGameProperties = CGameProperties::NewL();
//Set the address to the Tls using the static function SetTls

Now whenever and wherever you want to retrieve this, you would have to do a cast in the lines of :

CGameProperties* GameProperties = static_cast<CGameProperties*>(Dll::Tls());

Let me know if you need more clarifications.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!