1
0
forked from 0ad/0ad

Compare commits

...

5 Commits

Author SHA1 Message Date
0fc9f6100f
Fix x86_64 cross-compilation on macOS 2024-09-21 13:24:30 +02:00
668ae8a20e Increase height of middle panel to prevent icon overflow
The icon/portrait of the middle panel when a single entity was selected
was very subtly (4 px) overflowing its lane and invading that of the
entity's name. This change fixes that by:

 - Raising the top of the middle panel by 4 px to leave room for the
   portrait/icon. This avoids having to shrink it and lose quality.

 - Distributing the 4 px of difference in height in the statistics area
   by lowering 1 px the top bar, 1 px the middle bar (if any), and 3 px
   the bottom bar (if any). The rest of the elements are lowered 4 px,
   and therefore remain in the same place.

 - Increasing the height of the minimap panel by 4 px so that it remains
   aligned with the middle panel, vertically centering the minimap, and
   making the necessary adjustments to the position of its buttons.

Additionally, a couple of minor changes are applied:

 - The separators between the statistics area and the attack/resistance
   and resources area, and between the attack/resistance and resources
   area and the entity name area, which had different heights, are set
   to the same height/thickness.

 - The attack/resistance icon, which was very close to the entity
   icon/portrait, is moved 1 px to the right, and the
   resourceCarryingText (in the same area), which was very far from the
   resourceCarryingIcon, is also moved 3 px to the right.

Fixes #7029
2024-09-18 13:38:05 +02:00
b15eb6909e Remove unnecessary comments in selection_details.js
Related: #7012
2024-09-18 06:46:51 +02:00
798cff1f6f Left-click the portrait to follow the entity
- Left-clicking the portrait of a unit will make the camera follow that
   unit (before: no action). A tooltip informs the player of this
   possibility.

 - Left-clicking the portrait of a structure will make the camera focus on
   that structure (before: no action). A tooltip informs the player of
   this possibility.

 - Double-clicking a hero/treasure icon will make the camera follow that
   hero/treasure (before: just focus on that hero/treasure).

 - Some minor related changes.

Fixes #6879
2024-09-18 06:46:51 +02:00
230c7ca27d
Add EditorConfig options for Python
While the desired options for indent size and style are Python's
defaults, let's make it explicit by specifying it in the EditorConfig.

As part of this, this also removes unnecessary inline formatting options
for Python files.
2024-09-17 11:03:15 +02:00
14 changed files with 71 additions and 41 deletions

View File

@ -5,6 +5,10 @@ charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
[*.py]
indent_size = 4
indent_style = space
[*.sh]
indent_style = tab
function_next_line = true

View File

@ -1219,16 +1219,28 @@ function getResourceDropsiteTooltip(template)
});
}
function showTemplateViewerOnRightClickTooltip()
function getFocusOnLeftClickTooltip()
{
// Translation: Appears in a tooltip to indicate that right-clicking the corresponding GUI element will open the Template Details GUI page.
return translate("Right-click to view more information.");
// Translation: Appears in a tooltip to indicate that left-clicking the corresponding GUI element will center the view on the selected entity.
return translate("Left-click to focus.");
}
function showTemplateViewerOnClickTooltip()
function getFollowOnLeftClickTooltip()
{
// Translation: Appears in a tooltip to indicate that left-clicking the corresponding GUI element will make the camera follow the selected unit.
return translate("Left-click to follow.");
}
function getTemplateViewerOnRightClickTooltip()
{
// Translation: Appears in a tooltip to indicate that right-clicking the corresponding GUI element will open the Template Details GUI page.
return translate("Right-click for more information.");
}
function getTemplateViewerOnClickTooltip()
{
// Translation: Appears in a tooltip to indicate that clicking the corresponding GUI element will open the Template Details GUI page.
return translate("Click to view more information.");
return translate("Click for more information.");
}
/**

View File

@ -45,7 +45,7 @@ class EntityBox
static compileTooltip(template)
{
return ReferencePage.buildText(template, this.prototype.TooltipFunctions) + "\n" + showTemplateViewerOnClickTooltip();
return ReferencePage.buildText(template, this.prototype.TooltipFunctions) + "\n" + getTemplateViewerOnClickTooltip();
}
/**

View File

@ -16,7 +16,7 @@
<!-- Background circle -->
<object
type="image"
size="4 4 100%-4 100%-4"
size="4 6 100%-4 100%-6"
sprite="stretched:session/minimap_circle_modern.png"
ghost="true"
/>
@ -24,7 +24,7 @@
<!-- Idle Worker Button -->
<object name="idleWorkerButton"
type="button"
size="100%-119 100%-120 100%-4 100%-5"
size="100%-119 100%-121 100%-4 100%-6"
tooltip_style="sessionToolTip"
hotkey="selection.idleworker"
sprite="stretched:session/minimap-idle.png"
@ -45,7 +45,7 @@
<!-- Diplomacy Colors Button -->
<object name="diplomacyColorsButton"
type="button"
size="4 100%-120 119 100%-5"
size="3 100%-121 118 100%-6"
tooltip_style="sessionToolTip"
hotkey="session.diplomacycolors"
/>
@ -54,7 +54,7 @@
<object
name="flareButton"
type="button"
size="3 3 118 118"
size="2 4 117 119"
tooltip_style="sessionToolTip"
hotkey="session.flareactivate"
sprite="stretched:session/minimap-flare.png"
@ -66,7 +66,7 @@
<!-- MiniMap -->
<object
name="minimap"
size="8 8 100%-8 100%-8"
size="8 10 100%-8 100%-10"
type="minimap"
mask="true"
flare_texture_count="16"

View File

@ -479,8 +479,8 @@ EntitySelection.prototype.selectAndMoveTo = function(entityID)
this.reset();
this.addList([entityID]);
Engine.CameraMoveTo(entState.position.x, entState.position.z);
}
setCameraFollow(entityID);
};
/**
* Adds the formation members of a selected entities to the selection.

View File

@ -324,9 +324,17 @@ function displaySingle(entState)
// TODO: we should require all entities to have icons
Engine.GetGUIObjectByName("icon").sprite = template.icon ? ("stretched:session/portraits/" + template.icon) : "BackgroundBlack";
if (template.icon)
Engine.GetGUIObjectByName("iconBorder").onPressRight = () => {
{
const iconBorder = Engine.GetGUIObjectByName("iconBorder");
iconBorder.onPress = () => {
setCameraFollow(entState.id);
};
iconBorder.onPressRight = () => {
showTemplateDetails(entState.template, playerState.civ);
};
}
let detailedTooltip = [
getAttackTooltip,
@ -357,10 +365,12 @@ function displaySingle(entState)
getVisibleEntityClassesFormatted,
getAurasTooltip,
getEntityTooltip,
getTreasureTooltip,
showTemplateViewerOnRightClickTooltip
getTreasureTooltip
].map(func => func(template)));
const leftClickTooltip = hasClass(entState, "Unit") ? getFollowOnLeftClickTooltip() : getFocusOnLeftClickTooltip();
iconTooltips.push(leftClickTooltip + " " + getTemplateViewerOnRightClickTooltip());
Engine.GetGUIObjectByName("iconBorder").tooltip = iconTooltips.filter(tip => tip).join("\n");
Engine.GetGUIObjectByName("detailsAreaSingle").hidden = false;

View File

@ -207,7 +207,7 @@ g_SelectionPanels.Construction = {
getGarrisonTooltip(template),
getTurretsTooltip(template),
getPopulationBonusTooltip(template),
showTemplateViewerOnRightClickTooltip(template)
getTemplateViewerOnRightClickTooltip(template)
);
@ -578,7 +578,7 @@ g_SelectionPanels.Queue = {
"neededSlots": queuedItem.neededSlots
}));
}
tooltips.push(showTemplateViewerOnRightClickTooltip(template));
tooltips.push(getTemplateViewerOnRightClickTooltip(template));
data.button.tooltip = tooltips.join("\n");
data.countDisplay.caption = queuedItem.count > 1 ? queuedItem.count : "";
@ -763,7 +763,7 @@ g_SelectionPanels.Research = {
getEntityNamesFormatted,
getEntityTooltip,
getEntityCostTooltip,
showTemplateViewerOnRightClickTooltip
getTemplateViewerOnRightClickTooltip
].map(func => func(template));
if (!requirementsPassed)
@ -1058,7 +1058,7 @@ g_SelectionPanels.Training = {
getResourceDropsiteTooltip
].map(func => func(template)));
tooltips.push(showTemplateViewerOnRightClickTooltip());
tooltips.push(getTemplateViewerOnRightClickTooltip());
tooltips.push(
formatBatchTrainingString(buildingsCountToTrainFullBatch, fullBatchSize, remainderBatch),
getRequirementsTooltip(requirementsMet, template.requirements, GetSimState().players[data.player].civ),
@ -1180,7 +1180,8 @@ g_SelectionPanels.Upgrade = {
formatMatchLimitString(limits.matchLimit, limits.matchCount, limits.type),
getRequirementsTooltip(requirementsMet, data.item.requirements, GetSimState().players[data.player].civ),
getNeededResourcesTooltip(neededResources),
showTemplateViewerOnRightClickTooltip());
getTemplateViewerOnRightClickTooltip()
);
tooltip = tooltips.filter(tip => tip).join("\n");

View File

@ -386,14 +386,16 @@ function cancelUpgradeEntity()
}
/**
* Set the camera to follow the given entity if it's a unit.
* Otherwise stop following.
* Focus the camera on the entity and follow if it's a unit.
* If that's not possible, stop any current follow.
*/
function setCameraFollow(entity)
{
let entState = entity && GetEntityState(entity);
const entState = entity && GetEntityState(entity);
if (entState && hasClass(entState, "Unit"))
Engine.CameraFollow(entity);
else if (entState?.position)
Engine.CameraMoveTo(entState.position.x, entState.position.z);
else
Engine.CameraFollow(0);
}

View File

@ -5,7 +5,7 @@
>
<!-- Names and civilization emblem etc. (This must come before the attack and resistance icon to avoid clipping issues.) -->
<object size="0 92 100% 100%" name="statsArea" type="image" sprite="edgedPanelShader">
<object size="0 96 100% 100%" name="statsArea" type="image" sprite="edgedPanelShader">
<!-- Civilization tooltip. -->
<object size="0 38 100% 62" tooltip_style="sessionToolTip">
<!-- Civilization emblem. -->
@ -26,14 +26,14 @@
</object>
<!-- Stats Bars -->
<object size= "0 0 100% 96" type="image" tooltip_style="sessionToolTip">
<object size= "0 0 100% 100" type="image" tooltip_style="sessionToolTip">
<object size="0 0 100% 60" type="image" sprite="topEdgedPanelShader">
<object size="0 0 100% 65" type="image" sprite="topEdgedPanelShader">
<!-- Placeholders storing the position for the bars. -->
<object size="96 1 100% 24" name="sectionPosTop" hidden="true"/>
<object size="96 11 100% 34" name="sectionPosMiddle" hidden="true"/>
<object size="96 32 100% 55" name="sectionPosBottom" hidden="true"/>
<object size="96 2 100% 24" name="sectionPosTop" hidden="true"/>
<object size="96 12 100% 34" name="sectionPosMiddle" hidden="true"/>
<object size="96 35 100% 55" name="sectionPosBottom" hidden="true"/>
<!-- Capture bar -->
<object name="captureSection">
@ -78,15 +78,15 @@
</object>
</object>
<object size="0 59 100% 95" type="image" sprite="edgedPanelShader">
<object size="0 63 100% 98" type="image" sprite="edgedPanelShader">
<!-- Attack and Resistance -->
<object size="96 0 128 32" name="attackAndResistanceStats" type="image" sprite="stretched:session/icons/stances/defensive.png" tooltip_style="sessionToolTipInstantly">
<object size="97 0 129 32" name="attackAndResistanceStats" type="image" sprite="stretched:session/icons/stances/defensive.png" tooltip_style="sessionToolTipInstantly">
<translatableAttribute id="tooltip">Attack and Resistance</translatableAttribute>
</object>
<!-- Resource carrying icon/counter -->
<!-- Used also for number of gatherers/builders -->
<object size="100%-96 0 100%-36 32" type="text" name="resourceCarryingText" style="CarryingTextRight"/>
<object size="100%-96 0 100%-33 32" type="text" name="resourceCarryingText" style="CarryingTextRight"/>
<object size="100%-32 0 100% 32" type="image" name="resourceCarryingIcon" tooltip_style="sessionToolTip"/>
</object>

View File

@ -79,7 +79,7 @@
<!-- Limit to the minimal supported width of 1024 pixels. -->
<object size="50%-512 0 50%+512 100%">
<object size="50%-512 100%-200 50%-312 100%">
<object size="50%-512 100%-204 50%-312 100%">
<include file="gui/session/minimap/MiniMap.xml"/>
</object>
@ -95,7 +95,7 @@
<!-- Selection Details Panel (middle). -->
<object name="selectionDetails"
size="50%-114 100%-200 50%+114 100%"
size="50%-114 100%-204 50%+114 100%"
sprite="selectionDetailsPanel"
type="image"
>

View File

@ -110,6 +110,7 @@ else
HOST_PLATFORM="--host=x86_64-apple-darwin"
fi
CFLAGS="$CFLAGS -arch $ARCH"
CXXFLAGS="$CXXFLAGS -arch $ARCH"
@ -811,6 +812,7 @@ GNUTLS_DIR="$(pwd)/gnutls"
HOGWEED_LIBS="-L${NETTLE_DIR}/lib -lhogweed" \
GMP_CFLAGS="-I${GMP_DIR}/include" \
GMP_LIBS="-L${GMP_DIR}/lib -lgmp" \
"$HOST_PLATFORM" \
--prefix="$INSTALL_DIR" \
--enable-shared=no \
--without-idn \
@ -818,8 +820,10 @@ GNUTLS_DIR="$(pwd)/gnutls"
--with-included-libtasn1 \
--without-p11-kit \
--without-brotli \
--without-zstd \
--without-tpm2 \
--disable-libdane \
--disable-tests \
--disable-guile \
--disable-doc \
--disable-tools \
--disable-nls

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
import os.path
#

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python3
# -*- mode: python-mode; python-indent-offset: 4; -*-
#
# Copyright (C) 2023 Wildfire Games.
# Copyright (C) 2024 Wildfire Games.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python3
# -*- mode: python-mode; python-indent-offset: 4; -*-
#
# Copyright (C) 2023 Wildfire Games.
# Copyright (C) 2024 Wildfire Games.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal