LoginSignup
2
0
はじめての記事投稿

DXライブラリをNimで使う

Last updated at Posted at 2023-07-15

はじめに

DXライブラリはC++用のライブラリです。
私はNim信者なので、DXライブラリをNimで使いたいと思うわけです。
でも、DXライブラリのNimバインディングはないのです。
じゃあ作っちゃおう...作りました。

使用方法

詳しくは https://github.com/777shuang/DxLib をご覧あれ。

nimble install DxLib
して

import DxLib

# プログラムは WinMain から始まりません

if DxLib_Init() == -1: # DXライブラリ初期化処理
  quit(-1) # エラーが起きたら直ちに終了

discard DrawPixel(320, 240, GetColor(255, 255, 255)) # 点を打つ

discard WaitKey() # キー入力待ち

discard DxLib_End() # DXライブラリ使用の終了処理

test.nimに書き
nim c test

DXライブラリDLL版(ちゃっかり私のプロジェクト)をダウンロードしてexeファイルと同じ階層に展開

問題点

  • まだWindowsにしか対応してない
    そのうちLinuxに対応する予定。
  • discardの嵐
  • 必要なDLLファイルがとんでもなく多い
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