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.
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.
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.
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.
Yeah...That was my thinking...Get the game logic down first...Graphics is a whole different animnal.
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.
Quoted more than 1000 times (I hope).Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
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.
Not so complex, just alot of code.I don't think your console GUI is actually a lot simpler than a windows GUI code-wise.
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)); }
Some simple functions might make that easier to read.
Or, since I don't like itoa(),Code:void outputstring(int n) { m_Console->OutputString(itoa(n, Output, 10)); }
(And shouldn't Output contain 11 characters, not 10?)Code:void outputstring(int n) { sprintf(Output, "%d", n); m_Console->OutputString(Output); }
Something like this would also help . . . .
You could even "cache" the previous position as you do in your code.Code:void setposition(int x, int y) { COORD Position; Position.X = x; Position.Y = y; m_Console->SetPosition(Position); }
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.
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.
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.
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
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.
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.
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.
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.
dwks:
I know itoa() has its problems but I had forgotten about sprintf().Or, since I don't like itoa(),
By "cache" do you mean:You could even "cache" the previous position as you do in your code.
I know some Window functions do do something like that, most notably SetTextColor function which returns the old COLORREF value.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; }
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.