pouët.net

Go to bottom

PixelToaster codeing problems

category: general [glöplog]
 
don wanna retype it
http://www.random-seed.net/forum/show.php?f=3&topic=20070201114121&u=1

Any ideas? I'm not particularly good with OOP, so that in itself is a problem.
added on the 2007-02-01 18:49:23 by xteraco xteraco
Quote:
Display ptDisplay( " ", iScrWidth, iScrHeight, ptOutput, ptMode );


This is a local variable to spScreen and not related to the ptDisplay that you declared in main.h. Basicly, your display is not open yet.

Instead either give display options in the global one and remove the local variable. Or use open method explicitly in the function without declaring any other variable (do not use the "Display" again iow.)
Yeah, hehe, saying Display ptDisplay is like declaring a new ptDisplay, and sorotf nulling out the global one from the main.h ...
added on the 2007-02-01 19:42:55 by xteraco xteraco
I changed the Main.cpp, and now I'm getting a strange error. Lets see if this BB has code tags, here is my main.cpp.

Code: #include "main.h" int main() { spScreen(320,240,false); while(1){ spPix(rand() % 320,rand() % 240,0.5,0.5,0.5);} } int spPix(int iXPos,int iYPos,double dRR,double dGG,double dBB) { pixels[iXPos+iYPos* iScrWidth].r=dRR; pixels[iXPos+iYPos* iScrWidth].g=dGG; pixels[iXPos+iYPos* iScrWidth].b=dBB; ptDisplay.update(pixels); } int spScreen(int iScrWidth,int iScrHeight,bool bFullScreen) { if(bFullScreen = true){ptOutput = Output::Fullscreen; } if(bFullScreen = false){ptOutput = Output::Windowed;} ptDisplay( " ", iScrWidth, iScrHeight, ptOutput, ptMode ); //display must be set before you setup vector array ptDisplay.open(); }


And here is the error.

Code: error: no match for the call to ' (PixelToaster::Display) (const char[2],int&,int&,PixelToaster::Output&,PixelToaster::Mode&)'


If this thing doesent have code tags, and looks all garbled, you can see it here:

http://www.random-seed.net/forum/show.php?f=3&topic=20070201114121&u=2
added on the 2007-02-01 19:54:01 by xteraco xteraco
Quote:
ptDisplay( " ", iScrWidth, iScrHeight, ptOutput, ptMode );

you can only use this syntax when constructing a variable (or with operator overloading which is not the case with p.t.) bu you have constructed it before (see main.h). check if there is a method like
Code:ptDisplay.open( " ", iScrWidth, iScrHeight, ptOutput, ptMode );
That did it. Damn, I was kinda close, I had added the ptDisplay.open(); to my main.cpp... Was just usin it wrong. Thanks a million man! :)
added on the 2007-02-01 20:13:43 by xteraco xteraco

login

Go to top