C# graphics.

Started by
6 comments, last by raigan 14 years, 10 months ago
hey all, I was learning opengl with C++, when i decided to make a C# pacman for my programming class in school. And im fairly lost because im used to C++/opengl (which so far i like more, but no need for a flame war.... yet?) Anyways, the way im drawing to the screen is that i have 2 graphic objects, one from the actual form and another from a bitmap. and i was saving the bitmap to the bg of the form, and recreating the form graphics. at first it thought that it would make it faster bc it doesnt seem to me as though itd take much processing to set a bg. BUT!! I still get a flicker. And i dont know how to do this correctly. Can anyone explain to me a faster way?
Advertisement
Have you looked into XNA?
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
Try this:

http://www.bobpowell.net/doublebuffer.htm
http://www.codeproject.com/KB/graphics/DoubleBuffering.aspx
[size="1"]
If you just want to do this for your class, you'll definitely want to double buffer, as the Mighty Pigeon said. It should be less work to implement that into your existing code than rewriting using OpenGL for C# or XNA.

Just keep in mind that what you're doing is rather slow compared to OpenGL and DirectX. It shouldn't be material for a simple Pac man game, but when you go beyond you should definitely go for XNA as Mike suggested.
----Erzengel des Lichtes光の大天使Archangel of LightEverything has a use. You must know that use, and when to properly use the effects.♀≈♂?
well to my understanding, id have to install the XNA libraries, and the computers at school are heavily restricted.

If i could've used additional graphics libraries, i couldve been done by now.

Also, i already had double buffering on, through the form options, but i followed the directions, and it still flickers. im pretty sure my code is inefficient which im looking into.

but thanks for the help
Maybe you could enlighten us to the specs of your schools PCs. GDI is a slow beast IMO, but if your school is like my previous employment (a training facility), then you have Celeron 666's with some kinda intel integrated graphics thing that can barely play Doom.
http://reviews.cnet.com/desktops/gateway-profile-6-sbb/4507-3118_7-31814646.html?tag=mncol;psum


but even my pc at home which pulls gears of war quite well, was flickering.
If you're comfortable with OpenGL, you could just use it in C# via Tao.OpenGL: http://www.mono-project.com/Tao

This topic is closed to new replies.

Advertisement