Thread: Help with this simple program

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    195

    Help with this simple program

    Alright, i m trying to make this level creator for my console game as it is too complicated to type out the map in Notepad.

    So in this creator i want my cursor to be able to move in 4 directions and put a type (numbered 1-7) by pressing the 1-7 keys on the keyboard.

    The problem is, everytime i add a tile or move my cursor, the screen clears and then redraws it. soemtimes, if i want to move fast, the screen flickers a lot from clrscr() and i was wondering if anyone had a solution. The best i could do is not make the screen refresh constantly but just refresh when something has changed.

    Thanks for the help

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    The exe file is no good to anyone, post the code

    http://faq.cprogramming.com/cgi-bin/...&id=1043284385
    Are you using the "WINDOWS CONSOLE OPTION: (Credit: Sunlight)" method?
    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.

  3. #3
    Registered User harryP's Avatar
    Join Date
    Sep 2002
    Posts
    124
    Don't clear the screen everytime you make a change. That's unnecessary. Just update the one thing that needs updating (like in game, when moving a character around, rather than re-drawing the whole map everytime you want to show his new location, just draw his new location using printf or something. It works like a charm.)

    Brendan
    Draco dormiens nunquam titallandus.
    Console Graphics Library: http://www.geocities.com/steve_alberto/cgl.html

  4. #4
    Registered User
    Join Date
    May 2003
    Posts
    195
    Originally posted by Salem
    The exe file is no good to anyone, post the code

    http://faq.cprogramming.com/cgi-bin/...&id=1043284385
    Are you using the "WINDOWS CONSOLE OPTION: (Credit: Sunlight)" method?
    sorry bout that im attaching the code (its really messy and i used only global variables since its a short program)



    And HarryP, i know what you mean, but how could that be done using my code that im about to post? Could you give example please? Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with a very simple program
    By htdefiant in forum C++ Programming
    Replies: 13
    Last Post: 08-14-2007, 01:27 PM
  2. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  3. [Help] Simple Array/Pointer Program
    By sandwater in forum C Programming
    Replies: 3
    Last Post: 03-30-2007, 02:42 PM
  4. simple silly program
    By verbity in forum C Programming
    Replies: 5
    Last Post: 12-19-2006, 06:06 PM
  5. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 12:39 PM