Beispiel #1
0
void CIRexxApp::doAbout()
{
   char info[40];
   CForm frmAbout(AboutForm);
   CLabel(frmAbout, AboutVersionLabel).CopyLabel(Interpreter::getYaxxVersion());
 	StrPrintF(info, getRexxAppMessage(msgRexxInfo), (unsigned long)queryMemory());
   CLabel(frmAbout, AboutInfoLabel).CopyLabel(info);
   frmAbout.DoDialog();
   return;
}
/**
**  Draw decoration (invis, for the unit.)
**
**  @param unit       Pointer to the unit.
**  @param type       Type of the unit.
**  @param screenPos  Screen position of the unit.
*/
static void DrawDecoration(const CUnit &unit, const CUnitType &type, const PixelPos &screenPos)
{
	int x = screenPos.x;
	int y = screenPos.y;
#ifdef DEBUG
	// Show the number of references.
	CLabel(GetGameFont()).DrawClip(x + 1, y + 1, unit.Refs);
#endif

	UpdateUnitVariables(const_cast<CUnit &>(unit));
	// Now show decoration for each variable.
	for (std::vector<CDecoVar *>::const_iterator i = UnitTypeVar.DecoVar.begin();
		 i < UnitTypeVar.DecoVar.end(); ++i) {
		const CDecoVar &var = *(*i);
		const int value = unit.Variable[var.Index].Value;
		const int max = unit.Variable[var.Index].Max;
		Assert(value <= max);

		if (!((value == 0 && !var.ShowWhenNull) || (value == max && !var.ShowWhenMax)
			  || (var.HideHalf && value != 0 && value != max)
			  || (!var.ShowIfNotEnable && !unit.Variable[var.Index].Enable)
			  || (var.ShowOnlySelected && !unit.Selected)
			  || (unit.Player->Type == PlayerNeutral && var.HideNeutral)
			  || (ThisPlayer->IsEnemy(unit) && !var.ShowOpponent)
			  || (ThisPlayer->IsAllied(unit) && (unit.Player != ThisPlayer) && var.HideAllied)
			  || max == 0)) {
			var.Draw(
				x + var.OffsetX + var.OffsetXPercent * unit.Type->TileWidth * PixelTileSize.x / 100,
				y + var.OffsetY + var.OffsetYPercent * unit.Type->TileHeight * PixelTileSize.y / 100,
				type, unit.Variable[var.Index]);
		}
	}

	// Draw group number
	if (unit.Selected && unit.GroupId != 0
#ifndef DEBUG
		&& unit.Player == ThisPlayer
#endif
	   ) {
		int groupId = 0;

		if (unit.Player->AiEnabled) {
			groupId = unit.GroupId - 1;
		} else {
			for (groupId = 0; !(unit.GroupId & (1 << groupId)); ++groupId) {
			}
		}
		const int width = GetGameFont().Width(groupId);
		x += (unit.Type->TileWidth * PixelTileSize.x + unit.Type->BoxWidth) / 2 - width;
		const int height = GetGameFont().Height();
		y += (unit.Type->TileHeight * PixelTileSize.y + unit.Type->BoxHeight) / 2 - height;
		CLabel(GetGameFont()).DrawClip(x, y, groupId);
	}
}
/**
**  Draw missile.
*/
void Missile::DrawMissile(const CViewport &vp) const
{
	Assert(this->Type);
	CUnit *sunit = this->SourceUnit;
	// FIXME: I should copy SourcePlayer for second level missiles.
	if (sunit && sunit->Player) {
#ifdef DYNAMIC_LOAD
		if (!this->Type->Sprite) {
			LoadMissileSprite(this->Type);
		}
#endif
	}
	const PixelPos screenPixelPos = vp.MapToScreenPixelPos(this->position);

	switch (this->Type->Class) {
		case MissileClassHit:
			CLabel(GetGameFont()).DrawClip(screenPixelPos.x, screenPixelPos.y, this->Damage);
			break;
		default:
			if (Type->G) {
				this->Type->DrawMissileType(this->SpriteFrame, screenPixelPos);
			}
			break;
	}
}
Beispiel #4
0
static void InfoPanel_draw_multiple_selection()
{
	//  If there are more units selected draw their pictures and a health bar
	DrawInfoPanelBackground(0);
	for (size_t i = 0; i != std::min(Selected.size(), UI.SelectedButtons.size()); ++i) {
		const CIcon &icon = *Selected[i]->Type->Icon.Icon;
		const PixelPos pos(UI.SelectedButtons[i].X, UI.SelectedButtons[i].Y);
		icon.DrawUnitIcon(*UI.SelectedButtons[i].Style,
						  (ButtonAreaUnderCursor == ButtonAreaSelected && ButtonUnderCursor == (int)i) ?
						  (IconActive | (MouseButtons & LeftButton)) : 0,
						  pos, "", Selected[i]->RescuedFrom 
						  ? GameSettings.Presets[Selected[i]->RescuedFrom->Index].PlayerColor 
						  : GameSettings.Presets[Selected[i]->Player->Index].PlayerColor);
		UiDrawLifeBar(*Selected[i], UI.SelectedButtons[i].X, UI.SelectedButtons[i].Y);

		if (ButtonAreaUnderCursor == ButtonAreaSelected && ButtonUnderCursor == (int) i) {
			UI.StatusLine.Set(Selected[i]->Type->Name);
		}
	}
	if (Selected.size() > UI.SelectedButtons.size()) {
		char buf[5];

		sprintf(buf, "+%lu", (long unsigned int)(Selected.size() - UI.SelectedButtons.size()));
		CLabel(*UI.MaxSelectedFont).Draw(UI.MaxSelectedTextX, UI.MaxSelectedTextY, buf);
	}
}
Beispiel #5
0
static void InfoPanel_draw_multiple_selection()
{
	//  If there are more units selected draw their pictures and a health bar
	DrawInfoPanelBackground(0);
	for (size_t i = 0; i != std::min(Selected.size(), UI.SelectedButtons.size()); ++i) {
		const CIcon &icon = *Selected[i]->Type->Icon.Icon;
		const PixelPos pos(UI.SelectedButtons[i].X, UI.SelectedButtons[i].Y);
		//Wyrmgus start
//		icon.DrawUnitIcon(*UI.SelectedButtons[i].Style,
		Selected[i]->GetIcon().Icon->DrawUnitIcon(*UI.SelectedButtons[i].Style,
		//Wyrmgus end
						  (ButtonAreaUnderCursor == ButtonAreaSelected && ButtonUnderCursor == (int)i) ?
						  (IconActive | (MouseButtons & LeftButton)) : 0,
						  pos, "", Selected[i]->RescuedFrom ? Selected[i]->RescuedFrom->Index : Selected[i]->Player->Index);

		UiDrawLifeBar(*Selected[i], UI.SelectedButtons[i].X, UI.SelectedButtons[i].Y);

		if (ButtonAreaUnderCursor == ButtonAreaSelected && ButtonUnderCursor == (int) i) {
			//Wyrmgus start
//			UI.StatusLine.Set(Selected[i]->Type->Name);
			if (!Preference.NoStatusLineTooltips) {
				UI.StatusLine.Set(Selected[i]->GetMessageName());
			}
			DrawGenericPopup(Selected[i]->GetMessageName(), UI.SelectedButtons[i].X, UI.SelectedButtons[i].Y);
			//Wyrmgus end
		}
	}
	if (Selected.size() > UI.SelectedButtons.size()) {
		char buf[5];

		sprintf(buf, "+%lu", (long unsigned int)(Selected.size() - UI.SelectedButtons.size()));
		CLabel(*UI.MaxSelectedFont).Draw(UI.MaxSelectedTextX, UI.MaxSelectedTextY, buf);
	}
}
Beispiel #6
0
static Object *MkIB(SW_IDATA *idata, ULONG l, ULONG h, STRPTR Img,
                    LONG Ctrl, ULONG Style)
{
   Object *g = VGroup,
      Child, DTImgObject,
         MUIA_InnerTop,        0,
         MUIA_InnerBottom,     0,
         MUIA_InnerLeft,       0,
         MUIA_InnerRight,      0,
         MUIA_Frame,           MUIV_Frame_ImageButton,
         MUIA_InputMode,       MUIV_InputMode_RelVerify,
         MUIA_ControlChar,     Ctrl,
         MUIA_ShortHelp,       GetS(h),
         MUIA_CycleChain,      1,
         SWA_DTImg_FSpec,      Img,
         SWA_DTImg_Adjust,     TRUE,
         SWA_DTImg_ImgCache,   idata->SWA_NNews_DTImages,
         SWA_DTImg_Path,       idata->SWA_NNews_ButtonPath,
      End,
   End;

   if (TBHasLab(Style) && g)
      DoMethod(g, OM_ADDMEMBER, CLabel(GetS(l)));

   return g;
}
Beispiel #7
0
/**
**  Draw status line.
*/
void CStatusLine::Draw()
{
	if (!this->StatusLine.empty()) {
		PushClipping();
		SetClipping(this->TextX, this->TextY,
					this->TextX + this->Width - 1, Video.Height - 1);
		CLabel(*this->Font).DrawClip(this->TextX, this->TextY, this->StatusLine);
		PopClipping();
	}
}
/**
**  Print variable values (and max....).
**
**  @param x       X screen pixel position
**  @param y       Y screen pixel position
**  @param unit    Unit pointer
**  @todo fix font/color configuration.
*/
void CDecoVarText::Draw(int x, int y, const CUnitType &/*type*/, const CVariable &var) const
{
	if (this->IsCenteredInX) {
		x -= 2; // GetGameFont()->Width(buf) / 2, with buf = str(Value)
	}
	if (this->IsCenteredInY) {
		y -= this->Font->Height() / 2;
	}
	CLabel(*this->Font).DrawClip(x, y, var.Value);
}
Beispiel #9
0
/**
**  Draw decoration (invis, for the unit.)
**
**  @param unit  Pointer to the unit.
**  @param type  Type of the unit.
**  @param x     Screen X position of the unit.
**  @param y     Screen Y position of the unit.
*/
static void DrawDecoration(const CUnit &unit, const CUnitType *type, int x, int y)
{
#ifdef REFS_DEBUG
	//
	// Show the number of references.
	//
	VideoDrawNumberClip(x + 1, y + 1, GameFont, unit.Refs);
#endif

	UpdateUnitVariables(unit);
	// Now show decoration for each variable.
	for (std::vector<CDecoVar *>::const_iterator i = UnitTypeVar.DecoVar.begin();
			i < UnitTypeVar.DecoVar.end(); ++i) {
		int value;
		int max;
		const CDecoVar *var = (*i);
		value = unit.Variable[var->Index].Value;
		max = unit.Variable[var->Index].Max;
		Assert(value <= max);

		if (!((value == 0 && !var->ShowWhenNull) || (value == max && !var->ShowWhenMax) ||
				(var->HideHalf && value != 0 && value != max) ||
				(!var->ShowIfNotEnable && !unit.Variable[var->Index].Enable) ||
				(var->ShowOnlySelected && !unit.Selected) ||
				(unit.Player->Type == PlayerNeutral && var->HideNeutral) ||
				(ThisPlayer->IsEnemy(unit) && !var->ShowOpponent) ||
				(ThisPlayer->IsAllied(unit) && (unit.Player != ThisPlayer) && var->HideAllied) ||
				max == 0)) {
			var->Draw(
				x + var->OffsetX + var->OffsetXPercent * unit.Type->TileWidth * TileSizeX / 100,
				y + var->OffsetY + var->OffsetYPercent * unit.Type->TileHeight * TileSizeY / 100,
				type, unit.Variable[var->Index]);
		}
	}

	//
	// Draw group number
	//
	if (unit.Selected && unit.GroupId != 0
#ifndef DEBUG
		&& unit.Player == ThisPlayer
#endif
		) {
		int groupId = 0;
		for (groupId = 0; !(unit.GroupId & (1 << groupId)); ++groupId)
			;
		int width = GameFont->Width(groupId);
		x += (unit.Type->TileWidth * TileSizeX + unit.Type->BoxWidth) / 2 - width;
		width = GameFont->Height();
		y += (unit.Type->TileHeight * TileSizeY + unit.Type->BoxHeight) / 2 - width;
		CLabel(GameFont).DrawClip(x, y, groupId);
	}
}
/**
**  Draw additional informations of a unit.
**
**  @param unit  Unit pointer of drawn unit.
**  @param type  Unit-type pointer.
**  @param screenPos  screen pixel (top left) position of unit.
**
**  @todo FIXME: The different styles should become a function call.
*/
static void DrawInformations(const CUnit &unit, const CUnitType &type, const PixelPos &screenPos)
{
#if 0 && DEBUG // This is for showing vis counts and refs.
	char buf[10];
	sprintf(buf, "%d%c%c%d", unit.VisCount[ThisPlayer->Index],
			unit.Seen.ByPlayer & (1 << ThisPlayer->Index) ? 'Y' : 'N',
			unit.Seen.Destroyed & (1 << ThisPlayer->Index) ? 'Y' : 'N',
			unit.Refs);
	CLabel(GetSmallFont()).Draw(screenPos.x + 10, screenPos.y + 10, buf);
#endif

	const CUnitStats &stats = *unit.Stats;

	// For debug draw sight, react and attack range!
	if (IsOnlySelected(unit)) {
		const PixelPos center(screenPos + type.GetPixelSize() / 2);

		if (Preference.ShowSightRange) {
			const int value = stats.Variables[SIGHTRANGE_INDEX].Max;
			const int radius = value * PixelTileSize.x + (type.TileWidth - 1) * PixelTileSize.x / 2;

			if (value) {
				// Radius -1 so you can see all ranges
				Video.DrawCircleClip(ColorGreen, center.x, center.y, radius - 1);
			}
		}
		if (type.CanAttack) {
			if (Preference.ShowReactionRange) {
				const int value = (unit.Player->Type == PlayerPerson) ? type.ReactRangePerson : type.ReactRangeComputer;
				const int radius = value * PixelTileSize.x + (type.TileWidth - 1) * PixelTileSize.x / 2;

				if (value) {
					Video.DrawCircleClip(ColorBlue, center.x, center.y, radius);
				}
			}
			if (Preference.ShowAttackRange) {
				const int value = stats.Variables[ATTACKRANGE_INDEX].Max;
				const int radius = value * PixelTileSize.x + (type.TileWidth - 1) * PixelTileSize.x / 2;

				if (value) {
					// Radius +1 so you can see all ranges
					Video.DrawCircleClip(ColorGreen, center.x, center.y, radius - 1);
				}
			}
		}
	}

	// FIXME: johns: ugly check here, should be removed!
	if (unit.CurrentAction() != UnitActionDie && (unit.IsVisible(*ThisPlayer) || ReplayRevealMap)) {
		DrawDecoration(unit, type, screenPos);
	}
}
Beispiel #11
0
/**
**  Show load progress.
**
**  @param fmt  printf format string.
*/
void ShowLoadProgress(const char *fmt, ...)
{
	static unsigned int lastProgressUpdate = SDL_GetTicks();
	if (SDL_GetTicks() < lastProgressUpdate + 16) {
		// Only show progress updates every c. 1/60th of a second, otherwise we're waiting for the screen too much
		return;
	}
	lastProgressUpdate = SDL_GetTicks();

	UpdateLoadProgress();
	
	va_list va;
	char temp[4096];

	va_start(va, fmt);
	vsnprintf(temp, sizeof(temp) - 1, fmt, va);
	temp[sizeof(temp) - 1] = '\0';
	va_end(va);

	if (Video.Depth && IsGameFontReady() && GetGameFont().IsLoaded()) {
		// Remove non printable chars
		for (unsigned char *s = (unsigned char *)temp; *s; ++s) {
			if (*s < 32) {
				*s = ' ';
			}
		}
		//Wyrmgus start
//		Video.FillRectangle(ColorBlack, 5, Video.Height - 18, Video.Width - 10, 18);
		if (loadingBackground == nullptr) {
			Video.FillRectangle(ColorBlack, 0, Video.Height - 18, Video.Width, 18);
		}
		//Wyrmgus end
		CLabel(GetGameFont()).DrawCentered(Video.Width / 2, Video.Height - 16, temp);
		//Wyrmgus start
//		InvalidateArea(5, Video.Height - 18, Video.Width - 10, 18);
		if (loadingBackground == nullptr) {
			InvalidateArea(0, Video.Height - 18, Video.Width, 18);
		} else {
			InvalidateArea(0, 0, Video.Width, Video.Height);
		}
		//Wyrmgus end

		RealizeVideoMemory();
	} else {
		DebugPrint("!!!!%s\n" _C_ temp);
	}

	PollEvents();
}
Beispiel #12
0
/* virtual */ void CFont::drawString(gcn::Graphics *graphics, const std::string &txt, int x, int y)
{
	DynamicLoad();
	const gcn::ClipRectangle &r = graphics->getCurrentClipArea();
	int right = std::min<int>(r.x + r.width - 1, Video.Width - 1);
	int bottom = std::min<int>(r.y + r.height - 1, Video.Height - 1);

	if (r.x > right || r.y > bottom) {
		return;
	}

	PushClipping();
	SetClipping(r.x, r.y, right, bottom);
	CLabel(*this).DrawClip(x + r.xOffset, y + r.yOffset, txt);
	PopClipping();
}
Beispiel #13
0
void ui_about(void)
{
    APTR gui = GroupObject, End;
    int i = 0;
    static const char *authors_start[] = {
        "VICE",
        "",
        "Versatile Commodore Emulator",
        "",
#ifdef USE_SVN_REVISION
        "Version " VERSION "rev " VICE_SVN_REV_STRING " (" PLATFORM_CPU " " PLATFORM_OS " " PLATFORM_COMPILER ")",
#else
        "Version " VERSION " (" PLATFORM_CPU " " PLATFORM_OS " " PLATFORM_COMPILER ")",
#endif
        "",
        "The VICE Team",
        NULL};

    static const char *authors_end[] = {
        "",
        "Official VICE homepage:",
        "http://vice-emu.sourceforge.net/",
        NULL};

    char *tmp = NULL;

    for (i = 0; authors_start[i] != NULL; i++) {
        if (i <= 5) { /* centered */
            DoMethod(gui, OM_ADDMEMBER, CLabel(authors_start[i]));
        } else {
            DoMethod(gui, OM_ADDMEMBER, LLabel(authors_start[i]));
        }
    }

    for (i = 0; core_team[i].name; i++) {
        tmp = util_concat("Copyright \xa9 ", core_team[i].years, " ", core_team[i].name, NULL);
        DoMethod(gui, OM_ADDMEMBER, LLabel(tmp));
        lib_free(tmp);
    }

    for (i = 0; authors_end[i] != NULL; i++) {
        DoMethod(gui, OM_ADDMEMBER, LLabel(authors_end[i]));
    }

    mui_show_dialog(gui, translate_text(IDS_ABOUT), NULL);
}
Beispiel #14
0
/**
**  Draw decoration (invis, for the unit.)
**
**  @param unit  Pointer to the unit.
**  @param type  Type of the unit.
**  @param x     Screen X position of the unit.
**  @param y     Screen Y position of the unit.
*/
void CUnitDrawProxy::DrawDecorationAt(int x, int y) const
{

	// Now show decoration for each variable.
	if (Variable) {
		const unsigned int num_dec = UnitTypeVar.DecoVar.size();
		for (unsigned int i = 0; i < num_dec; ++i) {
			const CDecoVar *var = UnitTypeVar.DecoVar[i];
			int value = Variable[i].Value;
			int max = Variable[i].Max;
			Assert(value <= max);

			if (!((value == 0 && !var->ShowWhenNull) || (value == max && !var->ShowWhenMax) ||
					(var->HideHalf && value != 0 && value != max) ||
					//(!var->ShowIfNotEnable && !Variable[var->Index].Enable) ||
					(!var->ShowIfNotEnable && !Variable[i].Enable) ||
					(var->ShowOnlySelected && !Selected) ||
					((Player != ThisPlayer) && ((Player->Type == PlayerNeutral && var->HideNeutral) ||
					(ThisPlayer->IsEnemy(Player) && !var->ShowOpponent) ||
					(ThisPlayer->IsAllied(Player) && var->HideAllied))) ||
					max == 0)) {
				var->Draw(
					x + var->OffsetX + var->OffsetXPercent * Type->TileWidth * TileSizeX / 100,
					y + var->OffsetY + var->OffsetYPercent * Type->TileHeight * TileSizeY / 100,
					Type, Variable[i]);
			}
		}
	}

	//
	// Draw group number
	//
	if (Selected && GroupId != 0
#ifndef DEBUG
	 && Player == ThisPlayer
#endif
	 ) {
		int width = GameFont->Width(GroupId - 1);
		x += (Type->TileWidth * TileSizeX + Type->BoxWidth) / 2 - width;
		width = GameFont->Height();
		y += (Type->TileHeight * TileSizeY + Type->BoxHeight) / 2 - width;
		CLabel(GameFont).DrawClip(x, y, GroupId - 1);
	}
}
Beispiel #15
0
CLabel CPie::GetOtherLabel()
{
	LPDISPATCH pDispatch;
	GetProperty(0x4, VT_DISPATCH, (void*)&pDispatch);
	return CLabel(pDispatch);
}
Beispiel #16
0
CLabel CAxis::GetTitle()
{
	LPDISPATCH pDispatch;
	GetProperty(0x1, VT_DISPATCH, (void*)&pDispatch);
	return CLabel(pDispatch);
}