Is there any way at all to do DOS graphics with C++? I've searched for days on this and I don't think it's possible. Simply a function to set a pixel to a certain color is all I need.
Is there any way at all to do DOS graphics with C++? I've searched for days on this and I don't think it's possible. Simply a function to set a pixel to a certain color is all I need.
nerds unite!
I'm using windows XP.
I'm using dev-C++ by bloodshed.
there's a graphics library in some header file. but it's not standard and most compilers don't include it.
i seem to have GCC 3.3.4
But how do i start it?
I dont have a menu for it or anything.
hey i use those all the time...
email me at
[email protected]
or aim at
nsannagable
... and i will give you a short tutorial
Allegro? Is that DOS?
"If you tell the truth, you don't have to remember anything"
-Mark Twain
It used to be. Now it is for alot of platforms and of course still dos.
He is probably talking about 13h mode.
Woop?
Well unless the OP gets around to posting the actual compiler and operating system in use, then there isn't much more that can be said.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Dev c++ by bloodshed and the operating system in use?
Shouldn't "DOS graphics" make that obvious enough?
nerds unite!
I'm using windows XP.
I'm using dev-C++ by bloodshed.
Nope. FreeDOS != MS-DOS != Windows 9X DOS != Windows NT DOS Emulation != ...
Windows XP command prompt.
nerds unite!
I'm using windows XP.
I'm using dev-C++ by bloodshed.
No. It doesn't. DOS graphics can be done on virtually any 16-bit compiler. I recommend 32-bit DJGPP however. You can use Allegro for DOS if you want, but if you don't understand anything about programming games it won't be of much use to you.Shouldn't "DOS graphics" make that obvious enough?
Here is a small DOS mode 13h unit.
If I didn't make any errors this should work just fine. Add functions to the class as you see fit.Code:#include <dos.h> typedef unsigned char BYTE; typedef unsigned int WORD; tyepdef unsigned long DWORD; #define TRUE 1 #define FALSE 0 #define XYTOMEM(x,y) (((y)<<(8))+((y)<<(6))+(x)) class Display { protected: int m_iBufferMode; BYTE far *m_pScreen; BYTE far *m_pBuffer; BYTE far *m_pSurface; public: Display(void):m_iBufferMode(FALSE),m_pScreen(0),m_pBuffer(0),m_pSurface(0) {} virtual ~Display(void) { if (m_pBuffer) delete [] m_pBuffer; m_pBuffer=0; m_pScreen=0; m_pSurface=0; } void SetBufferMode(int bufmode=TRUE) { switch(bufmode) { case TRUE: m_pSurface=m_pBuffer;m_iBufferMode=TRUE;break; default: m_pSurface=m_pScreen;m_iBufferMode=FALSE;break; } } int Init(void) { REGS regs; regs.x.ax=0x13; int86(0x10,& regs, & regs,); m_pBuffer=new BYTE[64000L]; if (!m_pBuffer) return (-1); m_pScreen=(BYTE far *)MK_FP(0xA000,0); m_pSurface=m_pScreen; m_iBufferMode=FALSE; return TRUE; } void SetPixel(WORD offset,BYTE color) { m_pSurface[offset]=color; } void SetPixel(int x,int y,BYTE color) { m_pSurface[XYTOMEM(x,y)]=color; } BYTE GetPixel(WORD offset) { return m_pSurface[offset]; } BYTE GetPixel(int x,int y) { return m_pSurface[XYTOMEM(x,y)]; } //Always flips from buffer to screen no matter buffermode void Flip(void) { BYTE far *ptrBuf=m_pBuffer; BYTE far *ptrScrn=m_pScreen; asm { push ds les di,[ptrScrn] lds si,[ptrBuf] mov ecx,32000d rep movsd pop ds } } };
Last edited by VirtualAce; 04-22-2005 at 08:57 PM.
> Dev c++ by bloodshed
> Windows XP
Then start using LIBSDL (just look at the packages menu in dev-c++ and download a pre-configured package).
Then goto http://www.libsdl.org/index.php and start reading examples, tutorials etc.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.