• Advertisement

Archived

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

A Real Beginner Problem

This topic is 5098 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

I wanna start to make an easy game as said in "for beginners" link.I will do it by using C on DOS Screen. but as I said I''m a beginner. I dont how to show my bmp file on the screen by using C. Is there any function or code to show bmp file. And I wanna learn how you move the object(or bmp file) on the screen.Do you erase all the screen and you redraw it again when the object move? or do you erase the object which will be move and redraw the object? or is there any other method? Thanks a lot for your help.

Share this post


Link to post
Share on other sites
Advertisement
Well - the answer is simple: You can''t do ANY graphics (except ascii-art) on the console (DOS screen).

Oxyd.

Share this post


Link to post
Share on other sites
In order to get started with graphics you will need to learn an API (application programming interface) such as DirectDraw, SDL or Allegro.

DirectDraw is very suited to those just started out programming as it requires some knowledge of the Win32 AI which you don''t necesarily want to be dealing with when you want to get started programming graphics.

I would recommend either SDL or Allegro as these are very easy to get started with and allow you to get right stuck with graphics with the minimum of fuss.

There is another library you might want to check out which is GLUT which provides an easy way to get started with OpenGL, I''ve never used it so I can''t comment on it but here are the links for the above libraries:

SDL
Allegro
GLUT
DirectDraw

Share this post


Link to post
Share on other sites
quote:
Original post by Oxyd
Well - the answer is simple: You can''t do ANY graphics (except ascii-art) on the console (DOS screen).

Oxyd.


How did programmers make games before windows?

Spudder : Do I have to use an API? And SDL or others work on DOS or WINDOWS?

Share this post


Link to post
Share on other sites
If you mean, how did they get the graphics onto the DOS screen in REAL ms-dos, then they directly accessed the video memory. However, windows does not allow you to directly access the video memory, so you must use some of theese api''s.

To answer the other question (well - it''s not addressed to me, but well... ): Except DirectDraw, I think, that all of them works under windows and linux (and maybe others), but not under the old and ancient dos. (Read this and this. They do not contain any useful informations, however it''s quite funny and about the anciency of the DOS ).

Oxyd

---
- Unreadable code is code written on a piece of paper, but not the one, in which the programmer is using a space in the place you don''t.

- Real programmers aren''t afraid of goto

Share this post


Link to post
Share on other sites
If you can''t have graphic in dos when you have a new OS like windows xp, how come i can play old DOS games?

Share this post


Link to post
Share on other sites
I believe theres some dos emulation going on or something, when you program for "dos" its really called the console.... which isnt all that dos is\was if im not mistaken... this is mostly speculation... but yeah...
-Dan

Share this post


Link to post
Share on other sites
>>Well - the answer is simple: You can''t do ANY graphics
>>(except ascii-art) on the console (DOS screen).
well - effectively - this is wrong, sorry; there are enough opportunities, to get direct framebuffer DOS-mode-13h-style-like, even in your windows console; but...yes, you have to use additional tools/libs.


DJSnow
---
this post is manually created and therefore legally valid without a signature

Share this post


Link to post
Share on other sites
The console is not DOS. It is just a funny screen in windows that looks like the command prompt ( not real DOS either )

Share this post


Link to post
Share on other sites
i think this guy is just confused...

if your programming basic "hello world" stuff in c++, this is NOT DOS. this is the windows console, big difference. DOS is an operating system.

Share this post


Link to post
Share on other sites
quote:
Original post by XELON
quote:
Original post by Oxyd
Well - the answer is simple: You can''t do ANY graphics (except ascii-art) on the console (DOS screen).

Oxyd.


How did programmers make games before windows?

Spudder : Do I have to use an API? And SDL or others work on DOS or WINDOWS?


You can''t do bitmapped graphics in Console Applications, duh.

Share this post


Link to post
Share on other sites
I think I found how to show the image.And it can run on console


#include <dos.h>
#include <conio.h>

// Global Variables

int OldMode; // variable to save user''s original mode

unsigned char far *VgaScreen; // variable to point to screen


// Function Declarations

void OpenGraph();
void CloseGraph();

// Main Program

void main()
{
OpenGraph(); // open graphics mode 0x13

*VgaScreen = 1; // display a blue dot

getch(); // wait for a keypress

CloseGraph(); // back to user''s original mode

}

////////////////////////////////////////////////////

// OPENGRAPH //

// Gets into graphics mode 0x13 (320x200x256) //

////////////////////////////////////////////////////

void OpenGraph()
{
union REGS regs;

VgaScreen = MK_FP(0xA000, 0x0000); // set pointer to screen address

OldMode = peekb(0x0040, 0x0049); // save user''s video mode first


regs.h.ah = 0x00; // service 0, Set Video Mode

regs.h.al = 0x13; // set graphics mode to 320x200x256

int86(0x10, ®s, ®s); // execute BIOS call

}

////////////////////////////////////////////////////

// CLOSEGRAPH //

// Restores user''s original video mode //

////////////////////////////////////////////////////

void CloseGraph()
{
union REGS regs;

regs.h.ah = 0x00; // service 0, Set Video Mode

regs.h.al = OldMode; // set graphics mode back to user''s

int86(0x10, ®s, ®s); // execute BIOS call

}

Thanks for your help...

Share this post


Link to post
Share on other sites

  • Advertisement