Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 13 Sep 2012
Offline Last Active Jan 16 2014 04:14 AM

Topics I've Started

Custom GUI - Assigning functions to buttons

27 November 2012 - 02:25 AM

Hey there,

so I've been trying to come up with a GUI (using SFML2.0 and C#) and while it's not really a problem to draw stuff onto the screen (or even checking if the mouse is above a button or if the button is clicked), I can't come up with an idea of how to make the buttons functional.

I want to have a class called "Button" with a Property "ButtonFunction". So when I create a button I can also associate an action to be triggered, when I click the button.

Can anyone give me a kickstart here? I'd also appreciate any other information regarding creating a useful custom GUI.
Thanks in advance!

Game based on real-world time

14 September 2012 - 12:09 AM


so I've been wondering how you do this properly:
I want to create a game very similar to the concept of a tamagotchi (I assume you're familiar with these creatures, if not scroll down for a breakdown*). This means you constantly have to track time and let your game character somehow react to it. While the game is running this seems to be no problem, but what happens if it's not?
My approach to this would be to simply note the current time when exiting and subtract it from the current time when starting again, then using this difference to re-simulate all the missed events.

As simple as this might sound I have some doubts about this being a professional (or at least practical) approach to this problem:

1) What happens if you don't start the game again for a really long time? Depending on the speed of the simulation and the machine it could result in a really long phase of re-simulating (is there a better word, btw?) and, in the worst case, appearing to be broken to the user.

2) The user could simply change the system time and provoke unwanted behaviour. How can you prevent this?

3) There would have to be a special method to re-simulate, since the usual simulation-method would play sounds and other events, that would be unwanted to be started multiple times when you race through the passed time. This could also result in other unwanted behaviour, or at least confusing the user.

What's your input on this matter? Is it the right approach? Is there another way? The requirements are as following:
- must not need internet access
- must be able to shut down completely

I'd be happy to read your thoughts and/or suggestions.

PS: Sorry for my first post being a question topic. ;)

* http://en.wikipedia....tchi#Life_Cycle