Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

ascii art animator... take two

Name: a nonny mouse 2007-05-01 19:06 ID:3AyWbj5L

here's a take two of the ascii art animator, now in optimized for memory & header file format

    /*

    ascii animated video program
    To create an AAV, simply create a text file with the following format
    1 or 0 <---- put at top of the file. How many numbers indicates how many passes. -1  indicates an infinite loop
   


    3 <--- height of current frame
    000   \
    000    |---content of frame (doesn't matter how wide, as long as it's the same hight as specified
    000   /
    1 <--- how long the frame lasts in seconds (can be a decimal value, e.g 0.04 is 1/25th of a second


    just keep on adding sections like this to build it up frame by frame
    enjoy!
    (thanks for the insults and better code from the /prog/ assholes)
    (copyright 2007 dominic rudkin, released under the lesser gpl)
    */
   
#include <iostream>
#include <stdio.h>
#include <time.h>
#include <fstream>
#include <vector>
#define WINDOWS
using namespace std;
void clear();

int animate(string filename)
{
string line;
int height,loop,dummy;
double frame;

ifstream file(filename.c_str());

if(!file)
{
    cerr << "Error opening file " << filename <<endl;
    return EXIT_FAILURE;

}
vector<std::string> contents_of_file;
getline(file, line);
loop = static_cast<int>(strtod(line.c_str(), NULL));
do
{
    ifstream file(filename.c_str());   
    getline(file, line);
    dummy = static_cast<int>(strtod(line.c_str(), NULL));
    while(getline(file, line))
    {

        contents_of_file.push_back(line);
        height = static_cast<int>(strtod(line.c_str(), NULL));
        while (height > 0)
        {
            getline(file, line);
            contents_of_file.push_back(line);
            cout << line << endl;
            --height;
        }
        getline(file, line);
        contents_of_file.push_back(line);
        frame = strtod(line.c_str(), NULL);
        contents_of_file.clear();
        usleep(static_cast<int>(frame*1000000));
        clear();

    }
--loop;
}while (loop!=1);
return 0;
}

void clear()
{
#ifdef WINDOWS
system("clear");
#endif
#ifdef LINUX
system("clear");

#endif
}

Name: Anonymous 2007-05-01 20:52 ID:vy/HTyoJ

NO EXCEPTIONS

Name: Anonymous 2007-05-02 4:37 ID:RS37ubdg

lol wut?
how do i compiled windows?

Name: Anonymous 2007-05-03 6:33 ID:whZFI9Sg

where the fuck is INT main ?!!!??!?!!?!??

Name: Anonymous 2007-05-03 7:14 ID:ArJW5uGV

roflmeow

Name: d 2007-05-03 9:58 ID:0vY90Xq1

    /*

    ascii animated video program
    To create an AAV, simply create a text file with the following format
    1 or 0 <---- put at top of the file. How many numbers indicates how many passes. 0 indicates infinite loop
    3 <--- height of current frame
    000   \
    000    |---content of frame (doesn't matter how wide, as long as it's the same hight as specified
    000   /
    1 <--- how long the frame lasts in seconds (can be a decimal value, e.g 0.04 is 1/25th of a second


    just keep on adding sections like this to build it up frame by frame
    enjoy!
    (thanks for the insults and better code from the /prog/ assholes)
    (copyright 2007 dominic rudkin)
    */
   
#include <iostream>
#include <stdio.h>
#include <time.h>
#include <fstream>
#include <vector>
#define WINDOWS
using namespace std;
   
void clear()
{
#ifdef WINDOWS
system("clear");
#endif
#ifdef LINUX
system("clear");

#endif
}


int main()
{
string line,filename;
int height,loop;
double frame;

  
cout << "Enter filename: ";
cin >> filename;
ifstream file(filename.c_str());

if(!file)
{
    cerr << "Error opening file " << filename <<endl;
    return EXIT_FAILURE;

}
vector<std::string> contents_of_file;
do
{
    ifstream file(filename.c_str());   
    getline(file, line);
    loop = static_cast<int>(strtod(line.c_str(), NULL));
    while(getline(file, line))
    {

        contents_of_file.push_back(line);
        height = static_cast<int>(strtod(line.c_str(), NULL));
        while (height > 0)
        {
            getline(file, line);
            contents_of_file.push_back(line);
            cout << line << endl;

            --height;
        }
        getline(file, line);
        contents_of_file.push_back(line);
        frame = strtod(line.c_str(), NULL);
        contents_of_file.clear();
        usleep(static_cast<int>(frame*1000000));
        clear();

    }
--loop;
}while (loop!=1);
return 0;
}

Name: Anonymous 2007-05-03 9:59 ID:3HpNXkYO

sample input files plz

Name: Anonymous 2007-05-03 10:05 ID:0vY90Xq1

text is too long, enjoy a download link.
http://www.mediafire.com/?9tjwqkycz2x
female sonic dancing... looks best with monospace bold italic / size 4 in bash.

Name: Anonymous 2007-05-03 10:13 ID:whZFI9Sg

YOU DIDNT FIX THE DECLARATION ERROR NOOB

Name: Anonymous 2007-05-03 10:18 ID:5tZbuBFn



#ifdef WINDOWS
system("clear");
#endif
#ifdef LINUX
system("clear");

#endif

hey guys have i failed yet

Name: Anonymous 2007-05-03 10:20 ID:0vY90Xq1

>>9
NO U

Name: Anonymous 2007-05-06 10:08 ID:nQwLT5GJ

furry anim is furry

Name: Anonymous 2009-01-14 15:22

YES

Name: Anonymous 2011-02-03 1:22

Name: Sgt.Kabu疥烒kiman羵꫻ 2012-05-29 1:10

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List