예제 #1
0
int SelTaskNum2(void)
{
	unsigned char editbox_rtn[6];	
	DisplayNormal("请输入任务号:",15,2*16-MENU_LINE_POS,0);
	DisplayNormal("       (1-16)",13,5*16-MENU_LINE_POS,0);
	AddEditBox(4, 9, 2, (char *)&typ_charlist_a3[0], 0, &editbox_rtn[0], CHAR_FLAG);	
	AddEditBox(4, 10, 10, (char *)&typ_charlist_a4[0], 1, &editbox_rtn[1], CHAR_FLAG);
	AddButton(7, 5, "确定", DefOkClick);
	AddButton(7, 11, "取消", DefEscClick);
	///只有按下确定或取消才能退出
	if(CONTROL_OK_EXIT == ShowControlPage())   //调用菜单编辑函数,在里面等待按键的输入
	{	
		task_num = editbox_rtn[0]*10+editbox_rtn[1];
		return 0; 
	}
		return 1;
}
예제 #2
0
/**
* @brief       密码输入显示及处理 
* @return      0输入成功,1输入失败
*/
int ScrPwdConfirm(void)
{
    ///char editbox_rtn[6];
	unsigned char editbox_rtn[6];
	UCHAR pwd[3];
	int i;	
	DisplayNormal("请输入密码:",11,2*16-MENU_LINE_POS,0);
	AddEditBox(4, 7, 10, (char *)&typ_charlist_a[0], 9, &editbox_rtn[0], CHAR_FLAG);
	AddEditBox(4, 8, 10, (char *)&typ_charlist_a[0], 9, &editbox_rtn[1], CHAR_FLAG);	
	AddEditBox(4, 9, 10, (char *)&typ_charlist_a[0], 9, &editbox_rtn[2], CHAR_FLAG);
	AddEditBox(4, 10, 10, (char *)&typ_charlist_a[0], 9, &editbox_rtn[3], CHAR_FLAG);
	AddEditBox(4, 11, 10, (char *)&typ_charlist_a[0], 9, &editbox_rtn[4], CHAR_FLAG);
	AddEditBox(4, 12, 10, (char *)&typ_charlist_a[0], 9, &editbox_rtn[5], CHAR_FLAG);
	AddButton(6, 5, "确定", DefOkClick);
	AddButton(6, 11, "取消", DefEscClick);
	if(CONTROL_OK_EXIT == ShowControlPage())   //调用菜单编辑函数,在里面等待按键的输入
	{	
		for(i=0; i<6; i++)   ///设置的密码存放在editbox_rtn[]中,typ_charlist_a[0]的值为0
		editbox_rtn[i] += typ_charlist_a[0];
		CharToBcd(pwd, 3, editbox_rtn);   ///将字符型转化为BCD码
		///if(pwd[0]!=para_term.com_pwd[0])return 1;
		///if(pwd[1]!=para_term.com_pwd[1])return 1;
		///if(pwd[2]!=para_term.com_pwd[2])return 1;

		return 0;  ///返回值为0输入的密码才正确
	}
		return 1;
}
예제 #3
0
ColorSample::ColorSample(Actor *parent, int x, int y, int w, int h, bool _bEditControls)
: Actor(getRandomName(), parent, CANVAS, w, _bEditControls?56:h)
{
	rEdit = gEdit = bEdit = NULL;
	setColor(255, 255, 255);

	SetPos(x, y);

	

	if(_bEditControls)
	{
		Text *text;
		text = AddText("  Red: ", Width() + 5, 0);
		rEdit = AddEditBox(text->Right(), text->Top(), 48); rEdit->SetNumeric(0, 255, 1);
		
		text = AddText("Green: ", text->Left(), rEdit->Down() + 2);
		gEdit = AddEditBox(text->Right(), text->Top(), 48); gEdit->SetNumeric(0, 255, 1);
		
		text = AddText(" Blue: ", text->Left(), gEdit->Down() + 2);
		bEdit = AddEditBox(text->Right(), text->Top(), 48); bEdit->SetNumeric(0, 255, 1);
	}
}
예제 #4
0
void LoadSave::Init(int command, gedString title, gedString confirmButtonText)
{
	SetModal();
	this->command = command;

	Text *text;
	Button *button;		
	int y;	

	text = AddText(title, CENTER_TEXT, 5);
	y = DrawHLine(text->Down() + 2);

	if(command == SAVE_DIALOG)
	{
		SetToolTip(TIP_SAVE);

		text = AddText("File: ", 10, y);
		name = AddEditBox(text->Right(), text->Top(), 200);
		dir = AddListDirectory(name->Right() + 2, y, 80, 0, 0, "select");  dir->SetToolTip(TIP_SAVE_FILE);
		dir->SetSave();
		y = name->Down();
	}
	else if(command == LOAD_DIALOG)
	{
		SetToolTip(TIP_LOAD);

		text = AddText("File: ", 40, y);
		dir = AddListDirectory(text->Right(), y, 200, 0, 0); dir->SetToolTip(TIP_LOAD_FILE);
		y = dir->Down();
	}	
	else if(command == MERGE_DIALOG)
	{
		SetToolTip(TIP_MERGE);

		text = AddText("File: ", 40, y);
		dir = AddListDirectory(text->Right(), y, 200, 0, 0); dir->SetToolTip(TIP_MERGE_FILE);
		y = dir->Down();

		command = LOAD_DIALOG;
	}

	
	//Close
	y = DrawHLine(Height() - 40);

	button = AddButton(confirmButtonText, (WIDTH-135)/2, y, 0, 0, LOADSAVE_OK); SetConfirmButton(button);
	button = AddButton("Cancel", button->Right()+8, y, 0, 0, LOADSAVE_CLOSE); SetCancelButton(button);

	chdir(GameControl::Get()->getGamePath().c_str());
}
예제 #5
0
int input_date(void)
{
	unsigned char editbox_rtn[8];

	//DisplayNormal("请输入载波表序号:",17,2*16-MENU_LINE_POS,0);
	CleanPartOfScreen(2*16-MENU_LINE_POS,7);
	DisplayNormal("请输入查询日期:",15,2*16-MENU_LINE_POS,0);
	AddEditBox(4, 5, 3, (char *)&typ_charlist_a[0], 2, &editbox_rtn[0], CHAR_FLAG);
	AddEditBox(4, 6, 10, (char *)&typ_charlist_a[0], 0, &editbox_rtn[1], CHAR_FLAG);	
	AddEditBox(4, 7, 10, (char *)&typ_charlist_a[0], 1, &editbox_rtn[2], CHAR_FLAG);
	AddEditBox(4, 8, 10, (char *)&typ_charlist_a[0], 1, &editbox_rtn[3], CHAR_FLAG);
	//DisplayNormal(".",1,4*16-MENU_LINE_POS,80+24);
	DisplayNormal("-",1,4*16-MENU_LINE_POS,8 * 8 + 8);
	AddEditBox(4, 10, 10, (char *)&typ_charlist_a[0], 0, &editbox_rtn[4], CHAR_FLAG);
	AddEditBox(4, 11, 10, (char *)&typ_charlist_a[0], 1, &editbox_rtn[5], CHAR_FLAG);
	DisplayNormal("-",1,4*16-MENU_LINE_POS,11 * 8 + 8);
	AddEditBox(4, 13, 10, (char *)&typ_charlist_a[0], 0, &editbox_rtn[6], CHAR_FLAG);
	AddEditBox(4, 14, 10, (char *)&typ_charlist_a[0], 1, &editbox_rtn[7], CHAR_FLAG);
	

	AddButton(7, 5, "确定", DefOkClick);
	AddButton(7, 11, "取消", DefEscClick);

	if(CONTROL_OK_EXIT == ShowControlPage())   //调用菜单编辑函数,在里面等待按键的输入
	{	
		qur_day[0] = 10*editbox_rtn[2]+editbox_rtn[3];
		qur_day[1] = 10*editbox_rtn[4]+editbox_rtn[5];
		qur_day[2] = 10*editbox_rtn[6]+editbox_rtn[7];
		//sn_num = 1000*editbox_rtn[0]+100*editbox_rtn[1]+10*editbox_rtn[2]+editbox_rtn[3];
		PrintLog(0, "sn_num= %d.\r\n", sn_num);
		if(qur_day[1]<1 || qur_day[1]>12 || qur_day[2]<1 || qur_day[2] >31)
		{
			//ClearLcdScreen();
			//scrpbuf_main.line = 1;
			//strcpy(scrpbuf_main.buf[0], " 输入测量点号错误!");
			//strcpy(scrpbuf_main.buf[1], " 系统5秒后复位...");
			//DisplayNormal((unsigned char*)&scrpbuf_main.buf[0],strlen(&scrpbuf_main.buf[0]),16 * 3,0);
			//DisplayNormal((unsigned char*)&scrpbuf_main.buf[1],strlen(&scrpbuf_main.buf[1]),16 * 4,0);
			//DisplayLcdBuffer();
			return 1;
		}
		else
			return 0; 
	}
	return 1;
}
예제 #6
0
/**
* @brief       输入选择测量点号
* @return      0输入成功,1输入失败
*/
int SelTemSn(void)
{
	unsigned char editbox_rtn[6];

	//DisplayNormal("请输入载波表序号:",17,2*16-MENU_LINE_POS,0);
	CleanPartOfScreen(2*16-MENU_LINE_POS,7);
	DisplayNormal("请输入电表序号:",17,2*16-MENU_LINE_POS,0);
	AddEditBox(4, 8, 3, (char *)&typ_charlist_a5[0], 0, &editbox_rtn[0], CHAR_FLAG);
	AddEditBox(4, 9, 10, (char *)&typ_charlist_a[0], 0, &editbox_rtn[1], CHAR_FLAG);	
	AddEditBox(4, 10, 10, (char *)&typ_charlist_a[0], 0, &editbox_rtn[2], CHAR_FLAG);
	AddEditBox(4, 11, 10, (char *)&typ_charlist_a[0], 0, &editbox_rtn[3], CHAR_FLAG);
	DisplayNormal("      (3-2040)",15,5*16-MENU_LINE_POS,0);

	AddButton(7, 5, "确定", DefOkClick);
	AddButton(7, 11, "取消", DefEscClick);

	if(CONTROL_OK_EXIT == ShowControlPage())   //调用菜单编辑函数,在里面等待按键的输入
	{	
		sn_num = 1000*editbox_rtn[0]+100*editbox_rtn[1]+10*editbox_rtn[2]+editbox_rtn[3];
		PrintLog(0, "sn_num= %d.\r\n", sn_num);
		if(sn_num<=2 || sn_num>2039)
		{
			//ClearLcdScreen();
			//scrpbuf_main.line = 1;
			//strcpy(scrpbuf_main.buf[0], " 输入测量点号错误!");
			//strcpy(scrpbuf_main.buf[1], " 系统5秒后复位...");
			//DisplayNormal((unsigned char*)&scrpbuf_main.buf[0],strlen(&scrpbuf_main.buf[0]),16 * 3,0);
			//DisplayNormal((unsigned char*)&scrpbuf_main.buf[1],strlen(&scrpbuf_main.buf[1]),16 * 4,0);
			//DisplayLcdBuffer();
			return 1;
		}
		else
			return 0; 
	}
	return 1;
}
예제 #7
0
int SelMajorNum(void)
{
	unsigned char editbox_rtn[6];
	///unsigned char rtn[3];
	DisplayNormal("请输入总表号:",13,2*16-MENU_LINE_POS,0);
	DisplayNormal("        (1-8)",13,5*16-MENU_LINE_POS,0);	
	AddEditBox(4, 10, 8, (char *)&typ_charlist_a2[0], 0, &editbox_rtn[0], CHAR_FLAG);
	AddButton(6, 5, "确定", DefOkClick);
	AddButton(6, 11, "取消", DefEscClick);
	if(CONTROL_OK_EXIT == ShowControlPage())   //调用菜单编辑函数,在里面等待按键的输入
	{	
		major_met_num = editbox_rtn[0] + 1;
		return 0; 
	}
	return 1;
}
예제 #8
0
int SelPortNum(void)
{
	unsigned char editbox_rtn[6];

	DisplayNormal("请输入端口号:",13,2*16-MENU_LINE_POS,0);	
	AddEditBox(4, 10, 4, (char *)&typ_charlist_a1[0], 0, &editbox_rtn[0], CHAR_FLAG);
    DisplayNormal("        (1-4)",13,5*16-MENU_LINE_POS,0);
	AddButton(7, 5, "确定", DefOkClick);
	AddButton(7, 11, "取消", DefEscClick);
	///只有按下确定或取消才能退出
	if(CONTROL_OK_EXIT == ShowControlPage())   //调用菜单编辑函数,在里面等待按键的输入
	{	
		input_port_num = editbox_rtn[0];
		return 0; 
	}
	return 1;
}
예제 #9
0
ColorPicker::ColorPicker(int _r, int _g, int _b)
	: Panel("DlgColorPicker", (GameControl::Get()->Width() - WIDTH)/2, 
				          (GameControl::Get()->Height() - HEIGHT)/2,
						  WIDTH, HEIGHT)
{
	SetModal();

	Text *text;
	Button *button;

	//Title
	text = AddText("Color Picker", CENTER_TEXT, 5);
	int y = DrawHLine(text->Down() + 2);

	//Body
	canvas = new ColorCanvas(this);
	oldColor = new ColorSampleOfPicker(this);
	newColor = new ColorSampleOfPicker(this);

	canvas->SetPos(10, y + 2);	
	
	

	colorSlide = AddSlide(canvas->Right() + 5, canvas->Top(), 20, 256, SL_COLOR);
	colorSlide->SetPos(1.0);


	newColor->SetPos(colorSlide->Right() + 5, colorSlide->Top());
	oldColor->SetPos(newColor->Left(), newColor->Down());

	text = AddText("       Red: ", oldColor->Left(), oldColor->Down() + 16);
	rEdit = AddEditBox(text->Right(), text->Top(), 32); rEdit->SetNumeric(0, 255, 1);

	text = AddText("     Green: ", text->Left(), rEdit->Down() + 2);
	gEdit = AddEditBox(text->Right(), text->Top(), 32); gEdit->SetNumeric(0, 255, 1);

	text = AddText("      Blue: ", text->Left(), gEdit->Down() + 2);
	bEdit = AddEditBox(text->Right(), text->Top(), 32); bEdit->SetNumeric(0, 255, 1);


	text = AddText("       Hue: ", text->Left(), bEdit->Down() + 16);
	hEdit = AddEditBox(text->Right(), text->Top(), 32); hEdit->SetNumeric(0, 359, 1);

	text = AddText("Saturation: ", text->Left(), hEdit->Down() + 2);
	sEdit = AddEditBox(text->Right(), text->Top(), 32); sEdit->SetNumeric(0, 100, 1);

	text = AddText("Brightness: ", text->Left(), sEdit->Down() + 2);
	vEdit = AddEditBox(text->Right(), text->Top(), 32); vEdit->SetNumeric(0, 100, 1);

	listFix = AddListPop(oldColor->Left(), vEdit->Down() + 16, 104, 0, LS_FIX_COLOR);

	//Close
	y = DrawHLine(canvas->Down() + 2);

	button = AddButton("Ok", (WIDTH-135)/2, y, 0, 0, OK_BUTTON); SetConfirmButton(button);
	button = AddButton("Cancel", button->Right()+8, y, 0, 0, CANCEL_BUTTON); SetCancelButton(button);

	

	listFix->AddText("Red");
	listFix->AddText("Green");
	listFix->AddText("Blue");

	listFix->AddText("Hue");
	listFix->AddText("Saturation");
	listFix->AddText("Brightness");

	listFix->SetText("Red");	
	fixedColor = FIX_RED;
	r = _r;
	g = _g;
	b = _b;
	
	oldColor->SetColor(r, g, b);
	

	colorSlide->SetPos(r / 255.0);

	UpdateSample(r, g, b);	
	UpdateCanvas(r, fixedColor);
	UpdateSlideColor(r, g, b, fixedColor);
}
예제 #10
0
ExpressionEditor::ExpressionEditor(Actor *actor, bool bOnCollision)
	: BaseAction("Expression Editor", (GameControl::Get()->Width() - WIDTH)/2, 
				          (GameControl::Get()->Height() - HEIGHT)/2,
						  WIDTH, HEIGHT)
{
	expressionEditor = this;
	SetModal();
	SetToolTip(TIP_SCRIPTEDITOR);

	eventActor = actionActor = actor;
	this->bOnCollision = bOnCollision;

	Text *text;
	Button *button;	
	int y;

	//Title: Script Editor: oi -> Key Down (left)
	gedString title(EXPRESSION_EDITOR), actionDesc;
	title += ": ";
	actionDesc = actor->getActorName();
	actionDesc += " -> ";

	editAction = Action::getEditAction();
	if(editAction)
	{		
		actionDesc += Action::GetDescription(editAction, false);

		MainPanel::AddLastScript(actionDesc);
	}
	else
	{
		stAction tmp;
		tmp.eventData = Action::getActualEvent();

		actionDesc += Action::GetDescription(&tmp, false);
	}

	title += actionDesc;

	text = AddText(title, CENTER_TEXT, 5);
	textLine = AddText("Ln 1    ", WIDTH-45, 5, ALIGN_LEFT);
	y = DrawHLine(text->Down() + 2);

	//Body
	editExp = AddEditBox(10, y, WIDTH-34, HEIGHT-85, true);
	listActor = AddListPop(10, editExp->Down()+4, 120, 0, LS_ACTOR, "actors"); listActor->SetToolTip(TIP_SCRIPTEDITOR_ACTORS);
	listAutoComplete = AddListPop(listActor->Right(), listActor->Top(), 215, 0, LS_COMPLETE, "variables/functions"); listAutoComplete->SetToolTip(TIP_SCRIPTEDITOR_VARIABLES_FUNCTIONS);
	button = AddButton("Variables", listAutoComplete->Right(), listAutoComplete->Top(), 0, 0, BT_CREATEVAR); button->SetToolTip(TIP_SCRIPTEDITOR_VARIABLES);
	button = AddButton("Global code", button->Right(), button->Top(), 0, 0, BT_GLOBALS); button->SetToolTip(TIP_SCRIPTEDITOR_GLOBALCODE);
	listFile = AddListPop(button->Right() + 2, button->Top(), 64, 0, LS_FILE, "File"); listFile->SetToolTip(TIP_SCRIPTEDITOR_FILE);

	//button = AddButton("Web", listFile->Right() + 2, listFile->Top(), 35, 0, BT_WEB); button->SetToolTip(TIP_SCRIPTEDITOR_WEB);

	
	
	//Close
	y = DrawHLine(listAutoComplete->Down() + 2);
	button = AddButton(Action::getEditAction()?"Ok":"Add", WIDTH/2 - 65, y, 0, 0, BT_ADD); button->SetToolTip(TIP_ACTION_ADD);
	button = AddButton("Cancel", button->Right()+8, y, 0, 0, BT_CLOSE); button->SetToolTip(TIP_ACTION_CANCEL); //Don't exit on ESC (crash the editor)


	//Populate actors
	GameControl::Get()->PopulateActors(listActor);
	if(bOnCollision) listActor->AddText("collide");

	UpdateVars();

	listFile->AddText("Save");
	listFile->AddText("Load");

	bDelimit = false;

	editExp->SetSyntaxColorize(true);
	editExp->ShowScrollBar();

	pScript = NULL;
	UpdateEdition();
	if(!pScript) pScript = new Script();
}
예제 #11
0
GameSettings::GameSettings()
	: Panel("GameSettings", (GameControl::Get()->Width() - WIDTH)/2, 
	(GameControl::Get()->Height() - getHeight())/2,
						  WIDTH, getHeight())
{
	SetModal();
	SetToolTip(TIP_GAMESETTINGS);

	gameSettings = this;
	listSuspend = listESC = listMotion = NULL;
	editViewSafeMargin = NULL;
	gamePort = gameID = NULL;
	listAutoStartNetwork = listGameServer = NULL;

	Text *text;
	Button *button;	
	int y, editSize = 40, editStart = 22;

	if(!Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION))
	{
		editSize = 45;
		editStart = 8;
	}

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

	//Body
	text = AddText("Game resolution: ", 10, y);
	listRes = AddListPop(text->Right(), text->Top(), 128, 0, LS_RES); listRes->SetToolTip(TIP_GAMESETTINGS_RESOLUTION);

	editX = AddEditBox(listRes->Right() + editStart, listRes->Top(), editSize); editX->SetNumeric(2, 2000, 1);
	text = AddText("x", editX->Right()+1, editX->Top());
	editY = AddEditBox(text->Right() + 4, text->Top(), editSize); editY->SetNumeric(2, 2000, 1);

	text = AddText("Mode:            ", 10, editY->Down() + 4);
	listFull = AddListPop(text->Right(), text->Top(), 128, 0, LS_FULL); listFull->SetToolTip(TIP_GAMESETTINGS_MODE);

	if(Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION))
	{
		text = AddText(" Safe margin: ", listFull->Right(), listFull->Top());
		editViewSafeMargin = AddEditBox(editY->Left(), text->Top(), editSize); editViewSafeMargin->SetNumeric(0, 2000, 1);
	}

	text = AddText("Frame rate:      ", 10, listFull->Down() + 4);
	editFps = AddEditBox(text->Right(), text->Top(), 50); editFps->SetNumeric(1, 512, 1);
	text = AddText("fps", editFps->Right() + 2, editFps->Top());

	listMouse = AddListPop(text->Right() + 32, text->Top(), 128, 0, LS_MOUSE); listMouse->SetToolTip(TIP_GAMESETTINGS_MOUSE);

	if(Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION))
	{
		text = AddText("Suspend game if lost focus: ", 10, editFps->Down() + 6);
		listSuspend = AddListPop(text->Right() + 48, text->Top(), 32, 0, LS_SUSPEND); listSuspend->SetToolTip(TIP_GAMESETTINGS_SUSPEND);

		if(Tutorial::IsCompatible(VERSION_ESC_TO_EXIT))
		{
			text = AddText("  Use ESC key to exit game: ", 10, listSuspend->Down() + 6);
			listESC = AddListPop(text->Right() + 48, text->Top(), 32, 0, LS_ESC); listESC->SetToolTip(TIP_GAMESETTINGS_ESC);

			text = AddText("       Motion Compensation: ", 10, listESC->Down() + 6);
			listMotion = AddListPop(text->Right() + 48, text->Top(), 32, 0, LS_MOTION); listMotion->SetToolTip(TIP_GAMESETTINGS_MOTION_COMPENSATION);
		}
		
		
		y = DrawHLine(text->Down() + 8);
	}
	else
	{
		y = DrawHLine(editFps->Down() + 4);
	}
	
	text = AddText("Audio format: ", 10, y);
	listHz = AddListPop(text->Right(), text->Top(), 128, 0, LS_HZ); listHz->SetToolTip(TIP_GAMESETTINGS_AUDIO_HZ);
	listStereo = AddListPop(listHz->Right() + 4, listHz->Top(), 128, 0, LS_STEREO); listStereo->SetToolTip(TIP_GAMESETTINGS_AUDIO_STEREO);
	text = AddText("Maximum number of simultaneous sounds: ", 10, listStereo->Down()+4);
	editMaxSounds = AddEditBox(text->Right(), text->Top(), 50); editMaxSounds->SetNumeric(1, 512, 1);
	
	y = DrawHLine(editMaxSounds->Down() + 2);

	text = AddText("            Icon file:  ", 10, y + 2);
	iconPath = AddListDirectory(text->Right(), text->Top()); iconPath->SetToolTip(TIP_GAMESETTINGS_ICON);

	text = AddText("           Game title: ", 10, iconPath->Down() + 4);
	gameTitle = AddEditBox(text->Right(), text->Top(), 150);

	text = AddText("Game background color: ", 10, gameTitle->Down() + 4);
	backgroundColor = new ColorSample(this, text->Right(), text->Top(), 32); backgroundColor->SetToolTip(TIP_GAMESETTINGS_BACKGROUNDCOLOR);

	//Network
	if(Tutorial::IsCompatible(VERSION_NETWORK) && GAME_EDITOR_VERSION >= VERSION_NETWORK)
	{
		y = DrawHLine(backgroundColor->Down() + 2);

		text = AddText("     Game ID: ", 10, y);		
		gameID = AddEditBox(text->Right(), text->Top(), 256);

		text = AddText("Network Port: ", 10, gameID->Down() + 4);		
		gamePort = AddEditBox(text->Right(), text->Top(), 64);

		text = AddText("Use Game Editor Server: ", 10, gamePort->Down() + 4);
		listGameServer = AddListPop(text->Right() + 2, text->Top(), 32, 0, LS_GAMESERVER); listGameServer->SetToolTip(TIP_GAMESETTINGS_GAME_SERVER);

		text = AddText("    Auto Start Network: ", 10, listGameServer->Down() + 4);
		listAutoStartNetwork = AddListPop(text->Right() + 2, text->Top(), 32, 0, LS_AUTOSTART_NETWORK); listAutoStartNetwork->SetToolTip(TIP_GAMESETTINGS_AUTO_START_NETWORK);

		y = listAutoStartNetwork->Down() + 2;
	}
	else
	{
		y = backgroundColor->Down() + 2;
	}

	//PocketPC
	y = DrawHLine(y);
	listPocketKeys = AddListPop(10, y, 256, 0, LS_POCKET_KEYS, "Pocket PC and GP2X Keys"); listPocketKeys->SetToolTip(TIP_GAMESETTINGS_POCKET_KEYS);
	
	//Close
	y = DrawHLine(listPocketKeys->Down() + 2);
	button = AddButton("Ok", Width()/2 - 70, y, 0, 0, BT_ADD); SetConfirmButton(button);
	button = AddButton("Cancel", button->Right()+8, y, 0, 0, BT_CLOSE); SetCancelButton(button);


	//Populate resolutions
	char buf[64];
	if(Tutorial::IsOff())
	{
		SDL_Rect **modes;
		const SDL_VideoInfo *vinfo = SDL_GetVideoInfo();
		
		/* Get available fullscreen/hardware modes */
		modes=SDL_ListModes(vinfo->vfmt, VIDEO_FLAGS | SDL_FULLSCREEN);
		
		if(modes != (SDL_Rect **)0 && modes != (SDL_Rect **)-1)
		{		
			for(int i=0;modes[i];++i)
			{
				sprintf(buf, "%d x %d", modes[i]->w, modes[i]->h);
				listRes->AddText(buf);
			}
		}
	}
	else
	{
		//Don't change in different machines
		listRes->AddText("1280 x 1024");
		listRes->AddText("1280 x 960");
		listRes->AddText("1280 x 768");
		listRes->AddText("1280 x 720");
		listRes->AddText("1152 x 864");
		listRes->AddText("1024 x 768");
		listRes->AddText("848 x 480");
		listRes->AddText("800 x 600");
		listRes->AddText("720 x 576");
		listRes->AddText("720 x 480");
		listRes->AddText("640 x 480");
		listRes->AddText("640 x 400");
		listRes->AddText("512 x 384");
		listRes->AddText("480 x 360");
		listRes->AddText("400 x 300");
		listRes->AddText("320 x 240");
		listRes->AddText("320 x 200");		
	}

	if(Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION))
	{
		listRes->AddText("240 x 320");
		listRes->AddText("240 x 320 Pocket PC");
		listRes->AddText("240 x 320 Pocket PC Upside down");
		listRes->AddText("320 x 240 Pocket PC Rotate left");
		listRes->AddText("320 x 240 Pocket PC Rotate right");

		listRes->AddText("480 x 640 Pocket PC");
		listRes->AddText("480 x 640 Pocket PC Upside down");
		listRes->AddText("640 x 480 Pocket PC Rotate left");
		listRes->AddText("640 x 480 Pocket PC Rotate right");
		listRes->AddText("800 x 480 Pocket PC Rotate left");
		listRes->AddText("800 x 480 Pocket PC Rotate right");

		//No changes in screen orientation now (don't have the w > h information)
		listRes->AddText("240 x 240 Pocket PC");
		listRes->AddText("480 x 480 Pocket PC");

		//Smartphone
		listRes->AddText("176 x 220 Smartphone");
		listRes->AddText("160 x 240 Smartphone");
		listRes->AddText("208 x 240 Smartphone");
		listRes->AddText("240 x 320 Smartphone");

		//HPC
		listRes->AddText("640 x 240 Handheld PC");
		listRes->AddText("640 x 480 Handheld PC");
		listRes->AddText("800 x 480 Handheld PC");
		listRes->AddText("800 x 600 Handheld PC");

		//GP2X
		listRes->AddText("320 x 240 GP2X");
		listRes->AddText("640 x 480 GP2X");

		// Apple iPhone // AKR
		listRes->AddText("320 x 480 iPhone");
		listRes->AddText("480 x 320 iPhone Rotate left");

		// Apple iPad // AKR
		listRes->AddText("768 x 1024 iPad");
		listRes->AddText("1024 x 768 iPad Rotate left");

	}
	else
	{
		listRes->AddText("240 x 320 Pocket PC");
	}

	listFull->AddText("Full screen");
	listFull->AddText("Window");


	listHz->AddText("44100 Hz");
	listHz->AddText("22050 Hz");
	listHz->AddText("11025 Hz");


	listStereo->AddText("Stereo");
	listStereo->AddText("Mono");

	listMouse->AddText("Show mouse");
	listMouse->AddText("Hide mouse");

	if(listSuspend)
	{
		listSuspend->AddText("Yes");
		listSuspend->AddText("No");
		
		if(GameControl::Get()->getSuspendGameIfLostFocus()) listSuspend->SetItem("Yes");
		else listSuspend->SetItem("No");
	}

	if(listAutoStartNetwork)
	{
		listAutoStartNetwork->AddText("Yes");
		listAutoStartNetwork->AddText("No");
				
		if(GameControl::Get()->getAutoStartNetwork()) listAutoStartNetwork->SetItem("Yes");
		else listAutoStartNetwork->SetItem("No");
	}

	if(listGameServer)
	{
		listGameServer->AddText("Yes");
		listGameServer->AddText("No");
				
		if(GameControl::Get()->getUseGameEditorServer()) listGameServer->SetItem("Yes");
		else listGameServer->SetItem("No");
	}

	if(listESC)
	{
		listESC->AddText("Yes");
		listESC->AddText("No");
		
		if(GameControl::Get()->getUseESCKeyToExit()) listESC->SetItem("Yes");
		else listESC->SetItem("No");
	}

	if(listMotion)
	{
		listMotion->AddText("Yes");
		listMotion->AddText("No");
		
		if(GameControl::Get()->getUseMotionCorrection()) listMotion->SetItem("Yes");
		else listMotion->SetItem("No");
	}

	if(gameID)
	{		
		gameID->SetText(GameControl::Get()->getGameID());
	}

	if(gamePort)
	{		
		gamePort->SetText(GameControl::Get()->getGamePort());
	}


	if(GameControl::Get()->getFullScreen()) listFull->SetItem("Full screen");
	else listFull->SetItem("Window");

	if(GameControl::Get()->getStereo()) listStereo->SetItem("Stereo");
	else listStereo->SetItem("Mono");

	if(GameControl::Get()->getShowMouse()) listMouse->SetItem("Show mouse");
	else listMouse->SetItem("Hide mouse");

	if(editViewSafeMargin)
	{
		editViewSafeMargin->SetText((int)GameControl::Get()->getViewSafeMargin());
	}
	

	sprintf(buf, "%ld Hz", GameControl::Get()->getAudioSamplerRate()); 
	listHz->SetItem(buf);

	sprintf(buf, "%d x %d", GameControl::Get()->getGameWidth(), GameControl::Get()->getGameHeight());
	listRes->SetItem(buf);

	editX->SetText(GameControl::Get()->getGameWidth());
	editY->SetText(GameControl::Get()->getGameHeight());
	editFps->SetText(GameControl::Get()->getFrameRate());
	editMaxSounds->SetText(GameControl::Get()->getMaximumSounds());

	bFlipPocketPCScreen = GameControl::Get()->getFlipPocketPCScreen();

	gedString res(buf);
	if(res == "240 x 320")
	{
		if(bFlipPocketPCScreen)
		{
			listRes->SetText("240 x 320 Up. down");
		}
	}
	else if(res == "320 x 240")
	{
		if(bFlipPocketPCScreen)
		{
			listRes->SetText("320 x 240 Rot.right");
		}
		else
		{
			listRes->SetText("320 x 240 Rot. left");
		}
	}
	else if(res == "480 x 640")
	{
		if(bFlipPocketPCScreen)
		{
			listRes->SetText("480 x 640 Up. down");
		}
		else
		{
			listRes->SetText("480 x 640 Pocket PC");
		}
	}
	else if(res == "640 x 480")
	{
		if(bFlipPocketPCScreen)
		{
			listRes->SetText("640 x 480 Rot.right");
		}
		else
		{
			//listRes->SetText("640 x 480 Rot. left");
			listRes->SetText("640 x 480");
		}
	}
	else if(res == "320 x 480")
	{
			listRes->SetText("320 x 480 iPhone");
	}
	else if(res == "480 x 320")
	{
		listRes->SetText("480 x 320 Rot.left");
	}
	else if(res == "768 x 1024")
	{
			listRes->SetText("768x1024 iPad");
	}
	else if(res == "800 x 480")
	{
		if(bFlipPocketPCScreen)
		{
			listRes->SetText("800 x 480 Rot.right");
		}
		else
		{			
			listRes->SetText("800 x 480");
		}
	}
	else if(res == "240 x 240")
	{
		listRes->SetText("240 x 240 Pocket PC");
	}
	else if(res == "480 x 480")
	{
		listRes->SetText("480 x 480 Pocket PC");
	}
	else if(res == "176 x 220")
	{
		listRes->SetText("176 x 220 Smartphone");
	}
	else if(res == "160 x 240")
	{
		listRes->SetText("160 x 240 Smartphone");
	}
	else if(res == "208 x 240")
	{
		listRes->SetText("208 x 240 Smartphone");
	}



	iconPath->AddFilter("tga");
	iconPath->AddFilter("bmp");
	iconPath->AddFilter("pnm");
	iconPath->AddFilter("xpm");
	iconPath->AddFilter("xcf");
	iconPath->AddFilter("pcx");
	iconPath->AddFilter("gif");
	iconPath->AddFilter("jpg");
	iconPath->AddFilter("jpeg");
	iconPath->AddFilter("jpe");
	iconPath->AddFilter("jfif");
	iconPath->AddFilter("tif");
	iconPath->AddFilter("tiff");
	iconPath->AddFilter("iff");
	iconPath->AddFilter("lbm");
	iconPath->AddFilter("png");
	iconPath->AddFilter("ico");

	//iconPath->SetText(GameControl::Get()->getIconPath());

	if(!GameControl::Get()->getIconPath().empty())
	{
		gedString file, dir;
		SplitPath(GameControl::Get()->getIconPath(), file, dir);
		chdir(dir.c_str());

		iconPath->AddText(file);
		iconPath->SetItem(file);
	}

	gameTitle->SetText(GameControl::Get()->getGameTitle());

	backgroundColor->setColor(GameControl::Get()->getBackGroundColor());

	SetPocketKeys();
}
예제 #12
0
CreateActor::CreateActor(Actor *actor, bool bOnCollision)
	: BaseAction("Create Actor", (GameControl::Get()->Width() - WIDTH)/2, 
				          (GameControl::Get()->Height() - HEIGHT)/2,
						  WIDTH, HEIGHT)
{
	SetModal();
	SetToolTip(TIP_CREATEACTOR);
	this->eventActor = actionActor = actor;

	Text *text;
	Button *button;	
	int y;

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

	//Body
	text = AddText("    Actor: ", 10, y);
	listActor = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_ACTOR); listActor->SetToolTip(TIP_CREATEACTOR_ACTOR);

	text = AddText("Animation: ", 10, listActor->Down());
	listAnimation = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_ANIMATION); listAnimation->SetToolTip(TIP_CREATEACTOR_ANIMATION);

	text = AddText("   Parent: ", 10, listAnimation->Down());
	listParent = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_PARENT); listParent->SetToolTip(TIP_CREATEACTOR_PARENT);

	text = AddText("     Path: ", 10, listParent->Down());
	listPath = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_PATH); listPath->SetToolTip(TIP_CREATEACTOR_PATH);

	text = AddText("Initial position: ", 10, listPath->Down() + 4);
	
	text = AddText("x", 10, text->Down());
	posX = AddEditBox(text->Right() + 2, text->Top(), 50); posX->SetNumeric(-650000, 650000, 1);

	text = AddText("y", posX->Right()+5, posX->Top());
	posY = AddEditBox(text->Right() + 4, text->Top(), 50); posY->SetNumeric(-650000, 650000, 1);

	text = AddText("Relative to creator: ", 10, posY->Down() + 2);
	listRelativePos = AddListPop(text->Right() + 2, text->Top(), 40, 0, LS_RELATIVEPOS); listRelativePos->SetToolTip(TIP_CREATEACTOR_RELATIVE);
	
	
	//Close
	y = DrawHLine(listRelativePos->Down() + 2);
	button = AddButton(Action::getEditAction()?"Ok":"Add", (WIDTH-135)/2, y, 0, 0, BT_ADD); button->SetToolTip(TIP_ACTION_ADD); SetConfirmButton(button);
	button = AddButton("Cancel", button->Right()+8, y, 0, 0, BT_CLOSE); button->SetToolTip(TIP_ACTION_CANCEL); SetCancelButton(button);

	posX->SetText(0);
	posY->SetText(0);

	GameControl::Get()->PopulateActors(listActor, false);
	listActor->RemoveText(VIEW_NAME);
	GameControl::Get()->PopulateAnimations(actionActor, listAnimation);
	GameControl::Get()->PopulateActors(listParent);
	listParent->AddText(NO_PARENT);
	listParent->AddText(S_EVENT_ACTOR);	

	if(Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION))
	{
		listParent->AddText(S_PARENT_ACTOR);
		listParent->AddText(S_CREATOR_ACTOR);
	}

	if(bOnCollision) listParent->AddText(S_COLLIDE_ACTOR);

	GameControl::Get()->PopulatePaths(listPath);

	if(!Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION))
	{
		//Set default only in old tutorials
		listActor->SetItem(actionActor->getActorName());
	}
	else
	{
		//Don't select animations in new version
		listAnimation->RemoveAll();
		listAnimation->SetItem(-1);
	}

	listParent->SetItem(NO_PARENT);
	listPath->SetItem(NO_PATH);

	listRelativePos->AddText("Yes");
	listRelativePos->AddText("No");
	listRelativePos->SetItem("Yes");

	if(!ExpressionEditor::getExpressionEditor()) UpdateEdition();
}