Example #1
0
VariableEditor::VariableEditor(ExpressionEditor *_editor, ScriptGlobals *_globals)
	: Panel("VariableEditor", (GameControl::Get()->Width() - WIDTH)/2, 
				          (GameControl::Get()->Height() - HEIGHT)/2,
						  WIDTH, HEIGHT)
{
	SetModal();
	SetToolTip(TIP_VARIABLEEDITOR);

	editor = _editor;
	globals = _globals;
	

	Text *text;
	Button *button;	
	int y;

	//Title
	text = AddText("User Variables", CENTER_TEXT, 5);
	y = DrawHLine(text->Down() + 2);

	//Body
	text = AddText("Variables: ", 10, y);
	listVars = AddListPop(text->Right() + 2, text->Top(), 300); listVars->SetToolTip(TIP_VARIABLEEDITOR_VARIABLES);
	button = AddButton("Add", listVars->Left(), listVars->Down() + 2, 0, 0, BT_ADD); button->SetToolTip(TIP_VARIABLEEDITOR_ADD);
	button = AddButton("Edit", button->Right(), button->Top(), 0, 0, BT_EDIT); button->SetToolTip(TIP_VARIABLEEDITOR_EDIT);
	button = AddButton("Remove", button->Right(), button->Top(), 0, 0, BT_REMOVE); button->SetToolTip(TIP_VARIABLEEDITOR_REMOVE);
	
	//Close
	y = DrawHLine(button->Down() + 4);
	button = AddButton("Close", (WIDTH - 60)/2, y, 0, 0, BT_CLOSE);

	UpdateVars();
}
Example #2
0
TutorialReminder::TutorialReminder()
	: Panel("TutorialReminder", (GameControl::Get()->Width() - (WIDTH_REMINDER - 85))/2, 
				          (GameControl::Get()->Height() - HEIGHT_REMINDER)/2,
						  WIDTH_REMINDER, HEIGHT_REMINDER)
{
	SetModal();

	bAlreadyShow = true;
	chdir((GameControl::getEditorPath() + DIR_SEP + "Tutorials" + DIR_SEP + "Getting Started").c_str());


	Text *text;
	Button *button;
	
	int y;

	//Title
	text = AddText("Welcome", CENTER_TEXT, 5);
	y = DrawHLine(text->Down() + 2);
	
	//Body
	text = AddText("Thank you for choosing Game Editor\nFor a quick start, select a option below:", 30, y);


	//Create a new game
	y = DrawHLine(text->Down() + 10);

	text = AddText("Create a new game:", 30, y);
	button = AddButton("Create now", 58, text->Down() + 10, 0, 0, BT_NEWGAME);


	//Demos
	y = DrawHLine(button->Down() + 5);

	text = AddText("Get game demos:", 30, y);
	button = AddButton("Go to demo page", 58, text->Down() + 10, 0, 0, BT_DEMOS);

	//Tutorials
	y = DrawHLine(button->Down() + 5);

	text = AddText("See the tutorials:", 30, y);

	listTutorialDir = AddListDirectory(10, text->Down() + 10, 0, 0, LS_TUTORIAL, " Click here for the tutorials ");
	listTutorialDir->setCanUseSystemFileDialog(false);

#if defined(WIN32) && !defined(GAME_EDITOR_HOME_EDITION)
	button = AddButton("Get the newest tutorials", 58, listTutorialDir->Down() + 5, 0, 0, BT_UPDATE);
	text = AddText("For more tutorials, select from Help Menu above", text->Left(), button->Down() + 5);
#else
	text = AddText("For more tutorials, select from Help Menu above", text->Left(), listTutorialDir->Down() + 25);
#endif

	listTutorialDir->SetPos((WIDTH_REMINDER - listTutorialDir->Width())/2, listTutorialDir->getImage()->Y());
	listTutorialDir->AddFilter("gedt");
	listTutorialDir->setShowDir(false);
	listTutorialDir->setShowExtension(false);


	


	//Help
	y = DrawHLine(text->Down() + 5);

	text = AddText("Get help:", 30, y);
	button = AddButton("Read the documentation", 58, text->Down() + 10, 0, 0, BT_DOCS);
	button = AddButton("Go to Game Editor's forum", 58, button->Down() + 5, 0, 0, BT_FORUM);
	
	
		
	//Close
	y = DrawHLine(button->Down() + 5);

	button = AddButton("Close", (WIDTH_REMINDER-135)/2 - 30, y, 0, 0, BT_CLOSE);
	button = AddButton(" Don't show again ", button->Right() + 10, y, 0, 0, BT_DONTSHOW);

	//Logo
	{
		EditorDirectory dir;

		logo = new Actor("ged_TutorialReminder_logo", this);
		logo->AddAnimation("logo", "logo.png", 1, 1, 0, 0);
		logo->SetPos(-logo->Width(), 0);
	}
}
Example #3
0
DlgEventKeyDown::DlgEventKeyDown(Actor *actor, bool bUp)
	: Panel("EventKeyDown", (GameControl::Get()->Width() - ((bUp || !Tutorial::IsCompatible(VERSION_GET_ANIMINDEX))?WIDTH:WIDTH_KEY_DOWN))/2, 
				          (GameControl::Get()->Height() - ((bUp || !Tutorial::IsCompatible(VERSION_GET_ANIMINDEX))?HEIGHT:HEIGHT_KEY_DOWN))/2,
						  ((bUp || !Tutorial::IsCompatible(VERSION_GET_ANIMINDEX))?WIDTH:WIDTH_KEY_DOWN), 
						  ((bUp || !Tutorial::IsCompatible(VERSION_GET_ANIMINDEX))?HEIGHT:HEIGHT_KEY_DOWN))
{
	SetModal();
	eventActor = actor;
	this->bUp = bUp;
	mode = SDLK_UNKNOWN;

	Text *text;
	Button *button;	
	Actor *add;
	int y;
	listMode = listRepeat = NULL;
	textPanel = NULL;

	//Title
	text = AddText(bUp?"Key Up Event":"Key Down Event", CENTER_TEXT, 5);
	y = DrawHLine(text->Down() + 2);
	

	if(bUp || !Tutorial::IsCompatible(VERSION_GET_ANIMINDEX))
	{
		//Body
		text = AddText("Press event key or\nright click for 'any' key: ", 10, y);	
		textKey = AddText("              ", 170, text->Down() - 13);
		
		y = textKey->Down() + 5;
		if(!bUp)
		{
			SetToolTip(TIP_DLG_KEYDOWN);
			
			text = AddText("Repeat: ", 10, y+2);
			listRepeat = AddListPop(text->Right(), text->Top(), 128); listRepeat->SetToolTip(TIP_DLG_KEYDOWN_REPEAT);			
			y = listRepeat->Down();
		}
		else
		{
			SetToolTip(TIP_DLG_KEYUP);
			y += 20;
		}
	}
	else
	{
		//New Key Down intreface
		SetToolTip(TIP_DLG_KEYDOWN);

		text =    AddText("Press the key or key sequence (right click for 'any' key)", 10, y);	
		text =    AddText("Keys: ", 10, text->Down() + 4);	

		textKey = AddText("                                                          \n                                                          "
			, text->Right(), text->Top() + 2);

		textPanel = new Panel("textKeyPanel", textKey->Left() - 5, textKey->Top() - 2, textKey->Width() + 5, textKey->Height() + 4,
				  this, true, false, true, false);

		//Transparent background
		KrRGBA *pixels = textPanel->getCanvasResource()->Pixels();	
		if(pixels)
		{
			KrRGBA colorBack;
			colorBack.c.alpha = 0;
			
			for(int i = 2; i < textKey->Width() + 3; i++)
			{
				for(int j = 2; j < textKey->Height() + 2; j++)
				{
					pixels[ j*textPanel->Width() + i ] = colorBack;
				}
			}
		}

		GetFocus(this);

		textKey->getImage()->SetZDepth(textPanel->getImage()->ZDepth() + 1000);

		button = AddButton("Clear", textPanel->Right() - 45, textPanel->Down() + 3, 45, 0, BT_CLEAR); button->SetToolTip(TIP_DLG_KEYDOWN_CLEAR);			

		y = DrawHLine(button->Down() + 3);		
		
		text = AddText("Execute when: ", 10, y+2);
		listMode = AddListPop(text->Right(), text->Top(), 230); listMode->SetToolTip(TIP_DLG_KEYDOWN_MODE);			

		text = AddText("      Repeat: ", 10, listMode->Down() + 2);
		listRepeat = AddListPop(text->Right(), text->Top(), 128); listRepeat->SetToolTip(TIP_DLG_KEYDOWN_REPEAT);

		listMode->AddText("At least one key is pressed");
		listMode->AddText("All keys are pressed");
		listMode->AddText("Keys are pressed in order");
		listMode->SetItem("At least one key is pressed");
		
		y = listRepeat->Down();
	}
	
	//Close
	y = DrawHLine(y + 5);
	if(Action::inNewActivationEvent())
	{
		add = AddButton("Choose Actor", (((bUp || !Tutorial::IsCompatible(VERSION_GET_ANIMINDEX))?WIDTH:WIDTH_KEY_DOWN)-135)/2 - 15, y, 0, 0, LS_ACTION); ((Button *)add)->SetToolTip(TIP_ACTIVATIONEVENT_CHOOSE);	
	}
	else if(Action::getEditAction())
	{
		add = AddButton("Edit Action", (((bUp || !Tutorial::IsCompatible(VERSION_GET_ANIMINDEX))?WIDTH:WIDTH_KEY_DOWN)-135)/2 - 12, y, 0, 0, LS_ACTION); ((Button *)add)->SetToolTip(TIP_ACTION_EDIT);
	}
	else
	{
		add = AddListPop((((bUp || !Tutorial::IsCompatible(VERSION_GET_ANIMINDEX))?WIDTH:WIDTH_KEY_DOWN)-135)/2 - 10, y, 85, 0, LS_ACTION, "Add Action"); ((ListPop *)add)->SetToolTip(TIP_ADDACTION);	
		Action::Populate((ListPop *)add);
	}

	
	if(Action::getEditAction())
	{
		button = AddButton("Cancel", add->Right() + 10, y, 0, 0, BT_CANCEL); if(!Action::inNewActivationEvent()) button->SetToolTip(TIP_ACTION_CANCEL);	
	}
	else
	{
		button = AddButton("Close", add->Right() + 10, y, 0, 0, BT_CANCEL); if(!Action::inNewActivationEvent()) button->SetToolTip(TIP_ACTION_CLOSE);	
	}

	if(listRepeat)
	{
		listRepeat->AddText("Enable");
		listRepeat->AddText("Disable");
		listRepeat->SetItem("Enable");
	}

	Clear();

	UpdateEdition();
}