mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Markers - Add scale slider (#8059)
Co-authored-by: commy2 <commy-2@gmx.de> Co-authored-by: PabstMirror <pabstmirror@gmail.com> Co-authored-by: jonpas <jonpas33@gmail.com>
This commit is contained in:
parent
ae33943973
commit
6843a221ad
@ -169,3 +169,4 @@ xrufix
|
||||
Zakant <Zakant@gmx.de>
|
||||
zGuba
|
||||
Fyuran <dankemedic@hotmail.com>
|
||||
Frank <frankplow@protonmail.com>
|
||||
|
@ -35,5 +35,11 @@ class RscDisplayInsertMarker {
|
||||
class MarkerAngleText: RscText {
|
||||
idc = IDC_ACE_INSERT_MARKER_ANGLE_TEXT;
|
||||
};
|
||||
class MarkerScale: RscXSliderH {
|
||||
idc = IDC_ACE_INSERT_MARKER_SCALE;
|
||||
};
|
||||
class MarkerScaleText: RscText {
|
||||
idc = IDC_ACE_INSERT_MARKER_SCALE_TEXT;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -6,6 +6,7 @@ PREP(onLBSelChangedChannel);
|
||||
PREP(onLBSelChangedColor);
|
||||
PREP(onLBSelChangedShape);
|
||||
PREP(onSliderPosChangedAngle);
|
||||
PREP(onSliderPosChangedScale);
|
||||
PREP(placeMarker);
|
||||
PREP(sendMarkersJIP);
|
||||
PREP(setMarkerJIP);
|
||||
|
@ -15,6 +15,7 @@ if (isMultiplayer && {!isServer} && {hasInterface}) then {
|
||||
GVAR(mapDisplaysWithDrawEHs) = [];
|
||||
GVAR(currentMarkerPosition) = [];
|
||||
GVAR(currentMarkerAngle) = 0;
|
||||
GVAR(currentMarkerScale) = 1;
|
||||
GVAR(currentMarkerColorConfigName) = "";
|
||||
GVAR(currentMarkerConfigName) = "";
|
||||
|
||||
|
@ -45,6 +45,8 @@
|
||||
private _aceColorLB = _display displayctrl IDC_ACE_INSERT_MARKER_COLOR;
|
||||
private _aceAngleSlider = _display displayctrl IDC_ACE_INSERT_MARKER_ANGLE;
|
||||
private _aceAngleSliderText = _display displayctrl IDC_ACE_INSERT_MARKER_ANGLE_TEXT;
|
||||
private _aceScaleSlider = _display displayctrl IDC_ACE_INSERT_MARKER_SCALE;
|
||||
private _aceScaleSliderText = _display displayctrl IDC_ACE_INSERT_MARKER_SCALE_TEXT;
|
||||
|
||||
private _mapDisplay = displayParent _display;
|
||||
if (isNull _mapDisplay) exitWith {ERROR("No Map");};
|
||||
@ -103,7 +105,8 @@
|
||||
private _pos = ctrlposition _text;
|
||||
_pos params ["_posX", "_posY", "_posW", "_posH"];
|
||||
_posX = _posX + 0.01;
|
||||
_posY = _posY min ((safeZoneH + safeZoneY) - (8 * _posH + 8 * BORDER)); //prevent buttons being placed below bottom edge of screen
|
||||
_posY = _posY min ((safeZoneH + safeZoneY) - (11 * _posH + 11 * BORDER)); //prevent buttons being placed below bottom edge of screen
|
||||
|
||||
_pos set [0, _posX];
|
||||
_pos set [1, _posY];
|
||||
_text ctrlSetPosition _pos;
|
||||
@ -118,9 +121,9 @@
|
||||
//--- Description
|
||||
_pos set [1, _posY - 1 * _posH];
|
||||
if (GVAR(timestampEnabled)) then {
|
||||
_pos set [3,7 * _posH + 7 * BORDER];
|
||||
_pos set [3,9 * _posH + 9 * BORDER];
|
||||
} else {
|
||||
_pos set [3,6 * _posH + 6 * BORDER];
|
||||
_pos set [3,10 * _posH + 10 * BORDER];
|
||||
};
|
||||
_description ctrlEnable false;
|
||||
_description ctrlSetPosition _pos;
|
||||
@ -187,16 +190,28 @@
|
||||
_aceAngleSliderText ctrlSetPosition _pos;
|
||||
_aceAngleSliderText ctrlCommit 0;
|
||||
|
||||
//--- Scale
|
||||
_pos set [1, _posY + 5 * _posH + 6 * BORDER + _timestampOffset];
|
||||
_pos set [2, _posW];
|
||||
_aceScaleSlider ctrlSetPosition _pos;
|
||||
_aceScaleSlider ctrlCommit 0;
|
||||
|
||||
//--- Scale Text
|
||||
_pos set [1, _posY + 6 * _posH + 7 * BORDER + _timestampOffset];
|
||||
_pos set [2, _posW];
|
||||
_aceScaleSliderText ctrlSetPosition _pos;
|
||||
_aceScaleSliderText ctrlCommit 0;
|
||||
|
||||
private _offsetButtons = 0;
|
||||
|
||||
if (isMultiplayer) then {
|
||||
_pos set [1,_posY + 5 * _posH + 7 * BORDER + _timestampOffset];
|
||||
_pos set [1,_posY + 7 * _posH + 9 * BORDER + _timestampOffset];
|
||||
_pos set [3,_posH];
|
||||
_descriptionChannel ctrlSetStructuredText parseText format ["<t size='0.8'>%1:</t>", localize "str_a3_cfgvehicles_modulerespawnposition_f_arguments_marker_0"];
|
||||
_descriptionChannel ctrlSetPosition _pos;
|
||||
_descriptionChannel ctrlCommit 0;
|
||||
|
||||
_pos set [1,_posY + 6 * _posH + 7 * BORDER + _timestampOffset];
|
||||
_pos set [1,_posY + 8 * _posH + 9 * BORDER + _timestampOffset];
|
||||
_pos set [3,_posH];
|
||||
_channel ctrlSetPosition _pos;
|
||||
_channel ctrlCommit 0;
|
||||
@ -235,11 +250,11 @@
|
||||
|
||||
_channel ctrlAddEventHandler ["LBSelChanged", {_this call FUNC(onLBSelChangedChannel)}];
|
||||
|
||||
_offsetButtons = 7 * _posH + 8 * BORDER;
|
||||
_offsetButtons = 9 * _posH + 10 * BORDER;
|
||||
} else {
|
||||
_descriptionChannel ctrlShow false;
|
||||
_channel ctrlShow false;
|
||||
_offsetButtons = 5 * _posH + 7 * BORDER;
|
||||
_offsetButtons = 7 * _posH + 9 * BORDER;
|
||||
};
|
||||
|
||||
//--- ButtonOK
|
||||
@ -321,4 +336,20 @@
|
||||
//Update now and add eventHandler:
|
||||
[_aceAngleSlider, _curSelAngle] call FUNC(onSliderPosChangedAngle);
|
||||
_aceAngleSlider ctrlAddEventHandler ["SliderPosChanged", {_this call FUNC(onSliderPosChangedAngle)}];
|
||||
|
||||
////////////////////
|
||||
// init marker scale slider
|
||||
_aceScaleSlider sliderSetRange [0.5, 2.0];
|
||||
|
||||
if !(GVAR(editingMarker) isEqualTo "") then {
|
||||
//get the original scale
|
||||
GVAR(currentMarkerScale) = markerSize GVAR(editingMarker);
|
||||
};
|
||||
|
||||
private _curSelScale = GETGVAR(currentMarkerScale,1);
|
||||
_aceScaleSlider sliderSetPosition _curSelScale;
|
||||
|
||||
//Update now and add eventHandler:
|
||||
[_aceScaleSlider, _curSelScale] call FUNC(onSliderPosChangedScale);
|
||||
_aceScaleSlider ctrlAddEventHandler ["SliderPosChanged", {_this call FUNC(onSliderPosChangedScale)}];
|
||||
}, _this] call CBA_fnc_execNextFrame;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Draws the current temp marker. Allows rotation.
|
||||
* Draws the current temp marker. Allows rotation and scale.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: TheMap <Control>
|
||||
@ -25,8 +25,8 @@ if (GVAR(currentMarkerConfigName) == "" || {GVAR(currentMarkerColorConfigName) =
|
||||
ERROR("Bad Data");
|
||||
};
|
||||
|
||||
private _sizeX = 1;
|
||||
private _sizeY = 1;
|
||||
private _sizeX = GVAR(currentMarkerScale);
|
||||
private _sizeY = GVAR(currentMarkerScale);
|
||||
|
||||
private _textureConfig = configFile >> "CfgMarkers" >> GVAR(currentMarkerConfigName);
|
||||
private _texture = getText (_textureConfig >> "icon");
|
||||
|
28
addons/markers/functions/fnc_onSliderPosChangedScale.sqf
Executable file
28
addons/markers/functions/fnc_onSliderPosChangedScale.sqf
Executable file
@ -0,0 +1,28 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: frankplow
|
||||
* Applies scale from on slider position change.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Slider (idc 1420) <CONTROL>
|
||||
* 1: Slider Data (scale: 0.5...2.0) <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [slider, 1.5] call ace_markers_fnc_onSliderPosChangedScale
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_ctrl", "_data"];
|
||||
TRACE_2("params",_ctrl,_data);
|
||||
|
||||
private _scale = _data * 100;
|
||||
_scale = round _scale;
|
||||
_scale = _scale / 100;
|
||||
|
||||
((ctrlParent _ctrl) displayCtrl IDC_ACE_INSERT_MARKER_SCALE_TEXT) ctrlSetText format [localize LSTRING(MarkerScale), _scale];
|
||||
|
||||
GVAR(currentMarkerScale) = _data;
|
@ -58,7 +58,8 @@ if (_closeNum isEqualTo 1) then {
|
||||
GETGVAR(currentMarkerConfigName,""),
|
||||
GETGVAR(currentMarkerColorConfigName,""),
|
||||
GETGVAR(currentMarkerPosition,[]),
|
||||
GETGVAR(currentMarkerAngle,0)
|
||||
GETGVAR(currentMarkerAngle,0),
|
||||
GETGVAR(currentMarkerScale,1)
|
||||
]
|
||||
]] call CBA_fnc_globalEvent;
|
||||
|
||||
|
@ -25,7 +25,7 @@ TRACE_2("params",_allMapMarkers,_allMapMarkersProperties);
|
||||
|
||||
if (_index != -1) then {
|
||||
private _data = _allMapMarkersProperties select _index;
|
||||
_data params ["_markerClassname", "_colorClassname", "_pos", "_dir"];
|
||||
_data params ["_markerClassname", "_colorClassname", "_pos", "_dir", "_scale"];
|
||||
|
||||
private _config = (configfile >> "CfgMarkers") >> _markerClassname;
|
||||
|
||||
@ -47,6 +47,7 @@ TRACE_2("params",_allMapMarkers,_allMapMarkersProperties);
|
||||
|
||||
_x setMarkerPosLocal _pos;
|
||||
_x setMarkerDirLocal _dir;
|
||||
_x setMarkerSizeLocal _scale;
|
||||
};
|
||||
false
|
||||
} count allMapMarkers;
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
params ["_marker", "_data"];
|
||||
TRACE_2("params",_marker,_data);
|
||||
_data params ["_markerClassname", "_colorClassname", "_pos", "_dir"];
|
||||
_data params ["_markerClassname", "_colorClassname", "_pos", "_dir", "_scale"];
|
||||
|
||||
private _config = configfile >> "CfgMarkers" >> _markerClassname;
|
||||
|
||||
@ -41,6 +41,7 @@ _marker setMarkerColorLocal configName _config;
|
||||
|
||||
_marker setMarkerPosLocal _pos;
|
||||
_marker setMarkerDirLocal _dir;
|
||||
_marker setMarkerSizeLocal [_scale, _scale];
|
||||
|
||||
// save properties on server machine for JIP, marker editing ready
|
||||
if (isMultiplayer && {isServer}) then {
|
||||
|
@ -38,3 +38,5 @@
|
||||
#define IDC_ACE_INSERT_MARKER_COLOR 1221
|
||||
#define IDC_ACE_INSERT_MARKER_ANGLE 1230
|
||||
#define IDC_ACE_INSERT_MARKER_ANGLE_TEXT 1231
|
||||
#define IDC_ACE_INSERT_MARKER_SCALE 1240
|
||||
#define IDC_ACE_INSERT_MARKER_SCALE_TEXT 1241
|
||||
|
@ -1,6 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project name="ACE">
|
||||
<Package name="Markers">
|
||||
<Key ID="STR_ACE_Markers_MarkerScale">
|
||||
<English>Scale: %1</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Markers_MarkerDirection">
|
||||
<English>Direction: %1°</English>
|
||||
<German>Drehung: %1°</German>
|
||||
|
Loading…
Reference in New Issue
Block a user