A
A
Alexey Maltsev2015-03-30 18:38:20
.NET
Alexey Maltsev, 2015-03-30 18:38:20

How to arrange animation in game loop?

Good day!
A question arose when developing an almost gaming application on Windows Forms.
The bottom line is this: there is a visualizer of the work of processes in the operating system. There is a process, thread and resource class. There are also classes responsible for the animation of the process, thread and resource, which encapsulate classes with logic. If the main class that controls the behavior of the latter, as well as their interaction with the WF interface: clicking on the running thread icon will cause this thread to be selected on the PaintBox and display information about its current state in the ListBox, while when its state changes, the actual data is loaded into the ListBox .
I use Timer to implement the game loop. The game loop itself is presented as follows:
1)Update()
2)Render()
The main concern is with the animation output: how do I organize a smooth animation?
So far I'm thinking of it like this:
1. Updating the process view.
1.1 Updating the look of each resource.
1.1.1. If there is an unfinished animation - go to the next frame of this animation and remember the current state of the animation.
1.1.2. If the animation is over, fire the event.
1.2. Update the view of each thread.
1.2.1. If there is an unfinished animation - go to the next frame of this animation and remember the current state of the animation.
1.2.2. If the animation is over, fire the event.
Am I doing everything right? It is certainly more correct to use ready-made engines, but is it worth learning them for the sake of this task? I need a simple animation and interaction with mouse clicks on a PaintBox.
Here is the design
c7e682a5c40043908b134fda71790507.JPG

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question