Thread: I know this is most likely a novice problem...

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    673

    I know this is most likely a novice problem...

    I am making a text game, genre RPG, but I need to know how to put a scroll bar on the console window, and remove it at will so I can making a scrollable inventory so I can cout more than 45 lines at a time. I thank you very much for you help, and I am using a class for this
    Code:
    class itembase { //creates absract data type
        public:
        itembase() {
            //
        }
        
    
        virtual void load(); // Should be used ONLY 1 time in program, this loads item data from files
        virtual void display(); //this should be used on a blank screen, or inventory, displays ALL item data
        virtual void scroll(); //toggles scroll bar
        
    };
    I had more in that class but comp crashed and I lost all my work forgot to save
    yet again thank you for any help

  2. #2
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    Making your own console-like window would probobly be easier than what you want to do.

    Maybe somthing like multipule screens rather than a scrollbar?

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    Hmm.. yeah, but any ideas on how I could go about doing that? I used WIN32 for awhile but it is to much of a pain, no strings, no ints, no floats, at least not without atoi, or similar, and the writing to screen is a pain, but if oyu have any ideas i thank you much

  4. #4
    Registered User
    Join Date
    Aug 2006
    Posts
    74
    Yeah, why not just use multiple screens like Cool-A suggested. Say cout 20 inventory items then wait for user to press a keyboard button then cout the remaining inventory items. Quickest/easiest solution that I can think of.

  5. #5
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    hmm yea that could work but, can I do something like enter a page number for the itemlist or something like that? like
    Code:
    cout << " << Previous Page 1 || 2 Next Page >>  Selection: " << endl;
    cin >> *t_int;
    if ( *t_int == 1 ) {
          p_Itm->nextpage();
    }
    else {
          p_itm->prevpage();
    }
    I will do that if it doesnt prove to be exceedingly difficult
    Thanks for any help

  6. #6
    C++ Enthusiast jmd15's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    532
    If I were you I'd invest a little time into creating a window, making an edit child window that you can put the text into for the game(your own little console), and then another edit child window for the user's input and an optional button to send the input but he could just hit enter. That way they can scroll down the edit window and you can clear it at will. It'd just look nicer and be pretty easy.
    Trinity: "Neo... nobody has ever done this before."
    Neo: "That's why it's going to work."
    c9915ec6c1f3b876ddf38514adbb94f0

  7. #7
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    Hey jmd15 its been awhile, well yea that would work, but WIN32 doesn't handle ints, or strings very easily, at least not without atoi and that gets old. Yea I admit it would be easier, but it is alot more difficult to make a text game in WIN32 than a console.

  8. #8
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    >> but it is a lot more difficult to make a text game in WIN32 than a console.

    True, but you can do a LOT more with WIN32 than with MS-DOS. (Like that scroll bar you
    want.) Overall, programming in WIN32 is worth it's cumbersome.

    Besides, MS-DOS is ancient, time to move along in life.

  9. #9
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    If you would like I could create a small framework that will give you an input window and a response window and then leave the rest to you.

    It's quite simple in MFC and in Win32. Then you just use the API to write text to the desired window. That's pretty much all you need for a text game.

  10. #10
    C++ Enthusiast jmd15's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    532
    Quote Originally Posted by Bubba
    If you would like I could create a small framework that will give you an input window and a response window and then leave the rest to you.

    It's quite simple in MFC and in Win32. Then you just use the API to write text to the desired window. That's pretty much all you need for a text game.
    Of course don't forget getting input . And yes that would be easy.
    Trinity: "Neo... nobody has ever done this before."
    Neo: "That's why it's going to work."
    c9915ec6c1f3b876ddf38514adbb94f0

  11. #11
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    Bubba if you could that for me I would be greatly in-debted to. Thank you very much
    well gotta get to school cya

    just please don't use MFC my computer is a ME, and it doesnt like MFC for some reason.Thanks again
    Last edited by Raigne; 08-24-2006 at 11:21 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM