Hm, the code is really confusing. What exactly is going on here?
If you just want to find out the current animation frame to display, you could just do:
Edit: ...assuming every frame lasts for 1/50th of a second. I'm not sure if I read that correctly in the original post.
double dt; // Time since last update in seconds
double animationTime; // Time since the animation started in seconds
int numAnimationFrames; // Number of frames in animation
double timePerAnimationFrame = 1.0/50; // 50 fps
animationTime += dt; // Add passed time to animation
int currentAnimationFrame = int(animationTime / timePerAnimationFrame) % numAnimationFrames; // Get currently displayed frame, and loop
The Lucas Arts Adventures like Monkey island and Day of the tentacle used a virtual machine called scummVM. Actually I don't know if they used assembly for the engine but given the time I'm pretty sure large parts of it were written in ASM.
Also, Another world (Out of this world) was written as a virtual machine and could thus be ported to a lot of different platforms.
@ Madhed : What is meaned with high level optimalisation ?
Low level: Optimizing small self contained functions like sin() cos() min() max() that are repeated 1000s of times.
High level: Finding better algorithms so you don't even have to call those things 1000s of times.
I don't know the code, so I'm just guessing.
If you find out that you spend 50% of the time in a function that is called millions of times your first idea might be to make the function faster, while it might be even better and easier to make sure the function isn't called that often in the first place.
Can you try http://www.codersnotes.com/sleepy (Very sleepy) ? It's a simple stochastic profiler that you can use to measure your program performance. It shows you were your program is spending most of its time.
If you like you can post screenshots of the results, so maybe we can discuss what's going on there.
You basically have two options: Create native apps or create packaged web apps.
The latter is just a frameless browser window, running in fullscreen, displaying a local webpage. The framework supplies additional functionality that you usually
can't access from the web though. Camera access, File system, Microphone, Cross domain requests, etc.
Pro: Can reuse most of the code on any supported platform. Can resuse code from your website.
Contra: Is relatively slow. Uses more resources. Not all device features available.
Pro: Can be optimized to run very fast and efficiently.
Contra: Different codebase for each operating system.
Native iOS: Objective-C / C / C++
Native Android: Java / C / C++
You also have the option to use a cross platform engine like Unity3D for example, where most of the code is written in C#.
If you want to deploy to iOS you ultimately have to have a Mac since the software (XCode) is only available for that. Some people have had success with a hackintosh although I don't know the legal consequences of using one to create iOS software.
The state should not be the owner of the subsystem. That's the problem. The subsystems are services that your engine provides. The state is a client that can access these systems, that doesn't mean they cease to exist after you switch from one state to another.
The "gameplay" state holds Physics System, Graphics System, and Input System, while the "main main" state holds GUISystem and InputSystem
This is an arbitrary separation. What if you want to display a physically correct exploding character in your main menu or you want to display a GUI over your game scene?