//============================================================================= // MenuManager::Quit // //============================================================================= int GameEngine::Quit(void) { char c='\0'; BM.TypeString(63, 6, " \0", m_color(R_BLUE,R_GREY,0,1)); BM.TypeString(79, 6, "_", m_color(R_BLUE, R_BROWN, 1,1)); BM.TypeString(64, 6, "End this game?\0", m_color(R_BLUE,R_GREY,0,1)); // check answer while ( (c!='y') && (c!='Y') && (c!='n') && (c!='N') ) { // read a key from the keyboard buffer. c=MM.GetChar(); } // if yes was typed, pass the exit code to the calling loop. if (c=='y' || c=='Y') return 1; else { // otherwise, redraw the GAMNEMENU and return the exit code. MM.DrawMenu(GAMEMENU); return 0; } }
// toRGBA( colour ); SQInteger CUtilNatives::ToRGBA( SQVM * pVM ) { SQInteger iColour; sq_getinteger( pVM, -1, &iColour ); CColor m_color( (unsigned long)iColour ); CSquirrelArguments args; args.push( m_color.R ); args.push( m_color.G ); args.push( m_color.B ); args.push( m_color.A ); CSquirrelArgument arguments(args, true); arguments.push( pVM ); return 1; }
// fromRGB( r, g, b[, a = 255] ); SQInteger CUtilNatives::FromRGB( SQVM * pVM ) { // Get the stack top int iTop = sq_gettop( pVM ) - 1; if( iTop < 3 || iTop > 4 ) { CHECK_PARAMS( "fromRGB", 3 ); } SQInteger r, g, b; SQInteger a = 255; if( iTop > 3 ) { CHECK_TYPE( "fromRGB", 1, -4, OT_INTEGER ); CHECK_TYPE( "fromRGB", 2, -3, OT_INTEGER ); CHECK_TYPE( "fromRGB", 3, -2, OT_INTEGER ); CHECK_TYPE( "fromRGB", 4, -1, OT_INTEGER ); sq_getinteger( pVM, -4, &r ); sq_getinteger( pVM, -3, &g ); sq_getinteger( pVM, -2, &b ); sq_getinteger( pVM, -1, &a ); } else { CHECK_TYPE( "fromRGB", 1, -3, OT_INTEGER ); CHECK_TYPE( "fromRGB", 2, -2, OT_INTEGER ); CHECK_TYPE( "fromRGB", 3, -1, OT_INTEGER ); sq_getinteger( pVM, -3, &r ); sq_getinteger( pVM, -2, &g ); sq_getinteger( pVM, -1, &b ); } CColor m_color( r, g, b, a ); sq_pushinteger( pVM, m_color.dwHexColor ); return 1; }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- cvf::Color3f RimAnnotationLineAppearance::color() const { return m_color(); }