1 /**
2 Interactive Resource Loader.
3 
4 Copyright:
5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.  
6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)  
7 Copyright (c) 2017-2018 Godot-D contributors  
8 
9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License)
10 
11 
12 */
13 module godot.resourceinteractiveloader;
14 import std.meta : AliasSeq, staticIndexOf;
15 import std.traits : Unqual;
16 import godot.d.meta;
17 import godot.core;
18 import godot.c;
19 import godot.d.bind;
20 import godot.d.reference;
21 import godot.object;
22 import godot.reference;
23 import godot.resource;
24 /**
25 Interactive Resource Loader.
26 
27 This object is returned by ResourceLoader when performing an interactive load. It allows to load with high granularity, so this is mainly useful for displaying load bars/percentages.
28 */
29 @GodotBaseClass struct ResourceInteractiveLoader
30 {
31 	enum string _GODOT_internal_name = "ResourceInteractiveLoader";
32 public:
33 @nogc nothrow:
34 	union { godot_object _godot_object; Reference _GODOT_base; }
35 	alias _GODOT_base this;
36 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
37 	package(godot) __gshared bool _classBindingInitialized = false;
38 	package(godot) static struct _classBinding
39 	{
40 		__gshared:
41 		@GodotName("get_resource") GodotMethod!(Resource) getResource;
42 		@GodotName("poll") GodotMethod!(GodotError) poll;
43 		@GodotName("wait") GodotMethod!(GodotError) wait;
44 		@GodotName("get_stage") GodotMethod!(long) getStage;
45 		@GodotName("get_stage_count") GodotMethod!(long) getStageCount;
46 	}
47 	bool opEquals(in ResourceInteractiveLoader other) const { return _godot_object.ptr is other._godot_object.ptr; }
48 	ResourceInteractiveLoader opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
49 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
50 	mixin baseCasts;
51 	static ResourceInteractiveLoader _new()
52 	{
53 		static godot_class_constructor constructor;
54 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("ResourceInteractiveLoader");
55 		if(constructor is null) return typeof(this).init;
56 		return cast(ResourceInteractiveLoader)(constructor());
57 	}
58 	@disable new(size_t s);
59 	/**
60 	Return the loaded resource (only if loaded). Otherwise, returns null.
61 	*/
62 	Ref!Resource getResource()
63 	{
64 		checkClassBinding!(typeof(this))();
65 		return ptrcall!(Resource)(_classBinding.getResource, _godot_object);
66 	}
67 	/**
68 	Poll the load. If OK is returned, this means poll will have to be called again. If ERR_FILE_EOF is returned, them the load has finished and the resource can be obtained by calling $(D getResource).
69 	*/
70 	GodotError poll()
71 	{
72 		checkClassBinding!(typeof(this))();
73 		return ptrcall!(GodotError)(_classBinding.poll, _godot_object);
74 	}
75 	/**
76 	
77 	*/
78 	GodotError wait()
79 	{
80 		checkClassBinding!(typeof(this))();
81 		return ptrcall!(GodotError)(_classBinding.wait, _godot_object);
82 	}
83 	/**
84 	Return the load stage. The total amount of stages can be queried with $(D getStageCount)
85 	*/
86 	long getStage() const
87 	{
88 		checkClassBinding!(typeof(this))();
89 		return ptrcall!(long)(_classBinding.getStage, _godot_object);
90 	}
91 	/**
92 	Return the total amount of stages (calls to $(D poll)) needed to completely load this resource.
93 	*/
94 	long getStageCount() const
95 	{
96 		checkClassBinding!(typeof(this))();
97 		return ptrcall!(long)(_classBinding.getStageCount, _godot_object);
98 	}
99 }