-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GUIで動かしたい #2
Comments
https://github.com/oprypin/crystal-imgui を試してみる crystal-imgui-sfml のインストール手順に従うのが良さそう |
以前と同様に crystal-imgui-sfml を動かそうとするとエラーが発生した ❯❯❯ ./simple
Failed to open X11 display; make sure the DISPLAY environment variable is set correctly
zsh: abort ./simple Windows 側でソフトのインストールが必要 上記記事のとおりにソフトをインストール・設定することで WSL から Windows で GUI を表示することができるようになった |
nes.cr を以下のように書き換えて動作確認を行ったところエラーになった require "./nes/emu"
require "crsfml"
require "imgui"
require "imgui-sfml"
# nes_file = File.new("roms/hello.nes")
# buf = Bytes.new(nes_file.size)
# nes_file.read(buf)
# emu = Emu.new(buf)
# emu.run エラー内容 ❯❯❯ make run
crystal run src/nes.cr
/usr/bin/ld: cannot find -lcimgui (this usually means you need to install the development package for libcimgui)
collect2: error: ld returned 1 exit status lib/imgui-sfml 内に libcimgui.so があるかつ LD_LIBRARY_PATH を設定していてもエラーとなってしまう |
require を一つずつ確認していくと、 https://github.com/oprypin/crystal-imgui の通りにコンパイル・環境変数の設定を行ったところエラーが発生しなくなった |
サンプルを参考に、以下のコードを実装して require "./nes/emu"
require "crsfml"
require "imgui"
require "imgui-sfml"
window = SF::RenderWindow.new(SF::VideoMode.new(256, 240), "nes.cr")
window.framerate_limit = 60
ImGui::SFML.init(window) すると、以下のようなエラーが発生した symbol lookup error: /home/daiki/.cache/crystal/crystal-run-nes.tmp: undefined symbol: ImGui_SFML_InitW 雑にググったところこちらのスレッドが見つかった imgui-sfml の方が意図したライブラリを参照できていないっぽい export LD_LIBRARY_PATH="$(pwd)/lib/imgui-sfml;$(pwd)/lib/imgui/cimgui" すると、 ❯❯❯ make run
crystal run src/nes.cr
NVD3D10: CPU cyclestats are disabled on client virtualization
NVD3D10: CPU cyclestats are disabled on client virtualization
Failed to get GLXFBConfig which corresponds to the window's visual
Failed to get GLXFBConfig which corresponds to the window's visual
Setting vertical sync not supported |
このサンプル丸パクリで実行してみたら Window が表示された なので、後はライブラリのAPIの使い方を読みつつ実装していけばよさそう |
というか、ドットを表示するだけならとりあえず crsfml だけ入れればよかった |
No description provided.
The text was updated successfully, but these errors were encountered: