C++ panel rendering

Started by
6 comments, last by ehguacho2008 11 years, 4 months ago
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..
Advertisement
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!
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>

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.
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 :\
anybody?? :'(
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>

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...

This topic is closed to new replies.

Advertisement