Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C++ Programming
#1
I'm working on a game, but for now, it has no graphics, becase i'm working on all the internal bullcrap first, like damage formula's etc, so am currently working on a text based battle simulator, however, i started working in the obsolete Boreland C++ for MS-DOS, i thought it was about time to get with the times, and upgrade to Microsoft Visual C++, and obviously, it doesn't compile, because all the old screen functions have been removed

what i'm looking for now, is help with something that'll output shitload of values to the screen, and possibly some buttons to tell it what to do next.
since i'll eventually be replacing all this by ingame graphics. Preferably something that doesn't need anything new downloading, though i am willing to. basicly what i'm after is a tutorial for raw code.

here's a few snippets of my current MS-DOS output code i'm looking to replace if that helps

my old window drawing routines
Code:
// Screen variables
byte currentwindow;
const byte win[4][6]={{5,4,56,20,15,1},{5,24,38,46,15,1}, //literal 'window' frame bounderies
            {43,24,76,46,15,1},{61,4,76,20,15,1}};
byte x[4]={1,1,1,1};
byte y[4]={1,1,1,1};

void drawscreen()
{ //Draw and clear all windows
    window(1,1,80,50); //clear full screen to lightgrey
    textbackground(7);
    clrscr();
    for(int i=0;i<=3;i++)
    {
        window(win[i][0]+1,win[i][1]+1,win[i][2]+1,win[i][3]+1);
        textbackground(0); //black
        clrscr();
        window(win[i][0],win[i][1],win[i][2],win[i][3]);
        textcolor(win[i][4]);
        textbackground(win[i][5]);
        clrscr();
        x[i]=1;  //reset window curser locations
        y[i]=1;
    }
    setwindow(0);
}

void setwindow(byte i)//set text window
{
    x[currentwindow]=wherex();//store curser location of current window
    y[currentwindow]=wherey();
    window(win[i][0],win[i][1],win[i][2],win[i][3]);
    textcolor(win[i][4]);
    textbackground(win[i][5]);
    gotoxy(x[i],y[i]); // restore curser
    currentwindow=i;
}

something that uses my window drawing code
Code:
void displayunits()
{
    setwindow(3);
//    clrscr();
    gotoxy(1,1);
    for(int i=0;i<=7;i++)
    {
        if (i<numberofunits) cprintf(" %d : %10s\r\n",i,unit[i].name);
        else cprintf("               \r\n");
    }
}

void displaystats(byte window, byte unum)
{
    setwindow(window);
    gotoxy(1,1);

    cprintf("\r\n Name: %10s\r\n",unit[unum].name);
    cprintf(" Level:  %3d  Experiance: %7.0f\r\n\n",unit[unum].level,unit[unum].exp);
    cprintf(" Points:   %3d   Max: %3d\r\n",unit[unum].points,points[unit[unum].level-1]);
    cprintf(" Levelt:  %4d   BSStart %5.3f\r\n\n",bslm[unit[unum].race][unit[unum].level-1],bsstart[unit[unum].race]);
    cprintf(" Health: %5d   energy: %5d\r\n\n",unit[unum].health,unit[unum].energy);
    cprintf(" Str: %5.1f Agi: %5.1f Int: %5.1f\n\r",unit[unum].bs[0],unit[unum].bs[1],unit[unum].bs[2]);
    cprintf(" Wil: %5.1f Sta: %5.1f Dex: %5.1f\n\r",unit[unum].bs[3],unit[unum].bs[4],unit[unum].bs[5]);
    cprintf(" Tot: %5.1f\r\n\n",unit[unum].bs[0]+unit[unum].bs[1]+unit[unum].bs[2]+unit[unum].bs[3]+unit[unum].bs[4]+unit[unum].bs[5]);
    cprintf(" HP: %5d  EP: %5d  Spd: %4d\n\r",unit[unum].stats[0],unit[unum].stats[1],unit[unum].stats[2]);
    cprintf(" Rgn: %4d  Med: %4d \n\r",unit[unum].stats[3],unit[unum].stats[4]);
    cprintf(" Acc: %4d  Eva: %4d\n\r",unit[unum].stats[5],unit[unum].stats[6]);
    cprintf(" Mel: %4d  Rng: %4d  Sor: %4d\n\r",unit[unum].stats[7],unit[unum].stats[8],unit[unum].stats[9]);
    cprintf(" Dfn: %4d  Rst: %4d\r\n\n",unit[unum].stats[10],unit[unum].stats[11]);
    cprintf(" Str: %5d Agi: %5d Int: %5d\n\r",unit[unum].bsmax[0],unit[unum].bsmax[1],unit[unum].bsmax[2]);
    cprintf(" Wil: %5d Sta: %5d Dex: %5d\n\r",unit[unum].bsmax[3],unit[unum].bsmax[4],unit[unum].bsmax[5]);
    cprintf(" Tot: %5d",unit[unum].bsmax[0]+unit[unum].bsmax[1]+unit[unum].bsmax[2]+unit[unum].bsmax[3]+unit[unum].bsmax[4]+unit[unum].bsmax[5]);
}
Reply




Users browsing this thread: 1 Guest(s)