Author Topic: [C++] using std::cout for animations?  (Read 7813 times)

0 Members and 1 Guest are viewing this topic.

Offline Pixel_Outlaw

  • Pentium
  • *****
  • Posts: 1382
  • Karma: 83
    • View Profile
[C++] using std::cout for animations?
« on: June 24, 2009 »


I know that is possible to use ascii to make animations in a dos box. I'm ready to make a simple game I think, but I need to know if it is possible to display an array (text buffer) of text instantly rather than line by line, which causes tearing when the buffer is updated. I would like to make a very simple ascii based graphic game at this point. Then continue with C++ going deeper and deeper.
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: [C++] using std::cout for animations?
« Reply #1 on: June 24, 2009 »
Not using standard C++, no.  If you're using Windows you can open your own console window and send it an array, but it's a little more complicated.  You might find some inspiration for that here http://www.dbfinteractive.com/forum/index.php/topic,413.0.html or in some of the other ascii demos that came with source http://www.dbfinteractive.com/forum/index.php/board,9.280.html

Jim
Challenge Trophies Won:

Offline Pixel_Outlaw

  • Pentium
  • *****
  • Posts: 1382
  • Karma: 83
    • View Profile
Re: [C++] using std::cout for animations?
« Reply #2 on: June 24, 2009 »
Thank you Jim, I was afraid it was windows dependent.
Challenge Trophies Won:

Offline madsravn

  • ZX 81
  • *
  • Posts: 13
  • Karma: 0
    • View Profile
Re: [C++] using std::cout for animations?
« Reply #3 on: June 24, 2009 »
Hi,

I am at work now, so I haven't looked through the posts Jim linked. So I'm not exactly sure what you want, but if it's what I think it is you could try using ncurses if you want it on linux. (Since you were "afraid it was windows dependent" I figure you wanted for something else). ncurses should do the trick on linux.
If this doesn't make any sense, then just disregard my reply. Hope it helps though.

Mads

Offline Pixel_Outlaw

  • Pentium
  • *****
  • Posts: 1382
  • Karma: 83
    • View Profile
Re: [C++] using std::cout for animations?
« Reply #4 on: June 25, 2009 »
Thanks for the reply!

I know that I can make it work for different operating systems, I was just hoping there was a way to keep the source code exactly the same. Otherwise I'd have to make the program in several flavors.
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: [C++] using std::cout for animations?
« Reply #5 on: June 25, 2009 »
Just to add my 2 cents worth.
I dont want to bring this up again dude, as I know you want to persue C++; but have a try with FreeBASIC it's free and its multi platform too. Plus Nino did a neat ASCII intro / demo.

There were examples made available at the TMDC site ( Text Mode Demo Competitions )  they might will help you with doing an ASCII / ANSI demos in the console window. It should be in the usefull links section. And there was a topic about it too. Sorry, I havent put up links, doing this is a bit of a hurry.

Hope some of this might shed some light for you.
Cheers,
Uncle Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17398
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: [C++] using std::cout for animations?
« Reply #6 on: June 25, 2009 »
Just to add my 2 cents worth.
I dont want to bring this up again dude, as I know you want to persue C++; but have a try with FreeBASIC it's free and its multi platform too. Plus Nino did a neat ASCII intro / demo.

There were examples made available at the TMDC site ( Text Mode Demo Competitions )  they might will help you with doing an ASCII / ANSI demos in the console window. It should be in the usefull links section. And there was a topic about it too. Sorry, I havent put up links, doing this is a bit of a hurry.

Hope some of this might shed some light for you.
Cheers,
Uncle Clyde.

Freebasic is good Clyde but C++ is better..... . . ..   .    .
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: [C++] using std::cout for animations?
« Reply #7 on: June 25, 2009 »
One might even get a job writing C++, and it's a good stepping stone to C# which everyone is using now.

Jim
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1292
  • Karma: 466
    • View Profile
    • my stuff
Re: [C++] using std::cout for animations?
« Reply #8 on: June 25, 2009 »
Quote
have a try with FreeBASIC it's free and its multi platform too.
and kind of dead.
Challenge Trophies Won:

Offline madsravn

  • ZX 81
  • *
  • Posts: 13
  • Karma: 0
    • View Profile
Re: [C++] using std::cout for animations?
« Reply #9 on: June 25, 2009 »
Pixel_Outlaw, if you find anything that can be used on both linux and windows without any libraries or too much stuff, would you please either PM me or let us know in this thread? :) I have been thinking about the same thing once in a while :)


Offline Pixel_Outlaw

  • Pentium
  • *****
  • Posts: 1382
  • Karma: 83
    • View Profile
Re: [C++] using std::cout for animations?
« Reply #10 on: June 26, 2009 »
I guess I'll tell why I decided on C++

Prepare yourself for a story.

In my freshman high school year, I enrolled in computer club. Now at the time their leader ( the brother of a close friend) was teaching how to design simple HTML web pages. I saw something there that sparked my interest. I too wanted to use the computer to do my will rather than just read material and make basic documents. HTML was too difficult to learn at the time because I had no reference manuel just a poor teacher that knew his stuff but went too fast for me. I dropped the club after the first class.

I then found RPG Maker 2000 on the internet and waited 3 hours for the 2 megabyte file to download. I started some simple scripting but never got anywhere with it.

Some time later, I found Game Maker (forgive me) and started making some drag n drop button based games. I started leaning more and more towards actually coding in Mark Overmar's GML language. Soon I wouldn't touch the drag n drop end of Game Maker and wrote games mostly in code. I felt hollow and shameful when my games were not taken seriously so I set out to prove myself with a real programming language.

Now all the kiddies on Game Maker Forum were talking C++. So naturally I decided to give up Game Maker and learn C++. I purchased "Teach Yourself C++ in 24 Hours". About 7 chapters into it I fell flat on my face. I asked for "C++ for Dummies" for Christmas later that year. Feeling that that book was not geared towards game making I purchased "Teach Yourself Game Programming in 24 Hours". That book also used C++ but the author expected the reader to already know C++ focusing on just the game engine side. A few years later I found a book that focused on making games in C++ for the C++ beginner. This was "C++ for the Absolute Beginner". This was just set aside and I never really pushed myself to learn much of it. I then saw "Fundamentals of C++" on a bargain shelf. I looked through it, it appeared to be a book for students, and better yet they were using drawing commands towards the end of the book! Imagine that, this must be the secret drawing library of C++ than the other books left out! Guess what, it was full of antiquated code from a long expired library. Those little drawings shown in the book gradually faded into the cold heartless DOS box I'd seen so many times before.

Enter Blitzmax

Blitzmax was a wonderful tool. After a week of migraines I was making a simple Tempest game. I felt more like a man because I was able to cast off the chains of Game Maker. Also the programming model damage done by Game Maker was having to be reversed and it was quite painful. So I wrote about 4 or 5 games with Blitzmax.

Wanting to move from blitzmax I picked up "Build a Program Now" which discussed Visual Basic. I thought that this might be the language until I realized that it looked like the same nonsense that Game Maker was. I decided HELL NO after reading a chapter.

2009 - Now I have finished my associate's degree in college. I've enrolled in a university that has a serious computer department. I've just told the head of said department that I know a little about programming.

Ryan: "I do a little programming, I love making games."
Computer Department Head: "Oh, cool what language do you use?"
Ryan: "Well, I use Blitzmax, which is based on BASIC but adds some OOP principals and also a multimedia library."
Ryan: "I've also used a small bit of C++ but not for anything fancy."
Computer Department Head: "Well we teach Java and some C++ here as well as assembly."

Just last year I found a C++ book for $5 at Salvation Army. I just recently sat down and finished it. The last two chapters completely fell apart conceptually. However from the previous books I was able to understand all of what was going on and even learn some new things. I'm now restarting "C++ Programming for the Absolute Beginner" and really enjoying it this time. I know that making demos and true games is a bit far off but now I have a better idea of what programming is in any language. I'll learn something like Allegro or SDL next for my interactivity.

So there you have it, I have about 5 or 6 C++ books (about $250 worth) and an upcoming two years of hardcore programming. Why not get a jump on C++ to make those lessons easier? I'll still have to learn Java an assembly however. Also C++ seems to be a common language anymore for the game industry.

Probably more than anyone wanted to hear or know. This is what it has been like to try to make games in the middle of Montana without anyone to sit down and learn from. As you can probably see, I have tried and tried and tried C++ I have hundreds of dollars worth of C++ books. Now that I have a good hold on Blitzmax I think I'll make it in C++. It was just too hard to jump from Game Maker to C++. Game Maker is a full of bad ideas and notions about programming.
« Last Edit: June 26, 2009 by Pixel_Outlaw »
Challenge Trophies Won:

Offline DrewPee

  • I Toast Therefore I am
  • Pentium
  • *****
  • Posts: 563
  • Karma: 25
  • Eat Cheese - It's good for you!
    • View Profile
    • Retro Computer Museum
Re: [C++] using std::cout for animations?
« Reply #11 on: June 26, 2009 »
Nice post there Pixel_Outlaw! ;)

I need to learn something a little more mainstream too - I work in print and that is really terrible at the moment, printers are closing all around the UK. I guess another career, maybe programming? and a language such as C++ would be something to learn to use eventually as a job.

Enough of me . . . again nice one! ;)
DrewPee
aka Falcon of The Lost Boyz (Amiga)
Ex-Amiga Coder and Graphic Designer
Administrator of > www.retrocomputermuseum.co.uk

Offline rdc

  • Pentium
  • *****
  • Posts: 1495
  • Karma: 140
  • Yes, it is me.
    • View Profile
    • Clark Productions
Re: [C++] using std::cout for animations?
« Reply #12 on: June 26, 2009 »
Take a look at the Doryen Library. This is a library for making roguelike games primarily, but would be very useful for text based applications since it emulates a truecolor console using SDL. It also has some other nifty things in it like a heightmap generator and noise functions. It is also cross platform, and quite easy to use.