Where to learn C++

Discussion in 'Computer Programming, Emulation, and Game Modding' started by Keeley, Jul 30, 2009.

Jul 30, 2009

Where to learn C++ by Keeley at 11:06 PM (1,379 Views / 0 Likes) 17 replies

  1. Keeley
    OP

    Member Keeley GBAtemp Fan

    Joined:
    Nov 15, 2008
    Messages:
    421
    Location:
    Saskachewan
    Country:
    Canada
    Hey I want to learn C++ first before going into homebrew developing [​IMG] but since I don't know anything about C++ I never know if this site is "up to date" or not =( so can you programmers suggest an "up to date" site for C++?

    Thanks for all your answers!
     
  2. DeMoN

    Member DeMoN GBAtemp Guru

    Joined:
    May 12, 2004
    Messages:
    7,647
    Country:
    United States
  3. Wabsta

    Member Wabsta you fight like a dairy farmer

    Joined:
    Apr 25, 2008
    Messages:
    2,485
    Location:
    SCUMM Bar
    Country:
    Netherlands
    http://www.palib.info/wiki/doku.php

    That's a pretty good start for Homebrew (for the NDS though).

    But I recommend that you start with another language, like JAVA, or even PHP.
     
  4. Joe88

    Member Joe88 [λ]

    Joined:
    Jan 6, 2008
    Messages:
    11,185
    Location:
    NYC
    Country:
    United States
     
  5. Wabsta

    Member Wabsta you fight like a dairy farmer

    Joined:
    Apr 25, 2008
    Messages:
    2,485
    Location:
    SCUMM Bar
    Country:
    Netherlands
    True, but not necessarily for C++, you could just learn the basics from, for example, PHP, then it's not that difficult to learn C++ from teh interwebs.
     
  6. Keeley
    OP

    Member Keeley GBAtemp Fan

    Joined:
    Nov 15, 2008
    Messages:
    421
    Location:
    Saskachewan
    Country:
    Canada
    Wow thanks for the fast replies! Learn PHP first eh? Well then any good PHP learning sites?
     
  7. Wabsta

    Member Wabsta you fight like a dairy farmer

    Joined:
    Apr 25, 2008
    Messages:
    2,485
    Location:
    SCUMM Bar
    Country:
    Netherlands
    Hmm, I don't even remember how I learned it.. I just used google I guess.. =/
     
  8. Keeley
    OP

    Member Keeley GBAtemp Fan

    Joined:
    Nov 15, 2008
    Messages:
    421
    Location:
    Saskachewan
    Country:
    Canada
    Haha okay I'll go google some after supper and post the links here to see if there any good [​IMG]
     
  9. UltraMagnus

    Member UltraMagnus hic sunt dracones

    Joined:
    Aug 2, 2007
    Messages:
    1,967
    Location:
    Portsmouth
    Country:
    United Kingdom
  10. emupaul

    Member emupaul GBAtemp Fan

    Joined:
    Jun 26, 2009
    Messages:
    416
    Location:
    space
    Country:
    United States
    gotta think abstract, any good programmer worth a grain a salt will know the concepts well. School is unnecessary trust me I did two years in High-school (Turbo C compiler) and one year at a community college (Msvc compiler) To learn C/C++ all you need is the internet a couple books and some patients and time to code. Go get Sams Teach your self C in 24 hours and Core C++ A Software Engineering Approach and Don't get get caught up in M$ traps like VB and MFC

    lol this remides me of the time i programmed a pong game in BGI during class back in 2002 and uploaded at planet source code haha. Looking back at that code now I see how noobish it was, im far better now <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> well thats 7 year gap.

    Warning: Spoilers inside!

    <a href="http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=4112&lngWId=3" target="_blank">http://www.planet-source-code.com/vb/scrip...12&lngWId=3</a>
     
  11. Keeley
    OP

    Member Keeley GBAtemp Fan

    Joined:
    Nov 15, 2008
    Messages:
    421
    Location:
    Saskachewan
    Country:
    Canada
    @UltraMagnus

    ANSI C eh? I'll give that a thought =)

    @emupaul

    Thanks for the encouragement! I will become the most awesomest programmer ever...*crickets*
     
  12. myuusmeow

    Member myuusmeow GBAtemp Advanced Maniac

    Joined:
    Jun 24, 2007
    Messages:
    1,643
    Country:
    United States
    <!--quoteo(post=2156622:date=Jul 30 2009, 09:17 PM:name=emupaul)--><div class='quotetop'>QUOTE(emupaul @ Jul 30 2009, 09:17 PM) <a href="index.php?act=findpost&pid=2156622"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->gotta think abstract, any good programmer worth a grain a salt will know the concepts well. School is unnecessary trust me I did two years in High-school (Turbo C compiler) and one year at a community college (Msvc compiler) To learn C/C++ all you need is the internet a couple books and some patients and time to code. Go get Sams Teach your self C in 24 hours and Core C++ A Software Engineering Approach and Don't get get caught up in M$ traps like VB and MFC

    lol this remides me of the time i programmed a pong game in BGI during class back in 2002 and uploaded at it planet source code haha. Looking back at that code now I see how noobish it was, im far better now <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> well thats 7 year gap.

    <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:Pre;overflow:auto'>//paul adcock Jun 9 2002
    //My second version of pong. Includes 4 players and small amount of options
    #include<graphics.h>
    #include<iomanip.h>
    #include<conio.h>
    #include"c:\tc\int9.h"


    enum Direction{UP,DOWN,LEFT,RIGHT,UPRIGHT,UPLEFT,DOWNRIGHT,DOWNLEFT};

    enum MenuS{SCREEN1,SCREEN2,SCREEN3,SCREEN4,SCREEN5,
    SCREEN6,SCREEN7,SCREEN8,SCREEN9,SCREEN10,SCREEN11,
    SCREEN12,BEGIN,EXIT,INSTRUCTIONS,GAMESPEED,BALLCOLOR,
    PAUSED,GAMEOVER,SETLIVES,PLAYER1LIVE,PLAYER2LIVE,PLAYER3LIVE,PLAYER4LIVE};
    MenuS View=SCREEN1;

    struct PlayerType//player 1 settings control Speed of game and ball color
    {
    int Color;
    int Control;
    int Speed;
    int BColor;
    int Points;
    };

    void StartGfx();
    void Menu(PlayerType&player1);
    void Options();
    void CPC(PlayerType&player1,PlayerType&player2,PlayerType&player3,PlayerType&player4);
    void CPCYN();
    void BallColor();
    void GameSpeed();
    void ChoosePaddleColors(PlayerType&player1,PlayerType&player2,PlayerType&player3,PlayerType&player4);
    void ColorList();
    void Instructions();
    void Pause();
    void SetLives();
    void PlayerLivesMenu(PlayerType&player1,PlayerType&player2,PlayerType&player3,PlayerType&player4);

    void Intro(PlayerType&player1,PlayerType&player2,PlayerType&player3,PlayerType&player4);
    void Ball(int&x,int&y,int&r,int&c);
    void MoveBall(int&x,int&y,int&r,Direction&dir);
    void Border(int&x,int&y,int&r,Direction&dir,PlayerType&player1,PlayerType&player2,PlayerType&player3,PlayerType&player4);
    void TopPaddle(int&x1,int&x2,int&x,int&y,int&r,int&color,int&control,Direction&dir,int&ran);
    void BottomPaddle(int&x1,int&x2,int&x,int&y,int&r,int&color,int&control,Direction&dir,int&ran);
    void LeftPaddle(int&y1,int&y2,int&y,int&x,int&r,int&color,int&control,Direction&dir,int&ran);
    void RightPaddle(int&y1,int&y2,int&y,int&x,int&r,int&color,int&control,Direction&dir,int&ran);

    void main()
    {
    StartGfx();
    install_kb();
    Direction dir=DOWNLEFT;
    //////////////////////////////////////////
    int bx=320,by=150,br=10;//MoveBall Data///
    //////////////////////////////////////////
    //////////////////////////////////////////
    int pxt1=300,pxt2=360;////TopPaddle Data//
    //////////////////////////////////////////
    int pxb1=200,pxb2=260;//BottomPaddle Data/
    //////////////////////////////////////////
    int pyl1=200,pyl2=260;//LeftPaddle////////
    //////////////////////////////////////////
    int pyr1=50,pyr2=110;//RightPaddle///////
    //////////////////////////////////////////
    int ran;//random paddle directions.//doesnt work right , yet...
    PlayerType player1,player2,player3,player4;
    struct PlayerType p1={1,1,1,15,2};player1=p1;
    struct PlayerType p2={2,0,10,15,2};player2=p2;
    struct PlayerType p3={3,0,10,15,2};player3=p3;
    struct PlayerType p4={4,0,10,15,2};player4=p4;
    Intro(player1,player2,player3,player4);
    do
    {
    ran=rand()%2;
    Ball(bx,by,br,BLACK);
    MoveBall(bx,by,br,dir);
    Ball(bx,by,br,player1.BColor);
    Border(bx,by,br,dir,player1,player2,player3,player4);
    TopPaddle(pxt1,pxt2,bx,by,br,player2.Color,player2.Control,dir,ran);
    BottomPaddle(pxb1,pxb2,bx,by,br,player1.Color,player1.Control,dir,ran);
    LeftPaddle(pyl1,pyl2,by,bx,br,player3.Color,player3.Control,dir,ran);
    RightPaddle(pyr1,pyr2,by,bx,br,player4.Color,player4.Control,dir,ran);
    delay(player1.Speed);
    if(keys[KEY_ESC])
    {
    clearviewport();
    View=SCREEN1;
    Intro(player1,player2,player3,player4);
    }
    if(View==EXIT)
    {
    uninstall_kb();
    abort();
    }
    if(player1.Points<=0)
    {
    View=GAMEOVER;
    }
    if(player2.Points<=0)
    {
    View=GAMEOVER;
    }
    if(player3.Points<=0)
    {
    View=GAMEOVER;
    }
    if(player4.Points<=0)
    {
    View=GAMEOVER;
    }
    if(View==GAMEOVER&&player1.Points<=0)
    {
    clearviewport();
    do
    {
    settextstyle(1,0,4);
    outtextxy(10,50,"GAMEOVER");
    outtextxy( 10,100,"PLAYER 1 LOST, THE REST OF YOU WIN!");
    outtextxy( 10,150,"PRESS ESC RETURN TO MAIN MENU.");
    if(keys[KEY_ESC])
    {
    bx=getmaxx()/2;by=getmaxy()/2;
    player1.Points=2;
    player2.Points=2;
    player3.Points=2;
    player4.Points=2;
    clearviewport();
    View=SCREEN1;
    Intro(player1,player2,player3,player4);
    }
    }while(View==GAMEOVER);
    }
    if(View==GAMEOVER&&player2.Points<=0)
    {
    clearviewport();
    do
    {
    settextstyle(1,0,4);
    outtextxy( 10,50,"GAMEOVER");
    outtextxy( 10,100,"PLAYER 2 LOST, THE REST OF YOU WIN!");
    outtextxy( 10,150,"PRESS ESC RETURN TO MAIN MENU.");
    if(keys[KEY_ESC])
    {
    bx=getmaxx()/2;by=getmaxy()/2;
    player1.Points=2;
    player2.Points=2;
    player3.Points=2;
    player4.Points=2;
    clearviewport();
    View=SCREEN1;
    Intro(player1,player2,player3,player4);
    }
    }while(View==GAMEOVER);
    }
    if(View==GAMEOVER&&player3.Points<=0)
    {
    clearviewport();
    do
    {
    settextstyle(1,0,4);
    outtextxy( 10,50,"GAMEOVER");
    outtextxy( 10,100,"PLAYER 3 LOST, THE REST OF YOU WIN!");
    outtextxy( 10,150,"PRESS ESC RETURN TO MAIN MENU.");
    if(keys[KEY_ESC])
    {
    bx=getmaxx()/2;by=getmaxy()/2;
    player1.Points=2;
    player2.Points=2;
    player3.Points=2;
    player4.Points=2;
    clearviewport();
    View=SCREEN1;
    Intro(player1,player2,player3,player4);
    }
    }while(View==GAMEOVER);
    }
    if(View==GAMEOVER&&player4.Points<=0)
    {
    clearviewport();
    do
    {
    settextstyle(1,0,4);
    outtextxy( 10,50,"GAMEOVER");
    outtextxy( 10,100,"PLAYER 4 LOST, THE REST OF YOU WIN!");
    outtextxy( 10,150,"PRESS ESC RETURN TO MAIN MENU.");
    if(keys[KEY_ESC])
    {
    bx=getmaxx()/2;by=getmaxy()/2;
    player1.Points=2;
    player2.Points=2;
    player3.Points=2;
    player4.Points=2;
    clearviewport();
    View=SCREEN1;
    Intro(player1,player2,player3,player4);
    }
    }while(View==GAMEOVER);
    }
    if(keys[KEY_P])
    {
    delay(100);
    clearviewport();
    View=PAUSED;
    do
    {
    settextstyle(1,0,4);
    outtextxy(260,75,"GAME");
    outtextxy(250,100,"PAUSED");
    settextstyle(3,0,2);
    outtextxy(150,150,"PRESS ENTER TO RETURN TO GAME.");
    gotoxy(5,15);cout<<"Player 1 Lives:"<<player1.Points<<setw(5)<<
    " Player 2 Lives:"<<player2.Points<<setw(5)<<" Player 3 Lives:"<<
    player3.Points<<setw(5)<<" Player 4 Lives:"<<player4.Points;
    if(keys[KEY_ENTER])
    {
    clearviewport();
    View=BEGIN;
    }
    }while(View==PAUSED);
    }
    }
    while(View==BEGIN);
    uninstall_kb();
    }
    void StartGfx()
    {
    int gd=DETECT;
    int gm=DETECT;
    initgraph(&gd,&gm,"c:\\tc\\bgi");
    }
    void Menu(PlayerType&player1)
    {
    rectangle(0,0,getmaxx(),getmaxy());
    settextstyle(10,0,4);
    outtextxy(225,25,"4-PONG");
    settextstyle(1,0,1);
    outtextxy(225,100,"By: Paul Adcock 2002");
    settextstyle(2,0,6);
    outtextxy(225,150,"1)Start Game");
    outtextxy(225,175,"2)Player Options");
    outtextxy(225,200,"3)Instructions");
    outtextxy(225,225,"4)Exit");
    Ball(375,330,10,player1.BColor);
    setcolor(15);
    if(player1.Speed==1)
    {
    outtextxy(225,325,"GAME SPEED 1");
    }
    if(player1.Speed==2)
    {
    outtextxy(225,325,"GAME SPEED 2");
    }
    if(player1.Speed==3)
    {
    outtextxy(225,325,"GAME SPEED 3");
    }
    if(player1.Speed==4)
    {
    outtextxy(225,325,"GAME SPEED 4");
    }
    if(player1.Speed==5)
    {
    outtextxy(225,325,"GAME SPEED 5");
    }
    if(player1.Speed==6)
    {
    outtextxy(225,325,"GAME SPEED 6");
    }
    if(player1.Speed==7)
    {
    outtextxy(225,325,"GAME SPEED 7");
    }
    if(player1.Speed==8)
    {
    outtextxy(225,325,"GAME SPEED 8");
    }
    if(player1.Speed==9)
    {
    outtextxy(225,325,"GAME SPEED 9");
    }

    }
    void Options()
    {
    rectangle(0,0,getmaxx(),getmaxy());
    settextstyle(10,0,4);
    outtextxy(225,25,"4-PONG");
    settextstyle(1,0,1);
    outtextxy(225,100,"OPTIONS");
    settextstyle(2,0,6);
    outtextxy(225,150,"1)Choose Paddle Colors");
    outtextxy(225,175,"2)Choose Player Control Type");
    outtextxy(225,200,"3)Game Speed");
    outtextxy(225,225,"4)Ball Color");
    outtextxy(225,250,"5)Set Player Lives");
    outtextxy(225,275,"6)Back to Main Menu");
    }
    void CPC(PlayerType&player1,PlayerType&player2,PlayerType&player3,PlayerType&player4)
    {
    rectangle(0,0,getmaxx(),getmaxy());
    settextstyle(10,0,4);
    outtextxy(225,25,"4-PONG");
    settextstyle(1,0,1);
    outtextxy(225,100,"PLAYER CONTROL MENU");
    settextstyle(2,0,6);
    setcolor(player1.Color);
    outtextxy(225,150,"1)Player 1");
    setcolor(player2.Color);
    outtextxy(225,175,"2)Player 2");
    setcolor(player3.Color);
    outtextxy(225,200,"3)Player 3");
    setcolor(player4.Color);
    outtextxy(225,225,"4)Player 4");
    setcolor(15);
    outtextxy(225,250,"5)Back to Options");
    if(player1.Control==0)
    outtextxy(325,150,"Computer");
    if(player1.Control==1)
    outtextxy(325,150,"Human");
    if(player2.Control==0)
    outtextxy(325,175,"Computer");
    if(player2.Control==1)
    outtextxy(325,175,"Human");
    if(player3.Control==0)
    outtextxy(325,200,"Computer");
    if(player3.Control==1)
    outtextxy(325,200,"Human");
    if(player4.Control==0)
    outtextxy(325,225,"Computer");
    if(player4.Control==1)
    outtextxy(325,225,"Human");
    }
    void PlayerLivesMenu(PlayerType&player1,PlayerType&player2,PlayerType&player3,PlayerType&player4)
    {
    rectangle(0,0,getmaxx(),getmaxy());
    settextstyle(10,0,4);
    outtextxy(225,25,"4-PONG");
    settextstyle(1,0,1);
    outtextxy(225,100,"SET PLAYER LIVES");
    settextstyle(2,0,6);
    setcolor(player1.Color);
    outtextxy(225,150,"1)Player 1");
    setcolor(player2.Color);
    outtextxy(225,175,"2)Player 2");
    setcolor(player3.Color);
    outtextxy(225,200,"3)Player 3");
    setcolor(player4.Color);
    outtextxy(225,225,"4)Player 4");
    setcolor(15);
    outtextxy(225,250,"5)Back to Options");
    if(player1.Control==0)
    outtextxy(325,150,"Computer");
    if(player1.Control==1)
    outtextxy(325,150,"Human");
    if(player2.Control==0)
    outtextxy(325,175,"Computer");
    if(player2.Control==1)
    outtextxy(325,175,"Human");
    if(player3.Control==0)
    outtextxy(325,200,"Computer");
    if(player3.Control==1)
    outtextxy(325,200,"Human");
    if(player4.Control==0)
    outtextxy(325,225,"Computer");
    if(player4.Control==1)
    outtextxy(325,225,"Human");
    }
    void BallColor()
    {
    ColorList();
    setcolor(15);
    outtextxy(100,375,"Set ball color by pressing 1-E");
    }
    void SetLives()
    {
    outtextxy(50,325,"How many lives would you like this player to have? 1-9");
    }
    void CPCYN()
    {
    outtextxy(50,325,"Do you want this player to be controled by a human? Y/N");
    }
    void GameSpeed()
    {
    outtextxy(50,325,"Set game speed by pressing 1-9, 9 being the slowest.");
    }
    void Instructions()
    {
    rectangle(0,0,getmaxx(),getmaxy());
    settextstyle(10,0,4);
    outtextxy(225,25,"4-PONG");
    settextstyle(1,0,1);
    outtextxy(225,100,"Instructions");
    settextstyle(2,0,6);
    outtextxy(100,150,"Player 1 Controls:LEFT KEY & RIGHT KEY");
    outtextxy(100,175,"Player 2 Controls:0(Ins) & .(Del)");
    outtextxy(100,200,"Player 3 Controls:<, & >.");
    outtextxy(100,225,"Player 4 Controls:Z & X");
    outtextxy(100,275,"ALL PLAYERS CAN BE COMPUTER CONTROLED");
    outtextxy(100,300,"AND GAME CAN BE PAUSED BY PRESSING P ANYTIME.");
    outtextxy(100,325,"PRESSING ESC IN GAME WILL RETURN TO MAIN MENU");
    outtextxy(100,400,"PRESS ENTER TO RETURN TO OPTIONS SCREEN.");
    }
    void ChoosePaddleColors(PlayerType&player1,PlayerType&player2,PlayerType&player3,PlayerType&player4)
    {
    rectangle(0,0,getmaxx(),getmaxy());
    settextstyle(10,0,4);
    outtextxy(225,25,"4-PONG");
    settextstyle(1,0,1);
    outtextxy(225,100,"PADDLE COLOR MENU");
    settextstyle(2,0,6);
    setcolor(player1.Color);
    outtextxy(225,150,"1)Player 1");
    setcolor(player2.Color);
    outtextxy(225,175,"2)Player 2");
    setcolor(player3.Color);
    outtextxy(225,200,"3)Player 3");
    setcolor(player4.Color);
    outtextxy(225,225,"4)Player 4");
    setcolor(15);
    outtextxy(225,250,"5)Back to Options");
    if(player1.Control==0)
    outtextxy(325,150,"Computer");
    if(player1.Control==1)
    outtextxy(325,150,"Human");
    if(player2.Control==0)
    outtextxy(325,175,"Computer");
    if(player2.Control==1)
    outtextxy(325,175,"Human");
    if(player3.Control==0)
    outtextxy(325,200,"Computer");
    if(player3.Control==1)
    outtextxy(325,200,"Human");
    if(player4.Control==0)
    outtextxy(325,225,"Computer");
    if(player4.Control==1)
    outtextxy(325,225,"Human");
    }
    void ColorList()
    {
    settextstyle(1,0,4);
    setcolor(1);
    outtextxy(100,325,"1,");
    setcolor(2);
    outtextxy(120,325,"2,");
    setcolor(3);
    outtextxy(140,325,"3,");
    setcolor(4);
    outtextxy(160,325,"4,");
    setcolor(5);
    outtextxy(180,325,"5,");
    setcolor(6);
    outtextxy(200,325,"6,");
    setcolor(7);
    outtextxy(220,325,"7,");
    setcolor(8);
    outtextxy(240,325,"8,");
    setcolor(9);
    outtextxy(260,325,"9,");
    setcolor(10);
    outtextxy(280,325,"A,");
    setcolor(11);
    outtextxy(300,325,"B,");
    setcolor(12);
    outtextxy(320,325,"C,");
    setcolor(13);
    outtextxy(340,325,"D,");
    setcolor(14);
    outtextxy(360,325,"E");
    settextstyle(2,0,4);
    setcolor(15);
    outtextxy(100,400,"Note:Choosing another players color will result in your color changing.");
    outtextxy(100,425,"this goes for the ball color as well.");
    }
    void Intro(PlayerType&player1,PlayerType&player2,PlayerType&player3,PlayerType&player4)
    {

    do
    {//start loop bracket
    if(View==SCREEN1)
    {
    Menu(player1);
    if(keys[KEY_1])
    {
    clearviewport();
    View=BEGIN;
    }
    if(keys[KEY_2])
    {
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_3])
    {
    clearviewport();
    View=INSTRUCTIONS;
    }
    if(keys[KEY_4])
    {
    View=EXIT;
    }
    }
    if(View==INSTRUCTIONS)
    {
    delay(100);
    do
    {
    Instructions();
    if(keys[KEY_ENTER])
    {
    clearviewport();
    View=SCREEN1;
    }
    }while(View==INSTRUCTIONS);
    }
    if(View==SCREEN2)
    {

    delay(100);
    do
    {
    Options();
    if(keys[KEY_1])
    {
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_2])
    {
    clearviewport();
    View=SCREEN8;
    }
    if(keys[KEY_3])
    {
    clearviewport();
    View=GAMESPEED;
    }
    if(keys[KEY_4])
    {
    View=BALLCOLOR;
    }
    if(keys[KEY_5])
    {
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_6])
    {
    clearviewport();
    View=SCREEN1;
    }
    }while(View==SCREEN2);
    }
    if(View==SETLIVES)
    {
    delay(100);
    PlayerLivesMenu(player1,player2,player3,player4);
    do
    {
    if(keys[KEY_1])
    {
    clearviewport();
    View=PLAYER1LIVE;
    }
    if(keys[KEY_2])
    {
    clearviewport();
    View=PLAYER2LIVE;
    }
    if(keys[KEY_3])
    {
    clearviewport();
    View=PLAYER3LIVE;
    }
    if(keys[KEY_4])
    {
    clearviewport();
    View=PLAYER4LIVE;
    }
    if(keys[KEY_5])
    {
    clearviewport();
    View=SCREEN2;
    }
    }while(View==SETLIVES);
    }
    if(View==PLAYER1LIVE)
    {
    delay(100);
    SetLives();
    do
    {
    if(keys[KEY_1])
    {
    player1.Points=1;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_2])
    {
    player1.Points=2;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_3])
    {
    player1.Points=3;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_4])
    {
    player1.Points=4;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_5])
    {
    player1.Points=5;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_6])
    {
    player1.Points=6;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_7])
    {
    player1.Points=7;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_8])
    {
    player1.Points=8;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_9])
    {
    player1.Points=9;
    clearviewport();
    View=SETLIVES;
    }
    }while(View==PLAYER1LIVE);
    }
    if(View==PLAYER2LIVE)
    {
    delay(100);
    SetLives();
    do
    {
    if(keys[KEY_1])
    {
    player2.Points=1;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_2])
    {
    player2.Points=2;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_3])
    {
    player2.Points=3;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_4])
    {
    player2.Points=4;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_5])
    {
    player2.Points=5;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_6])
    {
    player2.Points=6;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_7])
    {
    player2.Points=7;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_8])
    {
    player2.Points=8;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_9])
    {
    player2.Points=9;
    clearviewport();
    View=SETLIVES;
    }
    }while(View==PLAYER2LIVE);
    }
    if(View==PLAYER3LIVE)
    {
    delay(100);
    SetLives();
    do
    {
    if(keys[KEY_1])
    {
    player3.Points=1;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_2])
    {
    player3.Points=2;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_3])
    {
    player3.Points=3;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_4])
    {
    player3.Points=4;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_5])
    {
    player3.Points=5;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_6])
    {
    player3.Points=6;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_7])
    {
    player3.Points=7;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_8])
    {
    player3.Points=8;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_9])
    {
    player3.Points=9;
    clearviewport();
    View=SETLIVES;
    }
    }while(View==PLAYER3LIVE);
    }
    if(View==PLAYER4LIVE)
    {
    delay(100);
    SetLives();
    do
    {
    if(keys[KEY_1])
    {
    player4.Points=1;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_2])
    {
    player4.Points=2;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_3])
    {
    player4.Points=3;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_4])
    {
    player4.Points=4;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_5])
    {
    player4.Points=5;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_6])
    {
    player4.Points=6;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_7])
    {
    player4.Points=7;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_8])
    {
    player4.Points=8;
    clearviewport();
    View=SETLIVES;
    }
    if(keys[KEY_9])
    {
    player4.Points=9;
    clearviewport();
    View=SETLIVES;
    }
    }while(View==PLAYER4LIVE);
    }
    if(View==BALLCOLOR)
    {
    delay(100);
    do
    {
    BallColor();
    if(keys[KEY_1])
    {
    player1.BColor=1;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_2])
    {
    player1.BColor=2;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_3])
    {
    player1.BColor=3;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_4])
    {
    player1.BColor=4;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_5])
    {
    player1.BColor=5;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_6])
    {
    player1.BColor=6;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_7])
    {
    player1.BColor=7;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_8])
    {
    player1.BColor=8;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_9])
    {
    player1.BColor=9;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_A])
    {
    player1.BColor=10;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_B])
    {
    player1.BColor=11;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_C])
    {
    player1.BColor=12;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_D])
    {
    player1.BColor=13;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_E])
    {
    player1.BColor=14;
    clearviewport();
    View=SCREEN2;
    }
    if(player1.BColor==player1.Color)
    {
    player1.BColor++;
    }
    if(player1.BColor==player2.Color)
    {
    player1.BColor++;
    }
    if(player1.BColor==player3.Color)
    {
    player1.BColor++;
    }
    if(player1.BColor==player4.Color)
    {
    player1.BColor++;
    }
    if(player1.BColor==0)
    {
    player1.BColor++;
    }

    }while(View==BALLCOLOR);
    }
    if(View==GAMESPEED)
    {
    delay(100);
    do
    {
    GameSpeed();
    if(keys[KEY_1])
    {
    player1.Speed=1;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_2])
    {
    player1.Speed=2;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_3])
    {
    player1.Speed=3;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_4])
    {
    player1.Speed=4;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_5])
    {
    player1.Speed=5;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_6])
    {
    player1.Speed=6;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_7])
    {
    player1.Speed=7;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_8])
    {
    player1.Speed=8;
    clearviewport();
    View=SCREEN2;
    }
    if(keys[KEY_9])
    {
    player1.Speed=9;
    clearviewport();
    View=SCREEN2;
    }
    }while(View==GAMESPEED);
    }
    if(View==SCREEN8)
    {
    delay(100);
    do
    {
    CPC(player1,player2,player3,player4);
    if(keys[KEY_1])
    {
    clearviewport();
    View=SCREEN9;
    }
    if(keys[KEY_2])
    {
    clearviewport();
    View=SCREEN10;
    }
    if(keys[KEY_3])
    {
    clearviewport();
    View=SCREEN11;
    }
    if(keys[KEY_4])
    {
    clearviewport();
    View=SCREEN12;
    }
    if(keys[KEY_5])
    {
    clearviewport();
    View=SCREEN2;
    }
    }while(View==SCREEN8);
    }
    if(View==SCREEN9)
    {
    delay(100);
    do
    {
    CPCYN();
    if(keys[KEY_Y])
    {
    clearviewport();
    player1.Control=1;
    View=SCREEN8;
    }
    if(keys[KEY_N])
    {
    clearviewport();
    player1.Control=0;
    View=SCREEN8;
    }
    }while(View==SCREEN9);
    }
    if(View==SCREEN10)
    {
    delay(100);
    do
    {
    CPCYN();
    if(keys[KEY_Y])
    {
    clearviewport();
    player2.Control=1;
    View=SCREEN8;
    }
    if(keys[KEY_N])
    {
    clearviewport();
    player2.Control=0;
    View=SCREEN8;
    }
    }while(View==SCREEN10);
    }
    if(View==SCREEN11)
    {
    delay(100);
    do
    {
    CPCYN();
    if(keys[KEY_Y])
    {
    clearviewport();
    player3.Control=1;
    View=SCREEN8;
    }
    if(keys[KEY_N])
    {
    clearviewport();
    player3.Control=0;
    View=SCREEN8;
    }
    }while(View==SCREEN11);
    }
    if(View==SCREEN12)
    {
    delay(100);
    do
    {
    CPCYN();
    if(keys[KEY_Y])
    {
    clearviewport();
    player4.Control=1;
    View=SCREEN8;
    }
    if(keys[KEY_N])
    {
    clearviewport();
    player4.Control=0;
    View=SCREEN8;
    }
    }while(View==SCREEN12);
    }
    if(View==SCREEN3)
    {

    delay(100);
    clearviewport();
    do
    {
    ChoosePaddleColors(player1,player2,player3,player4);
    if(keys[KEY_1])
    {
    clearviewport();
    setcolor(15);
    ChoosePaddleColors(player1,player2,player3,player4);
    View=SCREEN4;

    }
    if(keys[KEY_2])
    {
    clearviewport();
    setcolor(15);
    ChoosePaddleColors(player1,player2,player3,player4);
    View=SCREEN5;
    }
    if(keys[KEY_3])
    {
    clearviewport();
    setcolor(15);
    ChoosePaddleColors(player1,player2,player3,player4);
    View=SCREEN6;
    }
    if(keys[KEY_4])
    {
    clearviewport();
    setcolor(15);
    ChoosePaddleColors(player1,player2,player3,player4);
    View=SCREEN7;
    }
    if(keys[KEY_5])
    {
    clearviewport();
    View=SCREEN2;
    }
    }while(View==SCREEN3);
    }
    if(View==SCREEN4)
    {

    delay(100);
    ColorList();
    do
    {
    if(keys[KEY_1])
    {
    player1.Color=1;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_2])
    {
    player1.Color=2;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_3])
    {
    player1.Color=3;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_4])
    {
    player1.Color=4;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_5])
    {
    player1.Color=5;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_6])
    {
    player1.Color=6;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_7])
    {
    player1.Color=7;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_8])
    {
    player1.Color=8;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_9])
    {
    player1.Color=9;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_A])
    {
    player1.Color=10;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_B])
    {
    player1.Color=11;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_C])
    {
    player1.Color=12;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_D])
    {
    player1.Color=13;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_E])
    {
    player1.Color=14;
    clearviewport();
    View=SCREEN3;
    }
    if(player1.Color==player2.Color)
    {
    player1.Color++;
    }
    if(player1.Color==player3.Color)
    {
    player1.Color++;
    }
    if(player1.Color==player4.Color)
    {
    player1.Color++;
    }
    if(player1.Color==0)
    {
    player1.Color++;
    }
    }while(View==SCREEN4);

    }
    if(View==SCREEN5)
    {
    delay(100);
    ColorList();
    do
    {
    if(keys[KEY_1])
    {
    player2.Color=1;
    clearviewport();
    setcolor(15);
    View=SCREEN3;
    }
    if(keys[KEY_2])
    {
    player2.Color=2;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_3])
    {
    player2.Color=3;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_4])
    {
    player2.Color=4;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_5])
    {
    player2.Color=5;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_6])
    {
    player2.Color=6;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_7])
    {
    player2.Color=7;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_8])
    {
    player2.Color=8;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_9])
    {
    player2.Color=9;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_A])
    {
    player2.Color=10;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_B])
    {
    player2.Color=11;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_C])
    {
    player2.Color=12;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_D])
    {
    player2.Color=13;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_E])
    {
    player2.Color=14;
    clearviewport();
    View=SCREEN3;
    }
    if(player2.Color==player1.Color)
    {
    player2.Color++;
    }
    if(player2.Color==player3.Color)
    {
    player2.Color++;
    }
    if(player2.Color==player4.Color)
    {
    player2.Color++;
    }
    if(player2.Color==0)
    {
    player2.Color++;
    }
    }while(View==SCREEN5);

    }
    if(View==SCREEN6)
    {
    delay(100);
    ColorList();
    do
    {
    if(keys[KEY_1])
    {
    player3.Color=1;
    clearviewport();
    setcolor(15);
    View=SCREEN3;
    }
    if(keys[KEY_2])
    {
    player3.Color=2;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_3])
    {
    player3.Color=3;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_4])
    {
    player3.Color=4;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_5])
    {
    player3.Color=5;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_6])
    {
    player3.Color=6;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_7])
    {
    player3.Color=7;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_8])
    {
    player3.Color=8;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_9])
    {
    player3.Color=9;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_A])
    {
    player3.Color=10;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_B])
    {
    player3.Color=11;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_C])
    {
    player3.Color=12;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_D])
    {
    player3.Color=13;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_E])
    {
    player3.Color=14;
    clearviewport();
    View=SCREEN3;
    }
    if(player3.Color==player1.Color)
    {
    player3.Color++;
    }
    if(player3.Color==player2.Color)
    {
    player3.Color++;
    }
    if(player3.Color==player4.Color)
    {
    player3.Color++;
    }
    if(player3.Color==0)
    {
    player3.Color++;
    }
    }while(View==SCREEN6);

    }
    if(View==SCREEN7)
    {

    ColorList();
    do
    {
    if(keys[KEY_1])
    {
    player4.Color=1;
    clearviewport();
    setcolor(15);
    View=SCREEN3;
    }
    if(keys[KEY_2])
    {
    player4.Color=2;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_3])
    {
    player4.Color=3;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_4])
    {
    player4.Color=4;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_5])
    {
    player4.Color=5;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_6])
    {
    player4.Color=6;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_7])
    {
    player4.Color=7;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_8])
    {
    player4.Color=8;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_9])
    {
    player4.Color=9;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_A])
    {
    player4.Color=10;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_B])
    {
    player4.Color=11;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_C])
    {
    player4.Color=12;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_D])
    {
    player4.Color=13;
    clearviewport();
    View=SCREEN3;
    }
    if(keys[KEY_E])
    {
    player4.Color=14;
    clearviewport();
    View=SCREEN3;
    }
    if(player4.Color==player1.Color)
    {
    player4.Color++;
    }
    if(player4.Color==player2.Color)
    {
    player4.Color++;
    }
    if(player4.Color==player3.Color)
    {
    player4.Color++;
    }
    if(player4.Color==0)
    {
    player4.Color++;
    }
    }while(View==SCREEN7);

    }//close bracket for if(View==SCREEN7)
    if(View==EXIT)
    {
    uninstall_kb();
    abort();
    }
    }while(View!=BEGIN);
    }
    void Ball(int&x,int&y,int&r,int&c)
    {
    setcolor©;
    circle(x,y,r);
    setfillstyle(1,c);
    fillellipse(x,y,r,r);
    }
    void MoveBall(int&x,int&y,int&r,Direction&dir)
    {
    if(dir==DOWN)
    y++;
    if(dir==UP)
    y--;
    if(dir==LEFT)
    x--;
    if(dir==RIGHT)
    x++;
    if(dir==UPRIGHT)
    {
    x++;
    y--;
    }
    if(dir==UPLEFT)
    {
    x--;
    y--;
    }
    if(dir==DOWNLEFT)
    {
    x--;
    y++;
    }
    if(dir==DOWNRIGHT)
    {
    x++;
    y++;
    }
    }
    void Border(int&x,int&y,int&r,Direction&dir,PlayerType&player1,PlayerType&player2,PlayerType&player3,PlayerType&player4)
    {
    setcolor(15);
    rectangle(0,0,getmaxx(),getmaxy());
    if(x-r==0)
    {
    if(dir==UPLEFT)
    dir=UPRIGHT;
    if(dir==DOWNLEFT)
    dir=DOWNRIGHT;
    player3.Points--;
    }
    if(x+r==getmaxx())
    {
    if(dir==UPRIGHT)
    dir=UPLEFT;
    if(dir==DOWNRIGHT)
    dir=DOWNLEFT;
    player4.Points--;
    }
    if(y+r==getmaxy())
    {
    if(dir==DOWNLEFT)
    dir=UPLEFT;
    if(dir==DOWNRIGHT)
    dir=UPRIGHT;
    player1.Points--;
    }
    if(y-r==0)
    {
    if(dir==UPLEFT)
    dir=DOWNLEFT;
    if(dir==UPRIGHT)
    dir=DOWNRIGHT;
    player2.Points--;
    }
    }
    void TopPaddle(int&x1,int&x2,int&x,int&y,int&r,int&color,int&control,Direction&dir,int&ran)
    {
    if(control==1)
    {
    setfillstyle(1,BLACK);
    floodfill(x1,5,0);
    bar(x1,5,x2,10);
    if(keys[KEY_INS])
    {
    x1--;
    x2--;
    }
    if(keys[KEY_DEL])
    {
    x1++;
    x2++;
    }
    setfillstyle(1,color);
    floodfill(x1,5,0);
    bar(x1,5,x2,10);
    if(getpixel(0,5)!=WHITE)
    {
    x1=1;
    x2=61;
    }
    if(getpixel(639,5)!=WHITE)
    {
    x1=578;
    x2=638;
    }
    if(getpixel(x,y-r)==color)
    {
    if(ran==0)
    {
    // if(dir==UPLEFT)
    // dir=DOWNLEFT;
    if(dir==UPRIGHT)
    dir=DOWNRIGHT;
    }
    if(ran==1)
    {
    if(dir==UPLEFT)
    dir=DOWNLEFT;
    //if(dir==UPRIGHT)
    // dir=DOWNRIGHT;
    }
    }
    }
    if(control==0)
    {
    setfillstyle(1,BLACK);
    floodfill(x,5,0);
    bar(x,5,x,10);

    setfillstyle(1,color);
    floodfill(x,5,0);
    bar(x+30,5,x-30,10);
    if(getpixel(0,5)!=WHITE)
    {
    x1=1;
    x2=61;
    }
    if(getpixel(639,5)!=WHITE)
    {
    x1=578;
    x2=638;
    }
    if(getpixel(x,y-r)==color)
    {
    if(ran==0)
    {
    // if(dir==UPLEFT)
    // dir=DOWNLEFT;
    if(dir==UPRIGHT)
    dir=DOWNRIGHT;
    }
    if(ran==1)
    {
    if(dir==UPLEFT)
    dir=DOWNLEFT;
    //if(dir==UPRIGHT)
    // dir=DOWNRIGHT;
    }
    }
    }

    }
    void BottomPaddle(int&x1,int&x2,int&x,int&y,int&r,int&color,int&control,Direction&dir,int&ran)
    {
    if(control==1)
    {
    setfillstyle(1,BLACK);
    floodfill(x1,475,0);
    bar(x1,475,x2,470);
    if(keys[KEY_LEFT])
    {
    x1--;
    x2--;
    }
    if(keys[KEY_RIGHT])
    {
    x1++;
    x2++;
    }
    setfillstyle(1,color);
    floodfill(x1,475,0);
    bar(x1,475,x2,470);
    if(getpixel(0,470)!=WHITE)
    {
    x1=1;
    x2=61;
    }
    if(getpixel(639,470)!=WHITE)
    {
    x1=578;
    x2=638;
    }
    if(getpixel(x,y+r)==color)
    {
    if(ran==0)
    {
    // if(dir==DOWNLEFT)
    // dir=UPLEFT;
    if(dir==DOWNRIGHT)
    dir=UPRIGHT;
    }
    if(ran==1)
    { if(dir==DOWNLEFT)
    dir=UPLEFT;
    //if(dir==DOWNRIGHT)
    // dir=UPRIGHT;
    }
    }
    }
    if(control==0)
    {
    setfillstyle(1,BLACK);
    floodfill(x,475,0);
    bar(x,475,x,470);

    setfillstyle(1,color);
    floodfill(x1,475,0);
    bar(x+30,475,x-30,470);
    if(getpixel(0,470)!=WHITE)
    {
    x1=1;
    x2=61;

    }
    if(getpixel(639,470)!=WHITE)
    {
    x1=578;
    x2=638;
    }
    if(getpixel(x,y+r)==color)
    {
    if(ran==0)
    {
    // if(dir==DOWNLEFT)
    // dir=UPLEFT;
    if(dir==DOWNRIGHT)
    dir=UPRIGHT;
    }
    if(ran==1)
    { if(dir==DOWNLEFT)
    dir=UPLEFT;
    //if(dir==DOWNRIGHT)
    // dir=UPRIGHT;
    }
    }
    }

    }
    void LeftPaddle(int&y1,int&y2,int&y,int&x,int&r,int&color,int&control,Direction&dir,int&ran)
    {
    if(control==1)
    {
    setfillstyle(1,BLACK);
    floodfill(10,y1,0);
    bar(5,y1,10,y1);
    if(keys[KEY_COMMA])
    {
    y1--;
    y2--;
    }
    if(keys[KEY_PERIOD])
    {
    y1++;
    y2++;
    }
    setfillstyle(1,color);
    floodfill(10,y1,0);
    bar(5,y1,10,y2);
    if(getpixel(10,0)==color)
    {
    y1=1;
    y2=61;
    }
    if(getpixel(10,getmaxy())==color)
    {
    y1=460;
    y2=400;
    }
    if(getpixel(x-r,y)==color)
    {
    if(ran==0)
    {
    // if(dir==UPLEFT)
    // dir=UPRIGHT;
    if(dir==DOWNLEFT)
    dir=DOWNRIGHT;
    }
    if(ran==1)
    {
    if(dir==UPLEFT)
    dir=UPRIGHT;
    //if(dir==DOWNLEFT)
    // dir=DOWNRIGHT;
    }
    }
    }
    if(control==0)
    {
    setfillstyle(1,BLACK);
    floodfill(10,y,0);
    bar(5,y,10,y);

    setfillstyle(1,color);
    floodfill(10,y,0);
    bar(5,y+30,10,y-30);
    /* if(getpixel(10,0)==color)
    {
    y=1; // VERY BUGGY
    y=61;
    }
    if(getpixel(10,getmaxy())==color)
    {
    y=460;
    y=400;
    }*/
    if(getpixel(x-r,y)==color)
    {
    if(ran==0)
    {
    // if(dir==UPLEFT)
    // dir=UPRIGHT;
    if(dir==DOWNLEFT)
    dir=DOWNRIGHT;
    }
    if(ran==1)
    {
    if(dir==UPLEFT)
    dir=UPRIGHT;
    //if(dir==DOWNLEFT)
    // dir=DOWNRIGHT;
    }
    }

    }
    }
    void RightPaddle(int&y1,int&y2,int&y,int&x,int&r,int&color,int&control,Direction&dir,int&ran)
    {
    if(control==1)
    {
    setfillstyle(1,BLACK);
    floodfill(getmaxx()-10,y1,0);
    bar(getmaxx()-5,y1,getmaxx()-10,y1);
    if(keys[KEY_Z])
    {
    y1--;
    y2--;
    }
    if(keys[KEY_X])
    {
    y1++;
    y2++;
    }
    setfillstyle(1,color);
    floodfill(getmaxx()-10,y1,0);
    bar(getmaxx()-5,y1,getmaxx()-10,y2);
    if(getpixel(getmaxx()-10,0)==color)
    {
    y1=1;
    y2=61;
    }
    if(getpixel(getmaxx()-10,getmaxy())==color)
    {
    y1=460;
    y2=400;
    }
    if(getpixel(x+r,y)==color)
    {
    if(ran==0)
    {
    // if(dir==UPRIGHT)
    // dir=UPLEFT;
    if(dir==DOWNRIGHT)
    dir=DOWNLEFT;
    }
    if(ran==1)
    {
    if(dir==UPRIGHT)
    dir=UPLEFT;
    //if(dir==DOWNRIGHT)
    // dir=DOWNLEFT;
    }
    }
    }
    if(control==0)
    {
    setfillstyle(1,BLACK);
    floodfill(getmaxx()-10,y,0);
    bar(getmaxx()-5,y,getmaxx()-10,y);

    setfillstyle(1,color);
    floodfill(getmaxx()-10,y,0);
    bar(getmaxx()-5,y+30,getmaxx()-10,y-30);
    /*if(getpixel(10,0)==color)
    {
    y=1; // VERY BUGGY
    y=61;
    }
    if(getpixel(10,getmaxy())==color)
    {
    y=460;
    y=400;
    }*/
    if(getpixel(x+r,y)==color)
    {
    if(ran==0)
    {
    // if(dir==UPRIGHT)
    // dir=UPLEFT;
    if(dir==DOWNRIGHT)
    dir=DOWNLEFT;
    }
    if(ran==1)
    {
    if(dir==UPRIGHT)
    dir=UPLEFT;
    //if(dir==DOWNRIGHT)
    // dir=DOWNLEFT;
    }
    }

    }
    }</div>

    <a href="http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=4112&lngWId=3" target="_blank">http://www.planet-source-code.com/vb/scrip...12&lngWId=3</a><!--QuoteEnd--></div><!--QuoteEEnd-->
    Duuuuuuuuuuuuuude [.codebox][/.codebox]
     
  13. piratesmack

    Member piratesmack GBAtemp Advanced Fan

    Joined:
    Mar 28, 2009
    Messages:
    787
    Location:
    $(pwd)
    Country:
    United States
    Just pirate some PDFs

    That's how I learned Bash and C [​IMG]
     
  14. emupaul

    Member emupaul GBAtemp Fan

    Joined:
    Jun 26, 2009
    Messages:
    416
    Location:
    space
    Country:
    United States
    PDFs are good but really you need a good physical solid book to thumb through and some time to practice. Like i said before the sams book is actually pretty good for getting down the basics.
     
  15. UltraMagnus

    Member UltraMagnus hic sunt dracones

    Joined:
    Aug 2, 2007
    Messages:
    1,967
    Location:
    Portsmouth
    Country:
    United Kingdom
    who needs to "thumb through" when you can ctrl+f
     
  16. Pizzaroo

    Member Pizzaroo douchebag

    Joined:
    Feb 2, 2008
    Messages:
    1,161
    Country:
    United States
    Wish I was as pro as emupaul at C++. All I know is... Actionscript 3 [​IMG]
     
  17. piratesmack

    Member piratesmack GBAtemp Advanced Fan

    Joined:
    Mar 28, 2009
    Messages:
    787
    Location:
    $(pwd)
    Country:
    United States
    You can be.
    With practice [​IMG]
     
  18. mayhem366

    Member mayhem366 GBAtemp Regular

    Joined:
    Nov 24, 2008
    Messages:
    181
    Location:
    UK
    Country:
    United Kingdom
    I have tried in the past to learn C++ (heh, makes me sound like an old man....I'm only 19 [​IMG])
    but never really got anywhere with this.

    I was using pdf's and websites but I don't feel that they help that much.

    I'm not new to programming though as I was taught a language called BlitzBasic (C and Basic hybrid) by a friend when I was 14 (ish) and have expanded on that myself for several years.
    Now I'm at uni i have started being taught a much more sophisticated language, Java. In about 9 months of being taught Java i think that my java skills could match those from BlitzBasic whereas that took me years to learn.

    The moral of the story...
    there is nothing like actually sitting in a classroom and being taught it...books can't do that unless you really, really want to learn.
     

Share This Page