I would like avoid using of other libraries and only use the multimedia system of the device on my program run - if possible. |
You do realize the libraries you are wanting to avoid use the built-in basic graphic and multi-media system of the OS, hiding all the tedious details in the framework(s), as well enhance the features of the systems to do things that would require a LOT of code to replicate. 3D graphics, for instance. Playing music other than midi files for another.
BTW, if you are wanting to have sounds that don't seem to lag don't use SND_SYNC. SND_ASYNC is the flag you need.
1 2 3 4 5 6 7 8 9
|
#include <windows.h>
#include <cstdio>
int main()
{
PlaySound(TEXT("test.wav"), NULL, SND_FILENAME | SND_ASYNC);
getchar();
}
| |
Why the
getchar();? So the app is still running when the mmsystem asynchronously plays the sound. Without that flag, well, the timing is not guaranteed.
I am not trying to discourage you from using GDI and the mmsystem. I am just trying to let you know of the serious game related limitations built-in when using those older Windows technologies.
I gave you a link to an old Windows game programming book earlier. Consider buying it if you want to learn the steps of creating a game that uses those old technologies.
The book creates a neat little GDI/mmsystem game engine you can use to create your own 2D windowed games just by plopping the game engine source files into your new game project. C++ reuseability, YEAH!
I also suggest getting Visual Studio 2019 Community as well. It's free.
https://visualstudio.microsoft.com/downloads/
Trying to wrestle with Code::Blocks for Windows GUI apps can be irksome and frustrating. I know, I keep trying. Those little code snippets I created? A lot more work and skull sweat to get them to compile with C:B than MSVC.