Loading animation

This is a discussion on Loading animation within the C Programming forums, part of the General Programming Boards category; Hi, Again I've searched through faq's, Google and forum but haven't found anything that helped. What I want to do ...

  1. #1
    1ST R. vd Kooij
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    154

    Loading animation

    Hi,

    Again I've searched through faq's, Google and forum but haven't found anything that helped.
    What I want to do is overwrite a textline on the same line on screen. So instead of writing on a new line everytime, I want to refresh the existing line. For example I'd like to make a small "reading data indicator" like a "loading indicator"

    Here's the output as it is now:
    Code:
    .
    ..
    ...
    .
    ..
    ...
    But I'd like to have this output on the same line so it looks like a loading animation.
    In other words, how can I shift back to the beginning of a line (like the home key does) and overwrite the on-screen text?

    I've tried with backspace '\b' but that doesn't give the right result (dots still shifting to the right or not 'animating' at all).

    Hope it's clear, very difficult to explain :S. Thanks in advance for any advice
    http://www.f1rstracing.nl/
    OS: Windows XP
    Compiler: Dev-C++

  2. #2
    Registered User
    Join Date
    Feb 2006
    Posts
    17
    If your compiler provides it, you could use the non-standard functions gotoxy and clrscr.

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You'll need to specify what OS and compiler. What you want is OS/compiler specific functions to manipulate the screen. You can use Borland's gotoxy functions, something like the curses library, ANSI escape codes, etc etc.


    Quzah.
    Hope is the first step on the road to disappointment.

  4. #4
    1ST R. vd Kooij
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    154
    My OS is Windows XP and I use the Dev-C++ compiler (so gotoxy() wont work?). clrscr() wont work cos there's more info on the screen and I dont want that to be flashing .
    http://www.f1rstracing.nl/
    OS: Windows XP
    Compiler: Dev-C++

  5. #5
    Registered User
    Join Date
    Feb 2006
    Posts
    155
    >clrscr() wont work cos
    just overwrite characters in the same space with a slight delay.

  6. #6
    1ST R. vd Kooij
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    154
    Quote Originally Posted by qqqqxxxx
    >clrscr() wont work cos
    just overwrite characters in the same space with a slight delay.
    Sorry, I'm not exactly sure what u mean?

    Also I'd like to point out that a delay can't be used in this function cos I use it for displaying when a CAN message is received and I dont want a delay in the reception of messages
    http://www.f1rstracing.nl/
    OS: Windows XP
    Compiler: Dev-C++

  7. #7
    Registered User
    Join Date
    Feb 2006
    Posts
    155
    >when a CAN message is received and I dont want a delay in the reception of messages

    try multi threading then.


    >so gotoxy() wont work
    and check the faq entry on how to gotoxy in a windows console.
    Last edited by qqqqxxxx; 04-03-2006 at 06:08 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Cargo loading system
    By kyle rull in forum C Programming
    Replies: 1
    Last Post: 04-20-2009, 12:16 PM
  2. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  3. Animation class not working
    By VirtualAce in forum Game Programming
    Replies: 5
    Last Post: 03-02-2005, 05:48 AM
  4. Loading Screen
    By pinkcheese in forum Windows Programming
    Replies: 2
    Last Post: 04-06-2002, 10:48 PM
  5. Loading Animation
    By CanadianOutlaw in forum C++ Programming
    Replies: 2
    Last Post: 11-23-2001, 12:29 PM

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