Archived

This topic is now archived and is closed to further replies.

How to display some graphics?

This topic is 5530 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all, im trying to make an othello game, as my first one, but im not sure what lib i should use to displays some pics. Could anyone give me some ideas please ? thanks

Share this post


Link to post
Share on other sites
First of all, what are you using?
DOS Consoles, Win32 Windows...

if DOS:
"Walk before you crawl."
Grap some code on how to make a window application,
then use GDI to load an image ( look up MSDN ).
Then use HDC to get the screen surface and put the picture on it with BitBlt.

if Win32:
WinApi is very useful, you should check out some neat functions on msdn.
Same thing: GDI to load image, HDC to transfer the image to the surface.

Share this post


Link to post
Share on other sites
it will be a win32 prog, and i think i will make some kind of tetris or othello clone. what would be better directx or winapi?

Share this post


Link to post
Share on other sites
Depends. The GDI is somewhat simpler than DirectX, but it''s much slower. That shouldn''t matter much for a tetris/othello game, though.

If you have the time to learn it, I would recommend DirectX. It is much more powerful, and you can do a lot more cool stuff with it (3D!)

Share this post


Link to post
Share on other sites
A nice place to begin with DX in my opinion is CDX. It''s an open source 2D class wrapper for DirectX 7. Also a good support structure for beginners.

Always remember, you''''re unique. Just like everyone else.

Share this post


Link to post
Share on other sites
Hmmm I think those people recommending OpenGL / DirectX are going for overkill. An othello game doesn''t really need hardware acceleration. A simple lib would do.

For simplicity I''d recommend SDL (http://www.libsdl.org), but the Win32 GDI works great too, but for a beginner I think SDL is more intuitive.

And if it''s a DOS program, GDI isn''t an option... not sure if SDL does DOS, but allegro''s a great option, someone else mentioned it.
But I would recommend you''d ditch DOS anyway, it''s dead.

Share this post


Link to post
Share on other sites
quote:
Original post by justin_speers
Hmmm I think those people recommending OpenGL / DirectX are going for overkill. An othello game doesn''t really need hardware acceleration. A simple lib would do.


Who said anything about hardware accelleration... Personally i just think DX (or OpenGL...) is easier than GDI. But then again, i''ve never had good luck with GDI

For simplicity I''d recommend SDL (http://www.libsdl.org), but the Win32 GDI works great too, but for a beginner I think SDL is more intuitive.

If memory serves me correctly, SDL will use DX/OpenGL/GDI depending on what you tell it to do and what dll''s to load for it...

Always remember, you''''re unique. Just like everyone else.

Share this post


Link to post
Share on other sites
quote:

Who said anything about hardware accelleration... Personally i just think DX (or OpenGL...) is easier than GDI. But then again, i've never had good luck with GDI


Hmm, well I guess that's just a difference of opinion there then. For a quick little simple thing that just puts a few bitmaps on the screen I think GDI is simpler. But others may see things differently...

quote:
If memory serves me correctly, SDL will use DX/OpenGL/GDI depending on what you tell it to do and what dll's to load for it...


Yeah, SDL does use GDI or DirectX, I just think it simplifies things, and as an added bonus it's cross-platform. I think the API is cleaner. And OpenGL I would think would be difficult for a beginner to pick up for a simple othello game, there's easier ways to get an image on the screen. I love OpenGL, but for a program like this, for someone who's a beginner, I think it's out of the question.

So to sum it up, everyone is entitled to their opinions, but I recommend SDL!

[edited by - justin_speers on October 24, 2002 2:40:26 PM]

Share this post


Link to post
Share on other sites
Personally, I''d suggest DirectX. DirectDraw is a very easy to learn interface and allows you to do some pretty nifty stuff. But it has a couple of more advanced concepts to it.

The Win32 GDI is pretty simple if you know how to code Windows programs. If you can get a window up and running, using GetDC(HWND HandleToWindow) will get you a sort of pointer to a section of memory you can write to to draw in the window (well, loosely, that''s what it is; the hDC). You can then write pixels using SetPixel(HDC HandleToDeviceContext, int XPos, int YPos, int Color) and read using GetPixel(HDC HandleToDeviceContext, int Xpos, int YPos).

Though while SetPixel and GetPixel are really fine GDI functions, they''re slow. You probably wouldn''t want to write sprites pixel by pixel, much less backgrounds or the likes. There''s a function that allows you to directly copy graphics, BitBlt(HDC DestinationDC, int X, int Y, int Width, int Height, HDC SourceDC, int SourceWidth, int SourceHeight, int CopyMethod).

The Win32 GDI is slow, but gets the job done. You might want to have a look at it before DirectDraw.

Share this post


Link to post
Share on other sites