Above is the "note hit" animation created by our artist.

Still the Game Creation course. This time, a music game.

As said in the previous article, I've implemented and applied a more flexible framework. It supports basic scene management, which allows me to separate game logics & elements into different files. For example:

// Scenes/level.cpp
// Register the level-choosing scene.
Scene level_scene("level", &level_init, {
	{ WM_KEYDOWN, { (EventHandler::Handler)&level_keydown } },
	{ WM_PAINT, { (EventHandler::Handler)&level_paint } },
// main.cpp
using namespace Win32GameEngine;
LRESULT init(HWND hWnd) {
	// ...
	// Switch to the above-defined scene on start.
	Scene::switchTo("level", hWnd, nullptr);
	return 0;

This is the level-choosing start menu.

This way, I can spend more time on developing the specific game logics. Below is a piece of rendering code of the main game UI.

// Scenes/play.cpp
Bitmap background((wstring(textures_dir) + L"background.bmp").c_str());
// Define the content area.
PureColor vinner(0, { 512, 192 });
	HDC hdc = BeginPaint(hWnd, &ps);
	background.paintOn(vscreen.hdc, { 0, 0 });
	background.paintOn(vinner.hdc, { -64, -84 });
	// Get the current time since level (music track) started.
	LONGLONG const progress = getCurrentProgress();
	// And then render the note tracks regarding the process.
	tr_top.paint(vinner.hdc, progress);
	tr_bottom.paint(vinner.hdc, progress);
	vinner.paintOn(vscreen.hdc, { 64, 84 });
	// Lastly, render the HP bar.
	RECT health_bar{ 0, 0, (long)(vwidth * health / 100.0), 8 };
	FillRect(vscreen.hdc, &health_bar, (HBRUSH)GetStockObject(WHITE_BRUSH));
	vscreen.paintOn(hdc, { 0, 0 });
	EndPaint(hWnd, &ps);
	return 0;

The final game UI looks like this.

Although it can been clearly seen that the framework is still coupled with the Win32 API, the overall design is progressing in the intended direction! The framework is completely decoupled with the game's logics. This means that I can safely use this framework to build all the future course assignments!

As usual, the projects of the framework and the game itself are uploaded onto GitHub. Welcome to download and compile and play!

Note that the game's project is dependent on the framework's. Please manually locate the project after downloading.