Thread: A few problems with basic text graphics...

  1. #1
    Registered User
    Join Date
    Sep 2006

    A few problems with basic text graphics...

    At the moment, I'm having a bit of trouble with the screen refresher for my very poor Roguelike attempt. Essentially, rather than reprint the entire screen anytime anything changes, I'd like to check each tile for a change and only reprint that tile if something new is there - like so:

    void location::refresh_temp()  //creates a temporary map
         /*xdisp and ydisp are the actual x and y location of the
         top left corner of the display. z is a qualifier - 1 is terrain,
         3 is mobile objects - nothing else has been coded yet*/
         for (int y = ydisp; y < (ydisp+31); y++) {
               for (int x = xdisp; x < (xdisp+101); x++){
                     for (int z = 0; z < 5 ; z++){
                           mapt[x][y][z] = map[x][y][z];/*mapt is the temporary*/
                                                        /*map array*/
    void location::refresh_print() //prints tiles that have changed
         /*printloc(x,y,x1,y1) prints actual map tile x,y at display location
         x1,y1 (hopefully if the tile at x1,y1 has changed in value*/
         int x1(0);
         int y1(0);
         for (int y = ydisp; y < (ydisp+31); y++){
               for (int x = xdisp; x < (xdisp+101); x++){
                     for (int z = 0; z < 5; z++){
                           if (mapt[x][y][z] != map[x][y][z]){
    I know the values are being passed and compared correctly, because the scrolling movement shows the top/bottom/side walls correctly, and the '@' character representing the player moves around more or less as it should... but nothing else changes. I *think* that for some reason either refresh_print() isn't checking every single space as it should, or that it isn't printing every single space as it should. Or maybe both. I've checked and rechecked this, I've added a function to display the map and mapt values, I've done everything I can think of, and I'm still not sure why it's not working. It's probably something incredibly simple that I'm overlooking, but if anyone has any ideas, I'd be really grateful...

    EDIT: Woah, sorry... I should have realised that would go a little overboard.
    Last edited by 20,000leeks; 09-19-2006 at 06:39 AM.

  2. #2
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Whoa can you fix the indentation please? That's a pain in the ass to read - I'm allergic to horizontal scroll bars.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  3. #3
    Software engineer
    Join Date
    Aug 2005
    Looks like one of those programming brain-buster quizes with the instructor asking, "what does this do? Write your result on paper..."

  4. #4
    Registered User
    Join Date
    Sep 2006
    Now imagine that the bulk of my coding looks remarkably like that (especially when it's the result of 2AM sessions), and you see my problem in figuring out what's going wrong :P

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 19
    Last Post: 05-30-2007, 05:47 PM
  2. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  3. Graphics problems
    By steveiwonder in forum C++ Programming
    Replies: 1
    Last Post: 11-14-2005, 08:50 AM
  4. How to use FTP?
    By maxorator in forum C++ Programming
    Replies: 8
    Last Post: 11-04-2005, 03:17 PM
  5. Problems displaying content of a text file
    By melissa in forum C++ Programming
    Replies: 5
    Last Post: 11-12-2001, 06:13 PM