LoginSignup
2
0

More than 3 years have passed since last update.

[C++]DXライブラリ(DxLib)をMinGWで使う

Last updated at Posted at 2020-08-14

はじめに

g++のバージョンに一番近いものが8_2_0だったので、それを使いました。

環境

ディレクトリの構成

8_2_0フォルダの中で、静的ライブラリをlibフォルダに、ヘッダファイルをheadフォルダに入れました。
main.cppと同じ階層にMakefile及び8_2_0フォルダを配置しています。

Makefile

Makefile

build:
    g++ -o dx_exe main.cpp \
     -I ./8_2_0/head \
     -L ./8_2_0/lib \
     -DDX_GCC_COMPILE -DDX_NON_INLINE_ASM \
     -lDxLib \
     -lDxUseCLib \
     -lDxDrawFunc \
     -ljpeg \
     -lpng \
     -lzlib \
     -ltiff \
     -ltheora_static \
     -lvorbis_static \
     -lvorbisfile_static \
     -logg_static \
     -lbulletdynamics \
     -lbulletcollision \
     -lbulletmath \
     -lopusfile \
     -lopus \
     -lsilk_common \
     -lcelt

run:
    dx_exe.exe

main.cpp

main.cpp

#include "DxLib.h"

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){

    unsigned int Cr;

    ChangeWindowMode(TRUE);
    SetGraphMode(1280, 720, 32);

    if(DxLib_Init() == -1){
        return -1;
    }

    Cr = GetColor(255, 255, 255);

    DrawString(250, 240 - 32, "Hello DxLib!", Cr);

    WaitKey();

    DxLib_End();

return 0;
}

動作としては、ウィンドウモードで文字列を表示するだけです。

最後に

最近暑くてボケーっとしてます

2
0
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
2
0