[10] There must be something moving



A rotating square can be something beautiful. Really, after entering code for days and then seeing a square on the monitor, that's already okay. But if it also rotates, it can truly delight a programmer because it's a sign that everything in the code has worked, and that's not always the case. The rotation, movement, or scaling of an object are things that must be done in every frame. This means that the data changes regularly. It's not a good idea to store the data in a memory area that is not suitable for regular access. Microsoft engineers have taken this into account and created a way to create a buffer so that it is designed to have its contents changed repeatedly. The special thing about it is that there is a method to update the data in this buffer, and there are two methods for it: one for the static buffer and one for changing content. This is something one should know because otherwise, one can spend a few hours figuring out why the memory area is not being updated. In the end, the documentation and internet search brought the solution. The rendering method was adjusted and the square rotates in an optimized form on the monitor.

Es muss ich etwas bewegen 

Ein sich rotierendes Quadrat kann etwas Schönes sein. Wirklich, wenn man tagelang Code eingegeben hat und dann ein Quadrat auf dem Monitor zu sehen ist, dann ist das schon okay. Aber wenn es sich auch noch rotiert, kann das wirklich einen Programmierer erfreuen, denn es ist ein Zeichen dafür, dass alles im Code geklappt hat, und das ist nicht immer der Fall. Die Rotation, Bewegung oder Skalierung eines Objekts sind Dinge, die in jedem Frame durchgeführt werden müssen. Das bedeutet, dass sich die Daten regelmäßig ändern. Es ist dann keine gute Idee, die Daten in einem Speicherbereich abzulegen, der für regelmäßigen Zugriff nicht geeignet ist. Diesen Umstand haben die Ingenieure bei Microsoft berücksichtigt und eine Möglichkeit geschaffen, einen Buffer so zu erstellen, dass er dafür ausgelegt ist, dass sein Inhalt immer wieder verändert wird. Das Besondere daran ist, dass es eine Methode gibt, um die Daten in diesem Buffer zu aktualisieren, und dafür gibt es zwei Methoden: eine für den statischen Buffer und eine für sich verändernde Inhalte. Das sollte man wissen, denn sonst kann man ein paar Stunden damit verbringen, herauszufinden, warum der Speicherbereich nicht aktualisiert wird. Am Ende hat die Dokumentation und die Suche im Internet die Lösung gebracht. Die Rendermethode wurde angepasst und das Quadrat rotiert in optimierter Form auf dem Monitor.

Leave a comment

Log in with itch.io to leave a comment.