I would like to reproduce 2D RPG games like dot-pictured drakue and Pokémon in C++, but there is something I don't understand.
Should I make a map image of a dot picture and display the characters on it?
I don't know the basics, so I'm stuck.
I would appreciate it if you could let me know.
c++ macos game-development opengl
The Tokoi Laboratory website is recommended for beginners of OpenGL.
If you don't know how to do it, break it down into small pieces and think about it or try it.
First, try displaying two pictures on OpenGL.
Try to control one of the pictures from the top, bottom, left and right of the keyboard.
You can get what key is pressed from the API that the operating system has as standard.
If you can move the picture with the key, you can stack it on another picture.
Did the picture that you moved with the key come up? Or did the picture that didn't move come up?
You'll find out what you don't understand when you put them together.
Traditional methods (not OpenGL or Direct3D) used to refer to moving characters as sprites, but the game console at that time had hard features to manage sprites, so there was no need to pay particular attention to overlapping with the background (map).
When performing sprite-like processing on Windows, etc., images that are overwritten by characters such as background must be retained in advance.In some cases, it may be overwritten by another character.This is basically the same with Windows DIB and DirectDraw.
However, today's PCs use ample (video) memory, fast GPUs, and CPUs, so you don't need to keep only a small portion of the screen, and refreshing (redrawing) the entire screen provides sufficient performance.
DirectDraw, DIB, and classic techniques use the method of creating a mask for a background and character and then transparently superimposing the character on that mask.
Even older PCs were often used because they can be calculated with simple bit operations.This is how to configure and synthesize transparent colors.
OpenGL and Direct3D have libraries for 2D, but since 3D drawing is projected from the front and shown in 2D, it seems that GPU can be used for fast and simple sprite processing.
© 2024 OneMinuteCode. All rights reserved.