PDA

View Full Version : Bitmap



IlovePascal
26-08-2006, 04:13 AM
Hello, I have always been very enthusiastic about making complex games and AIs and I never really think about the visual effects. Now that I have spent a whole day (omg!) reading articles in this awesum site, I really want to learn how to copy and paste Bitmap (or any other format) images. I only use Dev-Pascal, so if anyone could help me with the code to use and the header files to include, I thank you very much.
Since Im here, I would also like to ask if anyone has spent enough time designing a character (however simple or complex) that looks good and who would like to share the code with me. (It could be several simple drawings that alternate to give a moving illusion, for example, or anything else!) Well, hoping to get heaps of answers soon!! ;)

Traveler
26-08-2006, 10:55 AM
Hi and welcome to PGD

Designing a game character is beyond the scope of pascal. It really depends on how well your abilties are with either a graphical tool like Photoshop, Paint Shop Pro or Gimp, or more advanced tools like 3DStudio Max, Lightwave, Blender or Anim8or.

Pascal comes into play, after you have created a set of frames in where your gamecharacter performs a certain action, like walking, jumping or shooting and when you've loaded each frame (or a single bitmap in case your engine only accepts a strip of frames) into the game engine.

The only piece of code involved here is how to load these frames in the engine. This again depends on what you plan on using. Are you for example using SDL, or perhaps plain Directx or Opengl?

Making the character (sprite) to animate, and for example walk off the screen, is a 'simple' matter of changing each frame at a certain interval and at the same time, displace each frame a arbitrary number of pixels to the left or right until it is nolonger visible.

So, I guess what we really need to know is what you are using. Opengl, sdl, 2d, 3d, what you are familiar with, that sort of things.

IlovePascal
26-08-2006, 09:56 PM
Ok, well, I feel bad to say I don't know any of those things you listed. In fact, all I usually use is what Dev-Pascal has by default, that is to say lines and circles! Yeah I know it's basic, but that's what I was saying before, I usually focus on what it does, not how it looks.

And when I started this topic, what I was really thinking about was procedures like the ones in C getpic and putpic and the ones that get a bitmap image from the given adress and draw them in the graphics window.

However, I would be glad to download one of those 2D or 3D packages, if there are free ones around and if it would make things easier.

If there is a way of sending .exe files in this site, I could send you one so you have an idea of what Im talking about (I can't really copy and paste the code because it's 1000 lines long!).

Thank you very much for your time, and hope to hear from you again

godbeast
26-08-2006, 11:37 PM
I don't know exactly what kind of game you're working on, but I think that SDL would suit your needs. You can load common graphic files (via sdl_image; bitmaps, png, jpg, gif etc.) into surfaces and do everything with them 8)

SDL is free, it has bindings to pascal thanks to Savage. See SDL forum on PGD to get more info, and visit the website: http://www.delphi-jedi.org/Jedi:TEAM_SDL_HOME. I started with it about a month ago and I'm really satisfied with it. Feel free to ask if you need instructions.