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();
}
Exemple #2
0
// ------------------------------------------------------
// Draw a bevelled box on the screen
void Gadgets::Draw_Box(int x, int y,
                       int width, int height,
                       int reversed,
                       int colhi, int colmid, int collo,
                       int bevel)
{
    int Color;

    SetColor(colmid);
    if(bevel)
    {
        Fillrect(x - 1 + (reversed ? 2 : 0), y - 1 + (reversed ? 2 : 0),
                 x + width - 1 - (reversed ? 2 : 0),
                 y + height - 1 - (reversed ? 2 : 0));
        Color = reversed ? colhi : collo;
        DrawVLine(x + width - 2, y, y + height - 2, Color);
        DrawHLine(y + height - 2, x, x + width - 2, Color);
        Color = reversed ? collo : colhi;
        DrawVLine(x - 1, y - 1, y + height - 3, Color);
        DrawHLine(y - 1, x - 1, x + width - 3, Color);
    }
    else
    {
        Fillrect(x, y, x + width - 2, y + height - 2);
    }
}
Exemple #3
0
void glcd::DrawRect(uint8_t x, uint8_t y, uint8_t width, uint8_t height,
                    uint8_t color) {
    DrawHLine(x, y, width, color);          // top
    DrawHLine(x, y + height, width, color); // bottom
    DrawVLine(x, y, height, color);         // left
    DrawVLine(x + width, y, height, color); // right
}
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();
}
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);		
}
Exemple #6
0
void 
ScrnInit(void)
{
    InitText();

    signal(SIGINT, SevereErrorSIGINT);
    signal(SIGSEGV, SevereErrorSIGSEGV);
#ifdef SIGQUIT
    signal(SIGQUIT, SevereErrorSIGQUIT);
#endif

    LastCheck = StartTime = (long)I_FloatTime();

    SetForeColor(ANSI_WHITE);
    SetBackColor(ANSI_BLUE);
    DrawFilledBox(0, 0, ScrnWidth, ScrnHeight);

    StatusLine = 5;

    MoveCurs(2, 1);
    SetForeColor(ANSI_WHITE);
    SetBackColor(ANSI_BLUE);
    DrawVLine(45, 5, ScrnHeight - 6);
    DrawHLine(1, 4, ScrnWidth - 2);
    DrawHLine(1, 2, ScrnWidth - 2);
    MoveCurs(2, 3);
    CPrintf("$f3Elapsed time: $f200:00:00                       $f7By Lee Smith <[email protected]$f7>$f3");
    remove("error.log");
}
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();
}
Exemple #8
0
// judb draw a 'lowered button' border based on the given color
void CPainter::Draw3DLoweredRect(const CRect& Rect, const CRGBColor& Color)
{
	CRect RealRect(Rect);
	if (m_pWindow)	{
		RealRect = Rect + m_pWindow->GetClientRect().TopLeft();
		RealRect.ClipTo(m_pWindow->GetClientRect());
	}
	DrawHLine(RealRect.Left(), RealRect.Right(), RealRect.Top(), Color * 0.3);
	DrawHLine(RealRect.Left(), RealRect.Right(), RealRect.Bottom(), Color * 1.6);
	DrawVLine(RealRect.Top(), RealRect.Bottom(), RealRect.Left(), Color * 0.3);
	DrawVLine(RealRect.Top(), RealRect.Bottom(), RealRect.Right(), Color * 1.6);
}
Exemple #9
0
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();
}
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();
}
Exemple #11
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());
}
Exemple #12
0
///////////////////
// Draw the scrollbar
void CScrollbar::Draw(SDL_Surface * bmpDest)
{
	int x=0;
	int length;
    
	// Top arrow
	if(bTopButton)
		x=15;
	DrawImageAdv(bmpDest, gfxGUI.bmpScrollbar, x,0, iX,iY, 15,14);

	// Bottom arrow
	x=0;
	if(bBotButton)
		x=15;
	DrawImageAdv(bmpDest, gfxGUI.bmpScrollbar, x,14, iX,iY+iHeight-14, 15,14);

	// Main bit
	DrawRectFill(bmpDest, iX,iY+14, iX+iWidth, iY+iHeight-14, tLX->clScrollbarBack);
	DrawVLine(bmpDest, iY+14, iY+iHeight-14, iX,tLX->clScrollbarBackLight);
	DrawVLine(bmpDest, iY+14, iY+iHeight-14, iX+iWidth,tLX->clScrollbarBackLight);

	// Slider
	if(iMax > iItemsperbox && iMax > 0) {
		length = (int)((float)iItemsperbox/(float)iMax * iHeight-30);
        length = MAX(length, 12);
        
		int pos = iScrollPos;
		if(pos+length > iHeight-30)
			pos=iHeight-30-length;
		if (pos < 0)  
			pos = 0;

		DrawRectFill(bmpDest, iX+2, iY+15+pos, iX+iWidth-1, iY+15+pos+length, tLX->clScrollbarFront);

        // Shine
        DrawVLine(bmpDest, iY+15+pos, iY+15+pos+length, iX+1, tLX->clScrollbarHighlight);
        DrawHLine(bmpDest, iX+1, iX+iWidth-1, iY+15+pos, tLX->clScrollbarHighlight);
        // Dark
        DrawVLine(bmpDest, iY+15+pos, iY+15+pos+length, iX+iWidth-1, tLX->clScrollbarShadow);
        DrawHLine(bmpDest, iX+1, iX+iWidth-1, iY+15+pos+length, tLX->clScrollbarShadow);
	}

	// Slight hack
	if( !GetMouse()->Button ) {
		bTopButton=false;
		bBotButton=false;
	}
		
}
Exemple #13
0
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();
}
Exemple #14
0
__myevic__ void DrawMenu()
{
	unsigned int firstitem;

	if ( CurrentMenu == 0 )
	{
		CurrentMenu = &MainMenu;
		CurrentMenuItem = 0;
	}

	if ( !CurrentMenu->nitems )
	{
		MainView();
		return;
	}

	if ( CurrentMenuItem >= CurrentMenu->nitems ) CurrentMenuItem = 0;

	DrawString( CurrentMenu->caption, 4, 6 );
	DrawHLine( 0, 16, 63, 1 );

	if (( CurrentMenu->nitems > 7 ) && ( CurrentMenuItem > 3 ))
	{
		if ( CurrentMenuItem > CurrentMenu->nitems-4 )
		{
			firstitem = CurrentMenu->nitems - 7;
		}
		else
		{
			firstitem = CurrentMenuItem - 3;
		}
	}
	else
	{
		firstitem = 0;
	}

	for ( int i = 0; i < 7; ++i )
	{
		if ( firstitem + i >= CurrentMenu->nitems ) break;

		if ( CurrentMenu->mitems[firstitem+i].caption )
		{
			if ( CurrentMenuItem == firstitem + i )
			{
				DrawFillRect( 0, 18+14*i, 63, 30+14*i, 1 );
				DrawStringInv( CurrentMenu->mitems[firstitem+i].caption, 4, 20+14*i );
			}
			else
			{
				DrawString( CurrentMenu->mitems[firstitem+i].caption, 4, 20+14*i );
			}
		}

		if ( CurrentMenu->on_drawitem )
		{
			CurrentMenu->on_drawitem( firstitem + i, 18+14*i, CurrentMenuItem == firstitem + i );
		}
	}
}
Exemple #15
0
void PlayField::eventBlit(SDL_Surface* surface, const PG_Rect& src, const PG_Rect& dst) {

	SDL_FillRect(PG_Application::GetScreen(), const_cast<PG_Rect*>(&dst), 0);
	
	if (tickstate==0) {
		// we draw our first line
		DrawLine(
			0,
			0,
			my_width-1,
			my_height-1,
			my_color,
			1
			);

		// we draw our second line
		DrawLine(
			my_width-1,
			0,
			0,
			my_height-1,
			my_color,
			1
			);
		tickstate = 1;
	}
	else if (tickstate == 1) {
		DrawHLine(0, my_height/2, my_width-1, my_color);
		tickstate = 0;
	}
}
Exemple #16
0
__myevic__ void ShowContrast()
{
	int pc, nd, x;

	DrawString( String_Contrast, 4, 6 );
	DrawHLine( 0, 16, 63, 1 );

	pc = ( ( 100 * dfContrast ) / 255 );
	nd = ( pc < 100 ? pc < 10 ? 1 : 2 : 3 );
	x = ( 64 - ( 6 * nd + 9 )) / 2;
	DrawValue( x, 20, pc, 0, 0x0B, 0 );
	DrawImage( x + 6 * nd, 20, 0xC2 );

	DrawFillRect( 0, 32, 63, 44, 1 );
	DrawFillRect( 1, 33, 62, 43, 0 );
	if ( dfContrast )
	{
		DrawFillRect( 2, 34, 2 + ( ( 59 * dfContrast ) / 255 ), 42, 1 );
	}

	DrawStringCentered( String_Fireto, 57 );
	DrawStringCentered( ( gFlags.edit_capture_evt ) ? String_Exit : String_Edit, 67 );

	if ( !(dfStatus.nologo) ) DrawLOGO( 0, 88 );
}
Exemple #17
0
void hline(ALLEGRO_BITMAP *bmp, int x1, int y, int x2, int color) {
	sub_to_abs_coords(bmp, x1, y);
	sub_to_abs_coords_x(bmp, x2);
	DrawHLine(bmp->surf.get(), x1, x2, y, allegcol_to_Col(color));
/*	for(int x = x1; x < x2; ++x)
		if(abscoord_in_bmp(bmp, x, y))
			putpixel(bmp, x, y, color);*/
}
Exemple #18
0
//=========================================================================
__myevic__ void ShowRTCAdjust()
{
	S_RTC_TIME_DATA_T rtd;

	DrawString( String_ClkAdjust, 4, 6 );
	DrawHLine( 0, 16, 63, 1 );

	GetRTC( &rtd );
	DrawTime( 5, 40, &rtd, 0x1F );
}
Exemple #19
0
static void DrawNumber(plane_t *p, int h, const uint8_t data[5], int l)
{
    for (int i = 0; i < 5; i++) {
        uint8_t x = data[i];
        for (int j = 0; j < 7; j++) {
            x <<= 1;
            if (x & 0x80)
                DrawHLine(p, h - l + 2 - 1 - i, 12 + j, black, 1);
        }
    }
}
Exemple #20
0
///////////////////
// Draw the slider
void CSlider::Draw(SDL_Surface * bmpDest)
{
	if (bRedrawMenu)
		Menu_redrawBufferRect(iX,iY, iWidth,iHeight);

	DrawHLine( bmpDest, iX+5, iX+iWidth-5, iY+iHeight/2-1, tLX->clSliderDark);
	DrawHLine( bmpDest, iX+5, iX+iWidth-5, iY+iHeight/2,   tLX->clSliderLight);
	DrawHLine( bmpDest, iX+5, iX+iWidth-5, iY+iHeight/2+1, tLX->clSliderDark);

	// Draw the button
	int x = iX+5;
	int w = iWidth - 10;
	int val = (int)( ((float)w/(float)(iMax - iMin)) * (float)(iValue - iMin) ) + x;

	int y = (iY+iHeight/2) - gfxGUI.bmpSliderBut.get()->h/2;
	DrawImage(bmpDest,gfxGUI.bmpSliderBut,val-3,y);
	
	if( !bShowText )
		return;
	
	std::string sText = ftoa( iValue * fValueScale ) + sAppendText;
	tLX->cFont.Draw(bmpDest, iX + iTextPosX, iY + iTextPosY, iTextColor, sText);
}
Exemple #21
0
__myevic__ void ShowRTCSpeed()
{
	unsigned int cs;
	S_RTC_TIME_DATA_T rtd;

	DrawString( String_ClkSpeed, 4, 6 );
	DrawHLine( 0, 16, 63, 1 );

	GetRTC( &rtd );
	DrawTimeSmall( 12, 20, &rtd, 0x1F );

	cs = RTCGetClockSpeed();
	DrawValue( 12, 40, cs, 0, 0x1F, 5 );
}
Exemple #22
0
void CPainter::DrawRect(const CRect& Rect, bool bFilled, const CRGBColor& BorderColor, const CRGBColor& FillColor)
{
	CRect RealRect(Rect);
	if (m_pWindow)
	{
		RealRect = Rect + m_pWindow->GetClientRect().TopLeft();
		RealRect.ClipTo(m_pWindow->GetClientRect());
	}
	if (!bFilled || (BorderColor != FillColor))
	{
		DrawHLine(RealRect.Left(), RealRect.Right(), RealRect.Top(), BorderColor);
		DrawHLine(RealRect.Left(), RealRect.Right(), RealRect.Bottom(), BorderColor);
		DrawVLine(RealRect.Top(), RealRect.Bottom(), RealRect.Left(), BorderColor);
		DrawVLine(RealRect.Top(), RealRect.Bottom(), RealRect.Right(), BorderColor);
		RealRect.Grow(-1); //In case we have to fill the rect, then it's ready to go.
	}

	if (bFilled)
	{
		if (m_PaintMode == PAINT_REPLACE)
		{
			SDL_Rect FillRect = RealRect.SDLRect();
			SDL_FillRect(m_pSurface, &FillRect, FillColor.SDLColor(m_pSurface->format));
		}
		else
		{
			for (int iY = RealRect.Top(); iY <= RealRect.Bottom(); ++iY)
			{
				for (int iX = RealRect.Left(); iX <= RealRect.Right(); ++iX)
				{
					DrawPoint(CPoint(iX, iY), FillColor);
				}
			}
		}
	}
}
Exemple #23
0
//=========================================================================
//----- (000072EC) --------------------------------------------------------
__myevic__ void ShowTCRSet()
{
	int i;
	int line;

	DrawString( String_TCRSet, 7, 6 );
	DrawHLine( 0, 22, 63, 1 );

	if ( gFlags.edit_tcr_value )
	{
		for ( i = 0 ; i < 3 ; ++i )
		{
			if ( EditTCRIndex == i )
			{
				DrawFillRect( 28, 25 * i + 30, 62, 25 * i + 52, 1 );
				DrawValueInv(30, 25 * i + 36, dfTCRM[i], 0, 0x1F, 4);
			}
			else
			{
				DrawValue( 30, 25 * i + 36, dfTCRM[i], 0, 0x1F, 4 );
			}
			line = 25 * i + 33;
			DrawImage(  0, line, 0xED );
			DrawImage( 15, line, 0xEE + i );
		}
	}
	else
	{
		for ( i = 0 ; i < 3 ; ++i )
		{
			line = 25 * i + 33;

			if ( EditTCRIndex == i )
			{
				DrawImageInv(  0, line, 0xED );
				DrawImageInv( 15, line, 0xEE + i );
				DrawFillRect( 25, line, 30, line + 16, 0);
			}
			else
			{
				DrawImage(  0, line, 0xED );
				DrawImage( 15, line, 0xEE + i );
			}
			DrawValue( 30, 25 * i + 36, dfTCRM[i], 0, 0x1F, 4 );
		}
	}
}
Exemple #24
0
//=========================================================================
//----- (000071A4) --------------------------------------------------------
__myevic__ void ShowLOGOMenu()
{
	int l;

	DrawString( String_LOGO, 4, 6 );
	DrawHLine( 0, 16, 63, 1 );

	l = dfStatus.nologo;

	DrawFillRect( 0, 14 * l + 18, 63, 14 * l + 30, 1 );

	if ( l )
	{
		DrawString( String_On, 4, 20 );
		DrawStringInv( String_Off, 4, 34 );
	}
	else
	{
		DrawStringInv( String_On, 4, 20 );
		DrawString( String_Off, 4, 34 );
	}
}
Exemple #25
0
//=========================================================================
//----- (00007234) --------------------------------------------------------
__myevic__ void ShowGameMenu()
{
	int line;
	const uint16_t *str;

	DrawString( String_Game, 4, 6 );
	DrawHLine( 0, 16, 63, 1 );

	DrawString( String_Easy, 4, 20 );
	DrawString( String_Normal, 4, 34 );
	DrawString( String_Hard, 4, 48 );
	DrawString( String_Exit, 4, 62 );

	DrawFillRect( 0, ( 18 + 14 * dfFBSpeed ), 63, ( 30 + 14 * dfFBSpeed ), 1);

	line = 20 + 14 * dfFBSpeed;

	if ( dfFBSpeed == 0 )
	{
		str = String_Easy;
	}
	else if ( dfFBSpeed == 1 )
	{
		str = String_Normal;
	}
	else if ( dfFBSpeed == 2 )
	{
		str = String_Hard;
	}
	else if ( dfFBSpeed == 3 )
	{
		str = String_Exit;
	}
	else return;

	DrawStringInv( str, 4, line );
}
Exemple #26
0
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);
	listActor->RemoveText(VIEW_NAME);

	UpdateEdition();
}
Exemple #27
0
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();
}
Exemple #28
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);
	}
}
Exemple #29
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);
}
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();
}