Skip to content

Instantly share code, notes, and snippets.

@BaerMitUmlaut
Created October 19, 2016 21:27
Show Gist options
  • Save BaerMitUmlaut/f86d188c424a2cb60ced1e2b6796c32e to your computer and use it in GitHub Desktop.
Save BaerMitUmlaut/f86d188c424a2cb60ced1e2b6796c32e to your computer and use it in GitHub Desktop.
Soil icon drawing test
/*
* Author: BaerMitUmlaut
* Adds 2D and 3D UI drawing.
*
* Arguments:
* 0: Eden Display <DISPLAY>
*
* Return Value:
* None
*/
#include "script_component.hpp"
params ["_display"];
private _labels = [];
for "_i" from 1 to 1000 do {
private _label = _display ctrlCreate [QRSC(ObjectiveLabel), -1];
_label setVariable [QGVAR(pos), [worldSize / 2, worldSize / 2, 100] getPos [random 1000, random 360]];
_labels pushBack _label;
};
uiNamespace setVariable [QGVAR(labels), _labels];
GVAR(drawEH) = addMissionEventHandler ["Draw3D", {
{
private _label = _x;
private _pos = _label getVariable [QGVAR(pos), [0, 0, 0]];
private _screenPos = worldToScreen _pos;
if !(_screenPos isEqualTo []) then {
_label ctrlShow true;
_label ctrlSetPosition _screenPos;
_label ctrlCommit 0;
} else {
_label ctrlShow false;
};
} forEach (uiNamespace getVariable [QGVAR(labels), []]);
}];
RETURN;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment