Jump to content

  • Log In with Google      Sign In   
  • Create Account

C++ panel rendering


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 ehguacho2008   Members   -  Reputation: 110

Like
0Likes
Like

Posted 19 November 2012 - 12:55 AM

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:

Posted Image

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

Sponsor:

#2 Eliad Moshe   Members   -  Reputation: 813

Like
0Likes
Like

Posted 19 November 2012 - 04:33 AM

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!

Edited by Eliad Moshe, 19 November 2012 - 09:52 AM.


#3 Endurion   Crossbones+   -  Reputation: 3682

Like
2Likes
Like

Posted 19 November 2012 - 05:11 AM

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>

#4 clashie   Validating   -  Reputation: 479

Like
2Likes
Like

Posted 19 November 2012 - 05:19 AM

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.

#5 ehguacho2008   Members   -  Reputation: 110

Like
0Likes
Like

Posted 19 November 2012 - 06:42 PM

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 :\

#6 ehguacho2008   Members   -  Reputation: 110

Like
0Likes
Like

Posted 21 November 2012 - 08:18 PM

anybody?? :'(

#7 Endurion   Crossbones+   -  Reputation: 3682

Like
0Likes
Like

Posted 21 November 2012 - 11:36 PM

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>

#8 ehguacho2008   Members   -  Reputation: 110

Like
0Likes
Like

Posted 22 November 2012 - 07:18 PM

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS