Skip to main content
GameDev.net gamedev.net
🔒 Locked

C++ panel rendering

Started by ehguacho2008 Nov 19, 2012 at 6:55 AM 6 replies 3.6k views
Original Post
ehguacho2008
ehguacho2008
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:

MoleMania.png

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..
Eliad Moshe
Eliad Moshe
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 DOSBox source code for inspiration.

Have fun!
Endurion
Endurion
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.
Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>
clashie
clashie
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.
ehguacho2008
ehguacho2008
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 :\
Endurion
Endurion
I only ever used SDL, but AFAIR SDL simply draws to the client area of a window (form) already, nothing special to set up for that.
Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>
ehguacho2008
ehguacho2008
by default, whilst using SDL you've to create a window to use as the render target, but i know there's a chance to use an MFC dialog for that, but i don't know how...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.