ITOMIRI
Works

制作物

HELLO
GameBase(仮)
WORK
PRODUCT | 2025/2/21
1276x717_0675x717_1717x716_2

DXライブラリというC++ライブラリを使ってゲームやソフトウェアのベースを組んでみたものです。

ポイントはコンポーネント形式で管理されている点で、1つのオブジェクト派生クラスのインスタンスにコンポーネント派生を AddComponentで登録していくという流れです。

GameObjectPtr rectSpawningButton3 = CreateObject("rectSpawningButton3");
rectSpawningButton3->SetLayer(camera3->GetLayer());
rectSpawningButton3->SetOrderInLayer(5);
rectSpawningButton3->AddComponent<TransformComponent>(100.f, 100.f);
auto rectSpawningButton3DragComp =
    rectSpawningButton3->AddComponent<DragComponent>();
rectSpawningButton3->AddComponent<ColliderComponent>(250.f, 200.f);
rectSpawningButton3->AddComponent<Rect2DComponent>(250.f, 200.f,
                                                    GetColor(187, 10, 33));
rectSpawningButton3->AddComponent<TextComponent>(
    "[ドラッグ可能]\n[離トリガー]\nレイヤー3オブジェクト", meiryo30,
    GetColor(10, 10, 10), 250, 45);
auto rectSpawningButton3ButtonComp =
    rectSpawningButton3->AddComponent<ButtonComponent>();

rectSpawningButton3DragComp->cameraSelector = cameraSelector;
rectSpawningButton3ButtonComp->cameraSelector = cameraSelector;
rectSpawningButton3ButtonComp->AddOnClickListener(
    std::bind(&TopScene::OnButtonClickedMember, this));
AddObject(rectSpawningButton3);

私の推しコードです。ウインドウ要素やミニマップ、重複判定・ドラッグやクリック等も可能(画像)なので、一度このコードで作ってみませんか...?

作った際の解説(記事)もあります。ぜひご覧ください。

【C++】Singletonなアプリでコンポーネント形式のゲームを作る

DXライブラリで実現する 多カメラ多スクリーン システムの設計と拡張について

技術情報

  • DXライブラリ
  • VC++20