bool error and only reading one of two id in list (using glpng) FIXED
I am not sure what to do with this... I have two images, one under background and one under character. the images are loaded into each but when being read, somehow they both have the same id even though i had separated them into their own objects..
actually, the id is not necessarily the second one because the information released is correct, but the id number when displayed still shows wrong just like the visual shown... i'm not sure what's wrong..
i have a boolean to keep track if the image is animated or a still image but somehow it resets to 204 during the setup phase but then in the rendering process, it is set to false.. and in doing so, the images are both sent to drawStill() instead of drawAnim()
right now i think there might be something wrong with the listed classes especially rendering or imgloader classes but i cannot locate it..
===================================================================
[Edited by - NGEVA on May 22, 2009 2:14:03 AM]
perhaps i analyzed the problem type a bit wrong and should have put this into [general programming]?...
EDIT: perhaps these might help?...
=====================================================
leading_node
=====================================================
area_graphics (i should name this graphics translation or something...)
=====================================================
area
=====================================================
level
[Edited by - NGEVA on May 20, 2009 9:05:50 PM]
EDIT: perhaps these might help?...
=====================================================
leading_node
#ifndef LEADNODE_H#define LEADNODE_H#include "node.h"#include "visualNode.h"#include "AreaGraphics.h"#include "linkedList.h"//#include "camera.h"#include "Rendering.h"//class AreaGraphics;//class rendering;#ifdef LEADNODE_H#define EXTERNA extern#else#define EXTERNA#endifEXTERNA linkedList<visualNode> render_root;class leading_node : public node{public: leading_node(); //virtual void addChild(visualNode c); void linkup(visualNode *c); void linkup(AreaGraphics *a);//(void)); void linkup(linkedList<visualNode> vis);// void setCurentCamera(camera *a);private:};#endif
#ifndef LEADNODE#define LEADNODE#include "leading_node.h"//#include "Rendering.h"#include <iostream>using namespace std;/*virtual void leading_node::addChild(visualNode c){ base.addChild(c);}*/leading_node::leading_node(){}void leading_node::linkup(visualNode *c){ //rendering(). render_root.insNext(c);}void leading_node::linkup(AreaGraphics *a)// (*)(void)){ AreaGraphics b = *a; cout<<"linking area to render_root"<<endl; render_root.insNext(b.getList());}//void leading_node::setCurentCamera(camera *a)/*{// cam = a;}*/#endif
=====================================================
area_graphics (i should name this graphics translation or something...)
/*manipulates the visibility of items within the area passed to itthen the data is read by leading node externally*/#ifndef AREAGRAPHICS_H#define AREAGRAPHICS_H//#include "Rendering.h"#include "area.h"#include "node.h"//#include "leading_node.h"#include "linkedList.h"#include "visualNode.h"//class area;class AreaGraphics : public node{public: AreaGraphics(); AreaGraphics(area *a); //void draw(node *background, node *character, node *object); linkedList<visualNode> *getList(); void scanBackgrounds(); void scanCharacters();private: //_level *current; area *_area; linkedList<visualNode> finalList;};//==============================================================#endif
#include "AreaGraphics.h"#include <iostream>using namespace std;AreaGraphics::AreaGraphics(){}linkedList<visualNode> *AreaGraphics::getList(){ return &finalList;}AreaGraphics::AreaGraphics(area *a){ _area = a; scanBackgrounds(); cout<<"finalList has "<<finalList.totalItems()<<" items"<<endl; scanCharacters(); cout<<"finalList has "<<finalList.totalItems()<<" items"<<endl;}void AreaGraphics::scanBackgrounds(){ if(_area->bkgd.currentEmpty()) return; do{ if( _area->bkgd.getCurrentData()->getVisibility() ) { finalList.insTail(&_area->bkgd.current->data);//getCurrentData()); cout<<"added ";_area->bkgd.current->data.showFilename(); cout<<" to finalList"<<endl<<" "; _area->bkgd.current->data.show_pngInfo_dump();//cout<<endl; } if(_area->bkgd.retNext()) _area->bkgd.moveFwd(); else break; }while(true);}void AreaGraphics::scanCharacters(){ if(_area->chr.currentEmpty()) return; do{ if( _area->chr.getCurrentData()->getVisibility() ) { finalList.insTail(&_area->chr.current->data);//getCurrentData()); cout<<"added ";_area->chr.current->data.showFilename();cout<< " to finalList"<<endl<<" "; _area->chr.current->data.show_pngInfo_dump();//cout<<endl; } if(_area->chr.retNext()) _area->chr.moveFwd(); else break; }while(true);}
=====================================================
area
#ifndef AREA_H#define AREA_H//#include "AreaGraphics.h" //friend#include "background.h"#include "object.h"#include "character.h"#include "node.h"#include "linkedList.h"class AreaGraphics;typedef linkedList<background> backgrounds;typedef linkedList<character> characters;class area: public node{ friend class AreaGraphics;public: area(); void addBkgd(char *filename);// addObject(); void addChr(char *filename); int getAreaID(); void setID(int num); character getCharacter(int character_num);private: int area_id; backgrounds bkgd; characters chr; int totalCharacters;// linkedList<object> obj;// linkedList<character> ch;};#endif
#include "area.h"#include <iostream>using namespace std;int area::getAreaID(){ return area_id;}area::area(){ totalCharacters=0;}void area::addBkgd(char *filename){ cout<<"running addBkgd"<<endl; cout<<"bkgd.currentEmpty() = "<<bkgd.currentEmpty()<<endl; if(!bkgd.currentEmpty()) return; background *temp; background tempa; cout<<"loading file: "<<filename<<endl; cout<<"current file loaded: ";tempa.showFilename(); tempa.load(filename); cout<<"current file loaded: ";tempa.showFilename(); tempa.setVisible(); temp = &tempa; bkgd.insNext(&tempa);}character area::getCharacter(int character_num){ character emptyTemp; if(chr.current==0)//Empty()) return emptyTemp;//0;//!chr.currentEmpty(); chr.current = chr.head; while(chr.current->data.getCharacterID()!=character_num) { if(chr.retNext() == 0) return emptyTemp;//0; chr.moveFwd(); } return chr.current->data;}void area::addChr(char *filename){ cout<<"running addChr"<<endl; cout<<"chr.currentEmpty() = "<<chr.currentEmpty()<<endl; //if(!chr.currentEmpty()) // return; character tempa; cout<<"loading file: "<<filename<<endl; cout<<"current file loaded: ";tempa.showFilename(); tempa.load(filename); cout<<"current file loaded: ";tempa.showFilename(); tempa.setVisible();// temp = &tempa; chr.insNext(&tempa);// chr.moveFwd(); chr.current->data.addCharacter(); totalCharacters++;}void area::setID(int num){ area_id = num;}
=====================================================
level
//#include "Rendering.h"#include "area.h"#include "node.h"//#include "background.h"#include "linkedList.h"//friend class _AreaGraphics();class _level: public node{public: _level(); void addArea(); void addBackground(char *filename, int area_num); void addCharacter(char *filename, int area_num);//, int character_num); linkedList<area> getArea(); area getArea(int area_num); void getCurrentArea(int area_num); area currentArea;// addObject();// addCharacter();private: /* character; object;*/// background; int totalAreas; linkedList<area> _area; };
#include "Level.h"_level::_level(){ totalAreas=0;}linkedList<area> _level::getArea(){ return _area;}void _level::getCurrentArea(int area_num){ currentArea = getArea(area_num);}area _level::getArea(int area_num){ area emptyTemp; if(_area.current==0)//Empty()) return emptyTemp;//0; _area.current = _area.head; while(_area.current->data.getAreaID()!=area_num) { if(_area.retNext() == 0) return emptyTemp;//0; _area.moveFwd(); } return _area.current->data;}void _level::addArea(){ totalAreas++; area *temp; area tempa; tempa.setID(totalAreas); temp = &tempa; //temp->setID(totalAreas); _area.insNext(temp);}void _level::addBackground(char *filename, int area_num){ _area.current=_area.retFirst(); while(_area.current->data.getAreaID()!=area_num) { if(!_area.retNext()) return; _area.moveFwd(); } _area.current->data.addBkgd(filename);}void _level::addCharacter(char *filename, int area_num)//, int character_num){ _area.current=_area.retFirst(); while(_area.current->data.getAreaID()!=area_num) { if(!_area.retNext()) return; _area.moveFwd(); } _area.current->data.addChr(filename);}
[Edited by - NGEVA on May 20, 2009 9:05:50 PM]
so 204 = 0001 1110
i guess that makes sense for why the value is also zero but then it is still weird... the currently animated debug line is also within the imgLoader just like the show all info function.... why does it khasve a difference between 204 and 0?... but also,m as two separate objects, i don't get why they seem o have overwritten values.. and the setting of isAnimated to 0 or 1 don't really seem to affect anything... i was able to fill in the frame values during the run but it won't be displayed properly because it will see it as 0 (or, not animated) and then proceed with the drawStill() function....
new console debugging output
the issue was in how i setup the character versus how i setup the area. with the area i had setID but the characers had a different sort of thing which in reality should have been the same and when i reverted the function to look like the setID for add area, the 204 reappearance problem disappeared
===================================================================
updated debug code. the 204 reappearance issue is removed. the end resultant value for isAnimated is still sitting at 0 though and the id problem remains as well
===========================================================
i fixed the isAnimated issue when i attempted to revert my get functions into pointer based referencing. all that remains is the id matter.... during the loading it overwrites the id.. even the individual id gets overwritten... not sure why...
[Edited by - NGEVA on May 21, 2009 6:35:51 PM]
i guess that makes sense for why the value is also zero but then it is still weird... the currently animated debug line is also within the imgLoader just like the show all info function.... why does it khasve a difference between 204 and 0?... but also,m as two separate objects, i don't get why they seem o have overwritten values.. and the setting of isAnimated to 0 or 1 don't really seem to affect anything... i was able to fill in the frame values during the run but it won't be displayed properly because it will see it as 0 (or, not animated) and then proceed with the drawStill() function....
new console debugging output
========================================running addBkgdbkgd.currentEmpty() = 1loading file: test_background.pngcurrent file loaded:pre loadpost loadSize=640,480 Depth=8 Alpha=0current item has the following id: 1isAnimated currently is: 204isAnimated currently is: 0current file loaded: test_background.png========================================running addChrchr.currentEmpty() = 1loading file: SuperSonic1.pngcurrent file loaded:pre loadpost loadSize=287,98 Depth=16 Alpha=8current item has the following id: 2isAnimated currently is: 204isAnimated currently is: 0current file loaded: SuperSonic1.pngisAnimated currently is: 204isAnimated currently is: 1========================================added test_background.png to finalList Size=640,480 Depth=8 Alpha=0finalList has 1 items=============================================================================Show All Info_filename : test_background.png | filename : <POINTER> | isVisible : 1isAnimated : 0 | id : 2 | imgID : 2width : 640 | height : 480Size=640,480 Depth=8 Alpha=0=============================================================================added SuperSonic1.png to finalList Size=287,98 Depth=16 Alpha=8finalList has 2 items=============================================================================Show All Info_filename : test_background.png | filename : <POINTER> | isVisible : 1isAnimated : 0 | id : 2 | imgID : 2width : 640 | height : 480Size=640,480 Depth=8 Alpha=0==========================================================================================================================================================Show All Info_filename : SuperSonic1.png | filename : <POINTER> | isVisible : 1isAnimated : 0 | id : 2 | imgID : 2width : 287 | height : 98Size=287,98 Depth=16 Alpha=8=============================================================================linking area to render_root=============================================================================Show All Info_filename : test_background.png | filename : <POINTER> | isVisible : 1isAnimated : 0 | id : 2 | imgID : 2width : 640 | height : 480Size=640,480 Depth=8 Alpha=0==========================================================================================================================================================Show All Info_filename : SuperSonic1.png | filename : <POINTER> | isVisible : 1isAnimated : 0 | id : 2 | imgID : 2width : 287 | height : 98Size=287,98 Depth=16 Alpha=8=============================================================================linking now in progress.linked=========================================render_root is not emptyrender_root has 2 items linked.=================================================================Size=640,480 Depth=8 Alpha=0rendering item: test_background.pngtest_background.png's animation status is: 0current item has id: 2running drawStill()test_background.png===========================================================Size=287,98 Depth=16 Alpha=8rendering item: SuperSonic1.pngSuperSonic1.png's animation status is: 0current item has id: 2running drawStill()SuperSonic1.png===========================================================render_root is not emptyrender_root has 2 items linked.=================================================================Size=640,480 Depth=8 Alpha=0rendering item: test_background.pngtest_background.png's animation status is: 0current item has id: 2running drawStill()test_background.png===========================================================Size=287,98 Depth=16 Alpha=8rendering item: SuperSonic1.pngSuperSonic1.png's animation status is: 0current item has id: 2running drawStill()SuperSonic1.png===========================================================render_root is not emptyrender_root has 2 items linked.=================================================================Size=640,480 Depth=8 Alpha=0rendering item: test_background.pngtest_background.png's animation status is: 0current item has id: 2running drawStill()test_background.png===========================================================Size=287,98 Depth=16 Alpha=8rendering item: SuperSonic1.pngSuperSonic1.png's animation status is: 0current item has id: 2running drawStill()SuperSonic1.png===========================================================render_root is not emptyrender_root has 2 items linked.=================================================================Size=640,480 Depth=8 Alpha=0rendering item: test_background.pngtest_background.png's animation status is: 0current item has id: 2running drawStill()test_background.png===========================================================Size=287,98 Depth=16 Alpha=8rendering item: SuperSonic1.pngSuperSonic1.png's animation status is: 0current item has id: 2running drawStill()SuperSonic1.png===========================================================Press any key to continue . . .
the issue was in how i setup the character versus how i setup the area. with the area i had setID but the characers had a different sort of thing which in reality should have been the same and when i reverted the function to look like the setID for add area, the 204 reappearance problem disappeared
===================================================================
updated debug code. the 204 reappearance issue is removed. the end resultant value for isAnimated is still sitting at 0 though and the id problem remains as well
========================================running addBkgdbkgd.currentEmpty() = 1loading file: test_background.pngcurrent file loaded:pre loadpost loadSize=640,480 Depth=8 Alpha=0current item has the following id: 1isAnimated currently is: 204isAnimated currently is: 0current file loaded: test_background.png========================================running addChrchr.currentEmpty() = 1loading file: SuperSonic1.pngcurrent file loaded:pre loadpost loadSize=287,98 Depth=16 Alpha=8current item has the following id: 2isAnimated currently is: 204isAnimated currently is: 0current file loaded: SuperSonic1.pngisAnimated currently is: 0isAnimated currently is: 1========================================added test_background.png to finalList Size=640,480 Depth=8 Alpha=0finalList has 1 items=============================================================================Show All Info_filename : test_background.png | filename : <POINTER> | isVisible : 1isAnimated : 0 | id : 2 | imgID : 2width : 640 | height : 480Size=640,480 Depth=8 Alpha=0=============================================================================added SuperSonic1.png to finalList Size=287,98 Depth=16 Alpha=8finalList has 2 items=============================================================================Show All Info_filename : test_background.png | filename : <POINTER> | isVisible : 1isAnimated : 0 | id : 2 | imgID : 2width : 640 | height : 480Size=640,480 Depth=8 Alpha=0==========================================================================================================================================================Show All Info_filename : SuperSonic1.png | filename : <POINTER> | isVisible : 1isAnimated : 0 | id : 2 | imgID : 2width : 287 | height : 98Size=287,98 Depth=16 Alpha=8=============================================================================linking area to render_root=============================================================================Show All Info_filename : test_background.png | filename : <POINTER> | isVisible : 1isAnimated : 0 | id : 2 | imgID : 2width : 640 | height : 480Size=640,480 Depth=8 Alpha=0==========================================================================================================================================================Show All Info_filename : SuperSonic1.png | filename : <POINTER> | isVisible : 1isAnimated : 0 | id : 2 | imgID : 2width : 287 | height : 98Size=287,98 Depth=16 Alpha=8=============================================================================linking now in progress.linked=========================================render_root is not emptyrender_root has 2 items linked.=================================================================Size=640,480 Depth=8 Alpha=0rendering item: test_background.pngtest_background.png's animation status is: 0current item has id: 2running drawStill()test_background.png===========================================================Size=287,98 Depth=16 Alpha=8rendering item: SuperSonic1.pngSuperSonic1.png's animation status is: 0current item has id: 2running drawStill()SuperSonic1.png===========================================================render_root is not emptyrender_root has 2 items linked.=================================================================Size=640,480 Depth=8 Alpha=0rendering item: test_background.pngtest_background.png's animation status is: 0current item has id: 2running drawStill()test_background.png===========================================================Size=287,98 Depth=16 Alpha=8rendering item: SuperSonic1.pngSuperSonic1.png's animation status is: 0current item has id: 2running drawStill()SuperSonic1.png===========================================================render_root is not emptyrender_root has 2 items linked.=================================================================Size=640,480 Depth=8 Alpha=0rendering item: test_background.pngtest_background.png's animation status is: 0current item has id: 2running drawStill()test_background.png===========================================================Size=287,98 Depth=16 Alpha=8rendering item: SuperSonic1.pngSuperSonic1.png's animation status is: 0current item has id: 2running drawStill()SuperSonic1.png===========================================================render_root is not emptyrender_root has 2 items linked.=================================================================Size=640,480 Depth=8 Alpha=0rendering item: test_background.pngtest_background.png's animation status is: 0current item has id: 2running drawStill()test_background.png===========================================================Size=287,98 Depth=16 Alpha=8rendering item: SuperSonic1.pngSuperSonic1.png's animation status is: 0current item has id: 2running drawStill()SuperSonic1.png===========================================================render_root is not emptyrender_root has 2 items linked.=================================================================Size=640,480 Depth=8 Alpha=0rendering item: test_background.pngtest_background.png's animation status is: 0current item has id: 2running drawStill()test_background.png===========================================================Size=287,98 Depth=16 Alpha=8rendering item: SuperSonic1.pngSuperSonic1.png's animation status is: 0current item has id: 2running drawStill()SuperSonic1.png===========================================================render_root is not emptyrender_root has 2 items linked.=================================================================Size=640,480 Depth=8 Alpha=0rendering item: test_background.pngtest_background.png's animation status is: 0current item has id: 2running drawStill()test_background.png===========================================================Size=287,98 Depth=16 Alpha=8rendering item: SuperSonic1.pngSuperSonic1.png's animation status is: 0current item has id: 2running drawStill()SuperSonic1.png===========================================================render_root is not emptyrender_root has 2 items linked.=================================================================Size=640,480 Depth=8 Alpha=0rendering item: test_background.pngtest_background.png's animation status is: 0current item has id: 2running drawStill()test_background.png===========================================================Size=287,98 Depth=16 Alpha=8rendering item: SuperSonic1.pngSuperSonic1.png's animation status is: 0current item has id: 2running drawStill()SuperSonic1.png===========================================================render_root is not emptyrender_root has 2 items linked.=================================================================Size=640,480 Depth=8 Alpha=0rendering item: test_background.pngtest_background.png's animation status is: 0current item has id: 2running drawStill()test_background.png===========================================================Size=287,98 Depth=16 Alpha=8rendering item: SuperSonic1.pngSuperSonic1.png's animation status is: 0current item has id: 2running drawStill()SuperSonic1.png===========================================================Press any key to continue . . .
===========================================================
i fixed the isAnimated issue when i attempted to revert my get functions into pointer based referencing. all that remains is the id matter.... during the loading it overwrites the id.. even the individual id gets overwritten... not sure why...
[Edited by - NGEVA on May 21, 2009 6:35:51 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement