Advertisement

DOS mode 13h with VC++ [im new at grafix programming]

Started by February 09, 2001 01:03 AM
11 comments, last by newGrafix 23 years, 11 months ago
greetings ive been working hard with c++ and gained enough knowlege to code simple text based games. I would like to start adding simple grafix to these games, but dont know how. i have been trying to find some resources, but they dont work in VC++6 because header files and lib''s are missing. so...can someone help me with this problem? any information regarding this topic IS APPRECIATED. if nobody can help with mode 13h, i wouldnt mind DirectX. (but simple things, im new at this grafix stuff) thanks :-)
This kind of a topic would really be best explained by a book. Any of the type aimed at "teach yourself game programming" usually have a good foundation of basic info.
It''s also invaluable to have a refrence to flip through while you''re learning this kind of stuff.
Advertisement
Get a book on DirectX programming. Trick of the Windows Game Programming Gurus will do nicely.

You''ll need Direct X to do any fullscreen graphics in Windows.
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.
I would agree with NuffSaid. Start with Direct X.
DOS is deader then dead.
------------------------------------------------------------I wrote the best video game ever, then I woke up...
In order to use DirectX, you have to know windows programming, and such.
If you''re looking for simplicity, and As long as what you''re doing is not for commercial use and you don''t tend to have much of publicity for your product, dos is just right for learning purposes.

I suggest getting djgpp,
which is free and can be used for that purpose.
I found a good article which explains how to set that mode, could get you started, It''s available here:
http://www.flipcode.com/demomaking/issue02.shtml









AquDev - It is what it is.
You''re right that MSVC++ 6 doesn''t come with the headers necessary for something like that. Why? Because MSVC only produces Windows executables. Even those console mode programs are Windows only (try running one from pure DOS). You can''t use Mode 13h and the like because you''d be calling interrupts and using system memory directly, both things that Windows programs don''t like or allow.

To get started, I would take Aqutiv''s advice and try DJGPP. You can do all that stuff from there. Windows and DirectX are very nice indeed but unfortunately neurosurgery seems easier to learn If you really want to keep using MSVC, I recommend a graphics library that''ll wrap DirectX''s nastiness into some neat little packages. Two that come to mind are Allegro and CDX. The former masks everything to make the code look like a DOS program and the latter only requires that you learn some of the simpler Windows API stuff.

To get Allegro Not the official site but good enough.

To get CDX

-Goku
SANE Productions Homepage
Advertisement
There''s a great series of articles here at GDnet on moving from DOS to Windows and it contains lots of information on graphics programming. I wouldn''t bother learning DOS graphics programming because it doesn''t make sense in the long run.

Try this:
http://www.gamedev.net/reference/programming/features/gpgenesis1/
It''s interesting and it brings a smile to my face when I hear your situation. It isn''t that I am happy you have a problem but that I also had the same problem. It isn''t that VC++ is missing headers, it is that VC++ is for windows and the newer versions really aren''t designed to create DOS programs. It is interesting to play around with 13h mode in DOS. I suggest you do it. There are older books out there which do cover this topic. Teach yourself game programming in 21 days is a good book to purchase. Also Tricks of the game programming gurus is in the same boat. However, I wouldn''t spend too much time with DOS. Windows is the platform of the new millennium DOS is really gone now. Therefore, go get Tricks of the Windows Game programming Gurus. I have it and it is pretty good. It is a little difficult at first but nice. You may also want to look in to Java. It is slower but has nice graphics classes, it''s easy to use, and it has built in, easy to use, networking classes. I hope I was helpful.

-Temer
Ok, what you are trying to do is possible! I've seen it done, and yes even with MSVC. However, I've found a much better way that is very easy and runs in windows( and also compiles in linux macOS and BeOS) and you dont have to worry about all the wierd windows junk. Head over to http://www.libsdl.org/ and get their SDL library, Its free! Here let me show you how easy it is to use...the following program sets up a window at 640x480x32bpp loads a BMP and pastes the bitmap anywhere you click in the window. Now how hard would that be to do in dos???? The library will automatically use DirectX or OpenGL ect...depending on whats available...if you want to play with polygons you can also easily incorporate the more advanced OpenGL functions into your SDL programs
    #include <SDL\SDL.h>int main( int argc, char* argv[] ){	SDL_Event	event;	bool		done=false;	SDL_Surface *screen;	SDL_Surface *image;	SDL_Rect dest;	SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO|SDL_INIT_TIMER);		image = SDL_LoadBMP("ball.bmp");	if ( image == NULL )	{		// SDL_GetError() put error code here		return 1;	}		screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);	if ( screen == NULL )	{		// SDL_GetError() put error code here		return 1;    }		// set transparent color	SDL_SetColorKey(image,SDL_SRCCOLORKEY,SDL_MapRGB(screen->format, 255, 255, 255));	// convert surface for faster drawing	image=SDL_ConvertSurface(image,screen->format,SDL_SRCCOLORKEY);	do	{		if (SDL_GetAppState() != 7 && SDL_GetAppState() != 6)		{			// if its minimised or not focused			// then pause and wait for events			SDL_WaitEvent(&event); 		}				while ( SDL_PollEvent(&event) ) 		{			switch (event.type) 			{			case SDL_KEYDOWN:				// SDL_GetKeyName(event.key.keysym.sym)	: the name of the key				// (Uint8)event.key.keysym.sym			: the ascii code of the key				break;			case SDL_MOUSEMOTION:				// event.motion.xrel	: the relative amount the mouse moved on x				// event.motion.x		: last position of the mouse				break;			case SDL_MOUSEBUTTONDOWN:				// event.button.button	: the number of the button				// event.button.x		: x coordinate at button press				if (event.button.x+image->w < screen->w && event.button.y+image->h < screen->h)				{					dest.x = event.button.x;					dest.y = event.button.y;					dest.w = image->w;					dest.h = image->h;					SDL_BlitSurface(image, NULL, screen, &dest);					/* Update the changed portion of the screen */					SDL_UpdateRects(screen, 1, &dest);				}				break;			case SDL_QUIT:				done=true;				break;			}		}	} while (!done);		SDL_FreeSurface(image);		// not nessisary but i put it in anyway	SDL_FreeSurface(screen);	// not nessisary but i put it in anyway	SDL_Quit();	return 0;}     


Edited by - warpexplorer on February 9, 2001 3:11:45 PM
newGrafix

THANKS to all who posted a reply. i found the info very useful
and found answers to quite a few other questions.

thanks :-)

This topic is closed to new replies.

Advertisement