Well it looks like you are in console mode which is not going to work. If you could get a small DirectX startup module working you could plot pixels via DirectX and pointers to your double buffer and primary surfaces.
The only way in console mode is to plot periods - which looks dumb and which is reverse of graphics. Text is in row,col which is actually y,x - also the values I used in the starfield program are much too large for text mode.
For DOS users this code will complete the program. Note that I used some assembly - but you do not have to. For flipping the back buffer to the screen you could memcpy() and for clearing the screen use memset(). Please no stupid comments about the code not being portable, only for DOS, blah, blah, blah....
Because this code can be used inside of a DirectX framework as well as D3D - but in D3D would be a bit different. The DirectX version of this code only lacks the back buffer and primary surface code (locking, unlocking, etc)- as well as the startup section.
Here is the new main:
//y*320+x - most compilers should turn this into the following
typedef unsigned char BYTE;
//Real-mode pointers to double buffer and screen
BYTE far *Screen;
BYTE far *Buffer;
void CLS(BYTE far *tBuffer,BYTE color);
void PlotPixel(int x,int y,BYTE color);
//Init screen mode and pointers
int86(0x10,& regs,& regs);
Screen=(BYTE far *)MK_FP(0xa000,0);
//Should check for Buffer validity here, but didn't
//Clears any 64000 byte buffer to the set color
void CLS(BYTE far *tBuffer,BYTE color)
mov cx,07D00h //32000 words
//Copies memory - uses words, not bytes
//Copies back buffer to video memory
//Plots a pixel - do not call this - place this in DrawStars() as is
//Calling this inside of the draw loop slows the program down
void PlotPixel(int x,int y,BYTE color)
Here is the new DrawStars()
for (int i=0;i<NUMSTARS;i++)
if (x>0 && x<320)
if (y>0 && y<200)