本文整理汇总了C++中Text::Right方法的典型用法代码示例。如果您正苦于以下问题:C++ Text::Right方法的具体用法?C++ Text::Right怎么用?C++ Text::Right使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Text
的用法示例。
在下文中一共展示了Text::Right方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BaseAction
ToMousePosition::ToMousePosition(Actor *actor, bool bOnCollision)
: BaseAction("To Mouse Position", (GameControl::Get()->Width() - WIDTH)/2,
(GameControl::Get()->Height() - HEIGHT)/2,
WIDTH, HEIGHT)
{
SetModal();
SetToolTip(TIP_FOLLOW_MOUSE);
this->eventActor = actionActor = actor;
Text *text;
Button *button;
int y;
//Title
text = AddText(FOLLOW_MOUSE, 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(gedString(TIP_FOLLOW_MOUSE_ACTOR) + TIP_ACTION_ACTOR);
text = AddText(" Axis: ", 10, listActor->Down());
listAxis = AddListPop(text->Right() + 2, text->Top(), 128); listAxis->SetToolTip(TIP_FOLLOW_MOUSE_AXIS);
//Close
y = DrawHLine(listAxis->Down() + 2);
button = AddButton(Action::getEditAction()?"Ok":"Add", 45, 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);
GameControl::Get()->PopulateActors(listActor);
listActor->AddText(S_EVENT_ACTOR);
if(Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION))
{
listActor->AddText(S_PARENT_ACTOR);
listActor->AddText(S_CREATOR_ACTOR);
}
if(bOnCollision) listActor->AddText(S_COLLIDE_ACTOR);
listActor->SetItem(S_EVENT_ACTOR);
listAxis->AddText("Both");
listAxis->AddText("x");
listAxis->AddText("y");
listAxis->AddText("none");
listAxis->SetItem("Both");
if(!ExpressionEditor::getExpressionEditor()) UpdateEdition();
}
示例2: Init
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());
}
示例3: BaseAction
SetZDepth::SetZDepth(Actor *actor, bool bOnCollision)
: BaseAction("Set ZDepth", (GameControl::Get()->Width() - WIDTH)/2,
(GameControl::Get()->Height() - HEIGHT)/2,
WIDTH, HEIGHT)
{
SetModal();
SetToolTip(TIP_CHANGE_ZDEPTH);
eventActor = actionActor = actor;
Text *text;
Button *button;
int y;
//Title
text = AddText(CHANGE_ZDEPTH, 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(gedString(TIP_CHANGE_ZDEPTH_ACTOR) + TIP_ACTION_ACTOR);
text = AddText(" Z Depth: ", 10, listActor->Down() + 2);
slide = AddSlide(text->Right(), text->Top(), 100, 14, SL_TRANS); slide->SetToolTip(TIP_CHANGE_ZDEPTH_AMOUNT);
//Close
y = DrawHLine(slide->Down() + 2);
button = AddButton(Action::getEditAction()?"Ok":"Add", 55, 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);
GameControl::Get()->PopulateActors(listActor);
listActor->AddText(S_EVENT_ACTOR);
if(Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION))
{
listActor->AddText(S_PARENT_ACTOR);
listActor->AddText(S_CREATOR_ACTOR);
}
if(bOnCollision) listActor->AddText(S_COLLIDE_ACTOR);
listActor->SetItem(S_EVENT_ACTOR);
oriZDepth = actionActor->getImage()->ZDepth();
if(!ExpressionEditor::getExpressionEditor()) UpdateEdition();
}
示例4: BaseAction
DestroyTimer::DestroyTimer(Actor *actor)
: BaseAction("Destroy Timer", (GameControl::Get()->Width() - WIDTH)/2,
(GameControl::Get()->Height() - HEIGHT)/2,
WIDTH, HEIGHT)
{
SetModal();
SetToolTip(TIP_DESTROYTIMER);
eventActor = actionActor = actor;
Text *text;
Button *button;
int y;
//Title
text = AddText(DESTROY_TIMER, CENTER_TEXT, 5);
y = DrawHLine(text->Down() + 2);
//Body
text = AddText(" Timer: ", 10, y);
listTimer = AddListPop(text->Right() + 2, text->Top(), 300, 0, LS_TIMER); listTimer->SetToolTip(TIP_DESTROYTIMER_TIMER);
//Close
y = DrawHLine(listTimer->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);
GameControl::Get()->PopulateTimers(listTimer);
listTimer->SetItem(listTimer->GetText(0));
if(!ExpressionEditor::getExpressionEditor()) UpdateEdition();
}
示例5: Panel
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();
}
示例6: Panel
DlgPocketPCKey::DlgPocketPCKey(SDLKey _keyFrom)
: Panel("DlgPocketPCKey", (GameControl::Get()->Width() - WIDTH)/2,
(GameControl::Get()->Height() - HEIGHT)/2,
WIDTH, HEIGHT)
{
SetModal();
key = SDLK_UNKNOWN;
keyFrom = _keyFrom;
Text *text;
Button *button;
int y;
//Title
text = AddText("PocketPC Key Mapper", CENTER_TEXT, 5);
y = DrawHLine(text->Down() + 2);
//Body
text = AddText(gedString("Redirect ") + SDL_GetKeyName(keyFrom), 10, y);
text = AddText("Press key to redirect: ", 10, text->Down()+1);
textKey = AddText(" ", text->Right(), text->Top());
//Close
y = DrawHLine(textKey->Down() + 2);
button = AddButton("Set Key", (WIDTH-135)/2, y, 0, 0, BT_SET);
button = AddButton("Close", button->Right() + 10, y, 0, 0, BT_CANCEL);
}
示例7: if
DlgPathFinish::DlgPathFinish(Actor *actor)
: Panel("DlgAnimationFinish", (GameControl::Get()->Width() - WIDTH)/2,
(GameControl::Get()->Height() - HEIGHT)/2,
WIDTH, HEIGHT)
{
SetModal();
SetToolTip(TIP_DLG_PATH_FINISH);
eventActor = actionActor = actor;
Text *text;
Button *button;
Actor *add;
int y;
//Title
text = AddText("Path Finish Event", CENTER_TEXT, 5);
y = DrawHLine(text->Down() + 2);
//Body
text = AddText("Path: ", 10, y);
listPath = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_ANIMATION); listPath->SetToolTip(TIP_DLG_PATHFINISH_PATH);
//Close
y = DrawHLine(listPath->Down() + 5);
if(Action::inNewActivationEvent())
{
add = AddButton("Choose Actor", 25, y, 0, 0, LS_ACTION); ((Button *)add)->SetToolTip(TIP_ACTIVATIONEVENT_CHOOSE);
}
else if(Action::getEditAction())
{
add = AddButton("Edit Action", (WIDTH-135)/2 - 12, y, 0, 0, LS_ACTION); ((Button *)add)->SetToolTip(TIP_ACTION_EDIT);
}
else
{
add = AddListPop(30, 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_CLOSE); if(!Action::inNewActivationEvent()) button->SetToolTip(TIP_ACTION_CANCEL);
}
else
{
button = AddButton("Close", add->Right() + 10, y, 0, 0, BT_CLOSE); if(!Action::inNewActivationEvent()) button->SetToolTip(TIP_ACTION_CLOSE);
}
GameControl::Get()->PopulatePaths(listPath, false);
listPath->AddText(ANY_PATH);
listPath->SetItem(ANY_PATH);
UpdateEdition();
}
示例8: if
DlgTimer::DlgTimer(Actor *actor)
: Panel("DlgTimer", (GameControl::Get()->Width() - WIDTH)/2,
(GameControl::Get()->Height() - HEIGHT)/2,
WIDTH, HEIGHT)
{
SetModal();
SetToolTip(TIP_DLG_TIMER);
eventActor = actionActor = actor;
Text *text;
Button *button;
Actor *add;
int y;
//Title
text = AddText("Timer Event", CENTER_TEXT, 5);
y = DrawHLine(text->Down() + 2);
//Body
text = AddText(" Timer: ", 10, y);
listTimer = AddListPop(text->Right() + 2, text->Top(), 300, 0, LS_TIMER);
//Close
y = DrawHLine(listTimer->Down() + 5);
if(Action::inNewActivationEvent())
{
add = AddButton("Choose Actor", (WIDTH-135)/2 - 15, y, 0, 0, LS_ACTION); ((Button *)add)->SetToolTip(TIP_ACTIVATIONEVENT_CHOOSE);
}
else if(Action::getEditAction())
{
add = AddButton("Edit Action", (WIDTH-135)/2 - 12, y, 0, 0, LS_ACTION); ((Button *)add)->SetToolTip(TIP_ACTION_EDIT);
}
else
{
add = AddListPop((WIDTH-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);
}
GameControl::Get()->PopulateTimers(listTimer);
listTimer->Sort();
//listTimer->SetItem(listTimer->GetText(0));
UpdateEdition();
}
示例9: Actor
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);
}
}
示例10: if
DlgCollision::DlgCollision(Actor *actor, bool bCollision)
: Panel("DlgCollision", (GameControl::Get()->Width() - WIDTH)/2,
(GameControl::Get()->Height() - (bCollision?(HEIGHT + 55):HEIGHT))/2,
WIDTH, bCollision?(HEIGHT + 55):HEIGHT)
{
SetModal();
eventActor = actionActor = actor;
this->bCollision = bCollision;
Text *text;
Button *button;
Actor *add;
int y;
//Title
text = AddText(bCollision?"Collision Event":"Collision Finish Event", CENTER_TEXT, 5);
y = DrawHLine(text->Down() + 2);
//Body
if(bCollision)
{
SetToolTip(TIP_DLG_COLLISION);
text = AddText(" On: ", 10, y);
listSide = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_SIDE); listSide->SetToolTip(TIP_DLG_COLLISION_SIDE);
text = AddText(" Of Actor: ", 10, listSide->Down() + 2);
listActor = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_ACTOR); listActor->SetToolTip(TIP_DLG_COLLISION_ACTOR);
text = AddText(" Repeat this event\nwhile actor is colliding: ", 10, listActor->Down() + 2);
listType = AddListPop(listActor->Right() - 40, text->Top() + 10, 40, 0, LS_TYPE); listType->SetToolTip(TIP_DLG_COLLISION_REPEAT);
listType->AddText("Yes");
listType->AddText("No");
listType->SetItem("No");
listSide->AddText("Any Side");
listSide->AddText("Top Side");
listSide->AddText("Bottom Side");
listSide->AddText("Left Side");
listSide->AddText("Right Side");
listSide->AddText("Top or Bottom Side");
listSide->AddText("Left or Right Side");
listSide->SetItem("Any Side");
side = ANY_SIDE;
y = listType->Down() + 2;
}
else
{
SetToolTip(TIP_DLG_COLLISION_FINISH);
text = AddText(" Actor: ", 10, y);
listActor = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_ACTOR); listActor->SetToolTip(TIP_DLG_COLLISION_ACTOR);
y = listActor->Down() + 2;
}
//Close
y = DrawHLine(y);
if(Action::inNewActivationEvent())
{
add = AddButton("Choose Actor", 25, y, 0, 0, LS_ACTION); ((Button *)add)->SetToolTip(TIP_ACTIVATIONEVENT_CHOOSE);
}
else if(Action::getEditAction())
{
add = AddButton("Edit Action", (WIDTH-135)/2 - 12, y, 0, 0, LS_ACTION); ((Button *)add)->SetToolTip(TIP_ACTION_EDIT);
}
else
{
add = AddListPop(30, 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_CLOSE); if(!Action::inNewActivationEvent()) button->SetToolTip(TIP_ACTION_CANCEL);
}
else
{
button = AddButton("Close", add->Right() + 10, y, 0, 0, BT_CLOSE); if(!Action::inNewActivationEvent()) button->SetToolTip(TIP_ACTION_CLOSE);
}
GameControl::Get()->PopulateActors(listActor);
if(!Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION))
{
//Set default only in old tutorials
listActor->SetItem(actionActor->getCloneIndex()?actionActor->getCloneName():actionActor->getActorName());
}
listActor->AddText(ANY_ACTOR);
//.........这里部分代码省略.........
示例11: BaseAction
ChangeParent::ChangeParent(Actor *actor, bool bOnCollision)
: BaseAction("Change Parent", (GameControl::Get()->Width() - WIDTH)/2,
(GameControl::Get()->Height() - HEIGHT)/2,
WIDTH, HEIGHT)
{
SetModal();
SetToolTip(TIP_CHANGEPARENT);
this->eventActor = actionActor = actor;
Text *text;
Button *button;
int y;
//Title
text = AddText(CHANGE_PARENT, CENTER_TEXT, 5);
y = DrawHLine(text->Down() + 2);
//Body
text = AddText(" Child: ", 10, y);
listActor = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_ACTOR); listActor->SetToolTip(gedString(TIP_CHANGEPARENT_CHILD) + TIP_ACTION_ACTOR);
text = AddText(" Parent: ", 10, listActor->Down());
listParent = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_PARENT); listParent->SetToolTip(TIP_CHANGEPARENT_PARENT);
//Close
y = DrawHLine(listParent->Down() + 2);
button = AddButton(Action::getEditAction()?"Ok":"Add", 45, 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);
GameControl::Get()->PopulateActors(listParent);
listParent->AddText(NO_PARENT);
if(actionActor && actionActor->getParent())
{
listParent->SetItem(actionActor->getCloneName());
}
else
{
listParent->SetItem(NO_PARENT);
}
GameControl::Get()->PopulateActors(listActor);
listActor->AddText(S_EVENT_ACTOR);
listParent->AddText(S_EVENT_ACTOR);
if(Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION))
{
listActor->AddText(S_PARENT_ACTOR);
listActor->AddText(S_CREATOR_ACTOR);
listParent->AddText(S_PARENT_ACTOR);
listParent->AddText(S_CREATOR_ACTOR);
}
if(bOnCollision) listParent->AddText(S_COLLIDE_ACTOR);
if(bOnCollision) listActor->AddText(S_COLLIDE_ACTOR);
listActor->SetItem(S_EVENT_ACTOR);
if(!ExpressionEditor::getExpressionEditor()) UpdateEdition();
}
示例12: Panel
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);
}
示例13: if
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())
{
//.........这里部分代码省略.........
示例14: res
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);
//.........这里部分代码省略.........
示例15: BaseAction
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();
}