Sign in to follow this  
ehguacho2008

C++ panel rendering

Recommended Posts

hi everyone! i'm new at the forum so please forgive me if my question is missplaced.

the problem is that i'm developing a windows based gameboy emulator in c++, and i need to put a panel (or somerthing like that) inside the main form to set it as the render target. this image may explain what i'm trying to say:

[img]http://fms.komkon.org/VGB/snaps/MoleMania.png[/img]

the fact is that i don't know how to create the control and attach it to the main form. can anybody give a hand? every hint will be welcome!

thanks in advance..

Share this post


Link to post
Share on other sites
You can use a simple media layer such as: SDL or Allegro.
If you are targeting only windows and use the win32 API read about: GDI, GDI+ and Direct2D.

Also, take a glance at the [url="http://www.dosbox.com/download.php?main=1"]DOSBox[/url] source code for inspiration.

Have fun! Edited by Eliad Moshe

Share this post


Link to post
Share on other sites
For that you don't need a panel. Just create a dialog, attach a menu and the rest of the client area can be WM_PAINTed to.

If you do need a child control, RegisterClass a new window type and CreateWindow it with WS_CHILD set into your parent.

Share this post


Link to post
Share on other sites
It's probably just drawing straight to the window itself, not a specific control. If you're in need of a framebuffer to just dump pixels to, the simplest way on Windows is probably a DIB Section. It's just a few lines to init and you'll just get a pointer directly to the data, BitBlt() to the screen when you're done.

Share this post


Link to post
Share on other sites
thank you all for your quick responses (:
i used Allegro and SDL on older projects, so i know how to deal with 'em, but the problem is that i don't know how to set the form's client rectangle as the rendering target. how do i set the form's backbuffer as the rendering target for SDL or Allegro??? that's THE question for me :\

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this