Problem with gslib

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
BiB
Posts: 36
Joined: Fri Feb 27, 2004 8:13 am
Location: France

Problem with gslib

Post by BiB »

I am making a little sample using GsLib and i have a problem.

First, I declare a gsDriver object :

Code: Select all

gsDriver GS;
but when i want to do something with it, the prog hangs.

For example :

Code: Select all

GS.setDisplayMode(.......);


I saw that when i put the declaration inside a function, it works.

But i want to use the same gsDriver in many functions. How can I do it ?

It seems that the gsDriver is not correctly if defined outside a function.

Any idea is welocme :wink:
t0mb0la
Posts: 24
Joined: Tue Jan 20, 2004 5:31 pm
Location: Seattle WA, USA
Contact:

Post by t0mb0la »

Just a guess, but perhaps you need to call _init at the start of your main.

Code: Select all

extern "C" { void _init(void); }

int main(int argc, char **argv)
{
 _init();
 .
 .
 .
}
BiB
Posts: 36
Joined: Fri Feb 27, 2004 8:13 am
Location: France

Post by BiB »

I saw that you did that for altimit but i don't understand this thing.

Can you explain me what this call does ?

Thanks
MrSiir[S]
Posts: 32
Joined: Tue Sep 14, 2004 11:08 am

Re: Problem with gslib

Post by MrSiir[S] »

BiB wrote:I saw that when i put the declaration inside a function, it works.
But i want to use the same gsDriver in many functions. How can I do it ?
It seems that the gsDriver is not correctly if defined outside a function.
Any idea is welocme :wink:
Test this:

Code: Select all

// outside functions (global var)
gsDriver* myGsDriver;

// in main
int main()
{
	myGsDriver = new gsDriver;
	myGsDriver->setDisplayMode(
	....
}

// In other function
void foo()
{
	myGsDriver->drawPipe.RectFlat(0,0,100,100,0,black);
}
Post Reply