File: Script.c

package info (click to toggle)
openclonk 8.1-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 169,520 kB
  • sloc: cpp: 180,479; ansic: 108,988; xml: 31,371; python: 1,223; php: 767; makefile: 145; sh: 101; javascript: 34
file content (69 lines) | stat: -rw-r--r-- 2,911 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
	GUI_ProgressBar
	Provides the interface used by different progress bars.
*/

local Name = "$Name$";
local Description = "$Description$";

// creates a progress bar of the given ID and returns it
global func CreateProgressBar(
	ID /* ID of the progress bar */
	, int max /* maximum value of the progress bar */
	, int current /* starting value of the progress bar */
	, int time_out /* time in frames after which the progress bar closes itself when not receiving updates, might be nil */
	, int owner /* owner of the progress bar */
	, proplist offset /* proplist {x = ?, y = ?} that specifies the offset of the progress bar relative to the calling object */
	, int visibility /* visibility mask for the progress bar, f.e.: VIS_Owner | VIS_Allies */
	, proplist data /* proplist with extra data that is passed to the progress bar */
	)
{
	owner = owner ?? NO_OWNER;
	visibility = visibility ?? VIS_All;
	offset = offset ?? {x = 0, y = 0};
	max = max ?? 100;
	current = current ?? 0;
	data = data ?? {};
	
	if(!ID)
		FatalError("CreateProgressBar called without valid ID");
		
	var obj = CreateObject(ID, AbsX(0), AbsY(0), owner);
	obj->Init(this, max, current, time_out, offset, visibility, data);
	
	return obj;
}

// closes the progress bar and usually removes it
func Close(){return _inherited(...);}

// sets the value of the progress bar, updates the progress bar
func SetValue(int to){return _inherited(to, ...);}

// changes the value of the progress bar by the specified amount, usually calls SetValue
func DoValue(int change){return _inherited(change, ...);}

// changes the offset {x = ?, y = ?}  of the progress bar relative to the attached object (or global)
func SetOffset(proplist offset){return _inherited(offset, ...);}

// makes the progress bar 100% parallax
func SetParallax(){return _inherited(...);}

// sets the Plane property of the progress bar
func SetPlane(int to) {return _inherited(...);}

// makes the object a HUD element by setting parallaxity and the category C4D_StaticBack | C4D_IgnoreFoW | C4D_Foreground | C4D_Parallax
func MakeHUDElement() {return _inherited(...);}

// called once on creation by CreateProgressBar on the new bar
func Init(object to /* object to attach the bar to */
		, int maximum /* maximum value of the progress bar (100%) */
		, int current /* starting value of the progress bar (0 <= current <= maximum*/
		, int timeout /* time in frames after which the progress bar should Close itself when not receiving updates, might be nil */
		, proplist offset /* proplist with properties "x" and "y" that specifies the offset of the bar relative to the target object, the progress bar might provide standard values */
		, proplist data /* proplist with additional data the progress bar can use */
		)
{return _inherited(to, maximum, current, timeout, offset, data, ...);}

// updates the visuals of the progress bar
func Update(){return _inherited(...);}