Here is a Screenshot of my GUI for my RPG

This is a discussion on Here is a Screenshot of my GUI for my RPG within the Game Programming forums, part of the General Programming Boards category; You can load a bitmap with a console program, sure, but blitting it would be a huge hassle. You'd be ...

  1. #16
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    You can load a bitmap with a console program, sure, but blitting it would be a huge hassle. You'd be much better off using a Real Graphics Library (TM) instead.

    Try the SDL -- it isn't that hard to use.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  2. #17
    Registered User
    Join Date
    Jan 2007
    Posts
    89
    I have heard good things about SDL...I had a hard time getting sdl to work with code::blocks even after I followed the tutorials to T. Soon after I kinda lost interest. I may have to try it agian.

  3. #18
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,855
    Console is fine while you're still learning, or working on the game logic.

    It saves getting bogged down in the detail of trying to make everything look perfect before you've finished adding all the features.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #19
    Registered User
    Join Date
    Jan 2007
    Posts
    89
    Yeah...That was my thinking...Get the game logic down first...Graphics is a whole different animnal.

  5. #20
    The larch
    Join Date
    May 2006
    Posts
    3,573
    But then isn't even the console GUI an overkill? Surely you can test the logic of the game with very simple input and output? I don't think your console GUI is actually a lot simpler than a windows GUI code-wise.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  6. #21
    Registered User
    Join Date
    Jan 2007
    Posts
    89
    Can I use ASCII graphics in a normal Win GUI? I have heard that the TextOut functions are slow...but I suppose it wouldnt matter in a simple rpg game.

    And after checking out the T.O.M.E site I think that maybe a console GUI might not be such a good idea.

    I just havent tried any real windows programming yet.

    I don't think your console GUI is actually a lot simpler than a windows GUI code-wise.
    Not so complex, just alot of code.

    Code:
    void CGManager::ShowPlayerStats(CPlayer* player)
    {
        char Output[10];
    
        COORD Position;
    
        Position.X = 52;
        Position.Y = 7;
    
        m_Console->SetPosition(Position);
        m_Console->OutputString(player->GetName());
    
        Position.Y = 9;
    
        m_Console->SetPosition(Position);
        m_Console->OutputString("Health: ");
        m_Console->SetTextColor(DRed);
        m_Console->OutputString(itoa(player->GetHP(), Output, 10));
        m_Console->SetTextColor(Black);
        m_Console->OutputString("/");
        m_Console->SetTextColor(DRed);
        m_Console->OutputString(itoa(player->GetMaxHP(), Output, 10));
    
        Position.X = 75;
    
        m_Console->SetPosition(Position);
        m_Console->SetTextColor(Black);
        m_Console->OutputString("Mana: ");
        m_Console->SetTextColor(DBlue);
        m_Console->OutputString(itoa(player->GetMP(), Output, 10));
        m_Console->SetTextColor(Black);
        m_Console->OutputString("/");
        m_Console->SetTextColor(DBlue);
        m_Console->OutputString(itoa(player->GetMaxMP(), Output, 10));
    
        Position.X = 52;
        Position.Y = 11;
    
        m_Console->SetTextColor(Black);
        m_Console->SetPosition(Position);
        m_Console->OutputString("Strength: ");
        m_Console->OutputString(itoa(player->GetStrength(), Output, 10));
    
        Position.X = 75;
    
        m_Console->SetPosition(Position);
        m_Console->OutputString("Intelligence: ");
        m_Console->OutputString(itoa(player->GetIntelligence(), Output, 10));
    
        Position.X = 52;
        Position.Y = 13;
    
        m_Console->SetPosition(Position);
        m_Console->OutputString("Dexterity: ");
        m_Console->OutputString(itoa(player->GetDexterity(), Output, 10));
    
        Position.X = 75;
    
        m_Console->SetPosition(Position);
        m_Console->OutputString("Endurance: ");
        m_Console->OutputString(itoa(player->GetEndurance(), Output, 10));
    
        Position.X = 52;
        Position.Y = 15;
    
        m_Console->SetPosition(Position);
        m_Console->OutputString("Charm: ");
    
        Position.X = 75;
    
        m_Console->SetPosition(Position);
        m_Console->OutputString("Current Level: ");
        m_Console->OutputString(itoa(player->GetLVL(), Output, 10));
    
        Position.X = 52;
        Position.Y = 17;
    
        m_Console->SetPosition(Position);
        m_Console->OutputString("Experience points to next level: ");
        m_Console->OutputString(itoa(player->GetXP(), Output, 10));
    
        Position.X = 52;
        Position.Y = 19;
    
        m_Console->SetPosition(Position);
        m_Console->OutputString(player->GetWeapon()->GetName());
    
        Position.X = 75;
        m_Console->SetPosition(Position);
        m_Console->OutputString(player->GetArmor()->GetName());
    
        Position.X = 52;
        Position.Y = 20;
    
        m_Console->SetPosition(Position);
        m_Console->OutputString(itoa(player->GetWeapon()->GetMinAmount(), Output, 10));
        m_Console->OutputString("-");
        m_Console->OutputString(itoa(player->GetWeapon()->GetMaxAmount(), Output, 10));
    
        Position.X = 75;
    
        m_Console->SetPosition(Position);
        m_Console->OutputString(itoa(player->GetArmor()->GetAP(), Output, 10));
    
    }

  7. #22
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    Some simple functions might make that easier to read.
    Code:
    void outputstring(int n) {
        m_Console->OutputString(itoa(n, Output, 10));
    }
    Or, since I don't like itoa(),
    Code:
    void outputstring(int n) {
        sprintf(Output, "%d", n);
        m_Console->OutputString(Output);
    }
    (And shouldn't Output contain 11 characters, not 10?)

    Something like this would also help . . . .
    Code:
    void setposition(int x, int y) {
        COORD Position;
    
        Position.X = x;
        Position.Y = y;
    
        m_Console->SetPosition(Position);
    }
    You could even "cache" the previous position as you do in your code.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  8. #23
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    That's a very good console GUI. Now you need to work on the important part which is the game logic and story. The interesting part of a game is that the graphics are only the front end to a very complicated back end. The game could run just fine with no display at all because it operates on structures and objects in memory. So if you get that part down correctly, adding graphics later is actually quite trivial depending on how complicated you make the graphics.

    Modern day graphics amount to call this to do that. Essentially you can throw a bunch of crapola on the screen, find some cool post processing pixel shader and implement it and make the whole scene look surreal.

    The algorithms behind the graphics are actually far more important than any of the eye candy.
    Last edited by VirtualAce; 12-13-2007 at 07:46 PM.

  9. #24
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,031
    Well, I suppose you could actually do drawing on a bitmap and then blit that onto the screen. I don't know how efficient it is, if there's any hardware acceleration, etc, but it's a bit overkill for now. Just concentrate on a poor GUI that doesn't look distracting for the eye and concentrate on the game details.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #25
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    The revised console GUI looks good. The original one hurt my eyes with its red-on-green colour scheme.

    Bubba is right. You should try to make it so that you can later simply switch the GUI to a graphical one. If you correctly use interfaces in the object-oriented sense, that ought to be easy.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  11. #26

    Join Date
    May 2005
    Posts
    1,041
    The first bunch of posters are tool bags. It's people like that which make programming really blow.

    At the OP: I think that's a very good console GUI (and I actually don't mind the green). As Bubba said, if you move on to game content (logic, ai, etc) you'll have what the vast majority of amateur programmers don't: an actual playable game.

    Once you get this experience down, jumping into more complicated topics will be easier. It will also feel good to show up the tools that were ragging on your work for no good reason.
    I'm not immature, I'm refined in the opposite direction.

  12. #27
    Registered User
    Join Date
    Aug 2003
    Posts
    1,209
    Yup, agree with Bubba and Bob.

    Dont let the first posters get to you, to me they seem to think graphic is everything (and no that isnt a good thing, and no again; i dont care if i stepped on your toes or your whole foot there). You have a very neat-looking console-GUI, that looks really nice with the grey and black. That is probably better than anything i could throw together with the console.

    And i second Bubba on the moving to the actual game-content part now. You have the GUI...the tricky part is everything else, with how to manage memory, how to process things and whatnot. You have a good base though so keep going!
    Last edited by Shakti; 12-14-2007 at 08:27 AM.
    STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.

  13. #28
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,031
    It looks horrible compared to a real GUI.
    Of course, I couldn't have anticipated what you wanted to do with the project - to learn all about basic stuff. I could just as well have thought you were creating an rpg and were experienced with window programming or something.

    If you're just going to write it as a test project to improve skills, then screw the graphics and get to the coding.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  14. #29
    Registered User
    Join Date
    Aug 2003
    Posts
    1,209
    But it looks better than no GUI, and looks great for being a console GUI. And do you really think if the poster was really experienced with window programming that he wouldnt have used windows API/MFC/Some other GUI API from the beginning?
    STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.

  15. #30
    Registered User
    Join Date
    Jan 2007
    Posts
    89
    dwks:

    Or, since I don't like itoa(),
    I know itoa() has its problems but I had forgotten about sprintf().

    You could even "cache" the previous position as you do in your code.
    By "cache" do you mean:
    Code:
    COORD SetPosition(COORD Position, int x, int y)
    {
         COORD old_Position = Position;
         
         Position.X = x;
         Position.Y = y;
         SetConsoleCursorPosition(m_Screen, Position);
    
         return old_Position;
    }
    I know some Window functions do do something like that, most notably SetTextColor function which returns the old COLORREF value.


    Too all other posters:

    Thanks...that was my original intention. I feel that this was an easier way to familiarize myself with maybe not Windows programming itself, but to some of the functions that go along with it. Also I kind of want to learn collision detection and a little bit of AI(A* pathfinding algorithm) without having to worry about rendering graphics to the screen and using an advanced graphics api with all of its libraries.

Page 2 of 3 FirstFirst 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem
    By ExDHaos in forum C++ Programming
    Replies: 12
    Last Post: 05-22-2009, 05:50 AM
  2. Clockwork screenshot - GUI
    By psychopath in forum Game Programming
    Replies: 17
    Last Post: 03-20-2006, 05:40 PM
  3. .NET And GUI Programming :: C++
    By kuphryn in forum C++ Programming
    Replies: 4
    Last Post: 01-27-2002, 04:22 PM
  4. GUI Programming :: C++ Exclusive
    By kuphryn in forum C++ Programming
    Replies: 5
    Last Post: 01-25-2002, 03:22 PM
  5. C++: Reference Book, GUI, Networking & Beyond
    By kuphryn in forum C++ Programming
    Replies: 4
    Last Post: 11-10-2001, 08:03 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21