double gm_init()
{
/* First we check to make sure GiiMote is not already initialized, and if it is, we return the error code –1.0 */
if (!GiiMote::initialized)
{
/* Here we try to create a new instance of GiiMote, and if an error is thrown we return the error code 0 */
try
{
gcnew GiiMote();
}
catch(...)
{
return ( 0 );
}
}
else
{
return ( -1.0 );
}
/* Finally we return weather the initialization was a success or not by returning the initialized variable as a double. */
return ( (double)GiiMote::initialized );
}