TASEmulators / BizHawk

BizHawk is a multi-system emulator written in C#. BizHawk provides nice features for casual gamers such as full screen, and joypad support in addition to full rerecording and debugging tools for all system cores.
http://tasvideos.org/BizHawk.html
Other
2.19k stars 384 forks source link

How to draw a line from C# source code #812

Closed SavantAI closed 7 years ago

SavantAI commented 7 years ago

Hello,

I've been trying to draw a line over a NES game (Mario in this case). I'm trying to do this from within the source code of Bizhawk C# not LUA.

I'm using DirectDraw and SlimDX to render.

Can anyone help me? :) Thanks!

zeromus commented 7 years ago

You can't use slimdx, you have to use our wrapper. Try editing FinalPresentation filter in Gui.cs (make sure to clear IsNop) if you want to do this 3d-like; or to do it as if it would be done in lua, copy how lua does things (begin with GlobalWin.DisplayManager.LockLuaSurface) and put your drawing code before the call to UpdateSource() in Render() on MainForm

SavantAI commented 7 years ago

Thanks for your answer,

I've been able to draw a line so far by adding code to Gui.cs.

I have not yet been able to find a way to access the Gui.cs code from MainForm.cs.

My Idea was to put some code in MainForm.cs that sends an array of lines to be drawn in the Gui.cs class, but I can't seem to find how to connect them if that makes sense :)

Thanks again!

SavantAI commented 7 years ago

EDIT: I found a way to do it, it's not pretty but it works, thanks! :)