LoginSignup
11
7

More than 5 years have passed since last update.

東方Projectみたいなゲーム画面分割表示

Last updated at Posted at 2015-03-27

概要

東方Project風画面レイアウト再現サンプル。DXライブラリでの作成。一応、サンプルプログラム実行用フォルダのtest.cppに貼り付けられる形で作った。

ソース

main.cpp
#include "DxLib.h"

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
    int TestHandle , handle, BackHandle ;

    if( DxLib_Init() == -1 )    // DXライブラリ初期化処理
    {
         return -1;    // エラーが起きたら直ちに終了
    }

    // test1.bmpの読み込み
    TestHandle = LoadGraph( "test1.bmp" ) ;

    // back.bmpの読み込み
    BackHandle = LoadGraph( "back.bmp" ) ;

    // 384x448サイズのアルファチャンネルなしの描画可能画像を作成する
    handle = MakeScreen( 384, 448, FALSE ) ;

    // 作成した画像を描画対象にする
    SetDrawScreen( handle ) ;

    // 上に載せるグラフィックを描画
    DrawGraph( 255 , 0 , TestHandle , TRUE ) ;

    // 画面中央100奥に表示
    DrawBillboard3D( VGet(384.0f/2, 448.0f/2, 100.0f), 0.5f, 0.5f, 120.0f, 0.0f, TestHandle, TRUE);

    // 描画対象を表画面にする
    SetDrawScreen( DX_SCREEN_FRONT ) ;

    // 背景を描画
    DrawGraph( 0 , 0 , BackHandle , FALSE ) ;

    // 画像を描画
    DrawGraph( 32 , 16 , handle , FALSE ) ;

    WaitKey() ;            // キーの入力待ち(『WaitKey』を使用)

    DxLib_End() ;            // DXライブラリ使用の終了処理

    return 0 ;            // ソフトの終了
}

結果

th.png

編集履歴

2017/02/17 なぜか末尾の}が脱字していたので修正

11
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
7