Drawing something on the screen...

This is a discussion on Drawing something on the screen... within the C++ Programming forums, part of the General Programming Boards category; When drawing something using the console, what different ways can you use to do, and can basic animation be created???...

  1. #1
    Registered User Finchie_88's Avatar
    Join Date
    Aug 2004
    Posts
    154

    Question Drawing something on the screen...

    When drawing something using the console, what different ways can you use to do, and can basic animation be created???

  2. #2
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    ASCII "art" or some form of a graphics library is the simple answer. There are a number of graphics libraries available. Graphic libraries are designed for this sort of thing, but are not generally considered beginner type projects. Moving ASCII char around the screen can be an interesting learning project.

  3. #3
    Registered User Finchie_88's Avatar
    Join Date
    Aug 2004
    Posts
    154
    Do you have any idea about how to start on a basic console animation program?

    I can think of a very very long winded way of doing it, but its nt very efficient, it goes as follows...
    Code:
    #include <iostream>
    #include <stdlib.h>
    #include <conio.h>
    #include <stdio.h>
    
    using namespace std;
    
    int main(int argc, char *argv[])
    {
        while(1) // can be done with out this
        {
      // Draw a frame here...
      sleep(0.04);
      //Draw next frame here...
      sleep(0.04);
      //Keep on doing this, and you will end up with a short animated sequence...
      //End the loop
    }  
      system("PAUSE");	
      return 0;
    }
    This code will not compile because I have forgotten the header needed to use the sleep function, if anyone knows, then please share it with the rest of us...
    Last edited by Finchie_88; 10-22-2004 at 12:56 PM.


  4. #4
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    That's the basics of it. Graphics libraries talk in terms of frames per second instead of Sleep(), but it's the same principle.


    I believe you can find Sleep() in windows.h, but don't quote me on that.

    If you are using iostream.h and using namespace std;, then I'd suggest you also use cstdio, cstdlib, cmath, ctime, cctype, etc. as well. They are the "latest and greatest versions" of the older C libraries.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GDI - Drawing to the screen correctly
    By Tonto in forum Windows Programming
    Replies: 1
    Last Post: 06-24-2006, 10:53 PM
  2. Feedback: Functional Specification Wording
    By Ragsdale85 in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2006, 04:56 PM
  3. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 10:18 PM
  4. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 03:41 AM
  5. drawing to screen
    By Noobie in forum C++ Programming
    Replies: 11
    Last Post: 02-27-2003, 04:37 PM

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