[update] Renamed ElementProgramSet to ProgramSet.
This commit is contained in:
parent
52187dae9a
commit
b23971448b
@ -7,7 +7,7 @@ import std.algorithm,
|
|||||||
import sjscript;
|
import sjscript;
|
||||||
|
|
||||||
import sjplayer.ElementInterface,
|
import sjplayer.ElementInterface,
|
||||||
sjplayer.ElementProgramSet,
|
sjplayer.ProgramSet,
|
||||||
sjplayer.ScheduledControllerInterface,
|
sjplayer.ScheduledControllerInterface,
|
||||||
sjplayer.VarStoreInterface;
|
sjplayer.VarStoreInterface;
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ struct Context {
|
|||||||
@disable this(this);
|
@disable this(this);
|
||||||
|
|
||||||
///
|
///
|
||||||
this(ParametersBlock[] params, ElementProgramSet programs) {
|
this(ParametersBlock[] params, ProgramSet programs) {
|
||||||
auto varstore = new BlackHole!VarStoreInterface;
|
auto varstore = new BlackHole!VarStoreInterface;
|
||||||
|
|
||||||
import sjplayer.CircleElementScheduledController;
|
import sjplayer.CircleElementScheduledController;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// License: MIT
|
/// License: MIT
|
||||||
module sjplayer.ElementProgramSet;
|
module sjplayer.ProgramSet;
|
||||||
|
|
||||||
import std.meta,
|
import std.meta,
|
||||||
std.typecons;
|
std.typecons;
|
||||||
@ -7,10 +7,10 @@ import std.meta,
|
|||||||
import sjplayer.CircleElement;
|
import sjplayer.CircleElement;
|
||||||
|
|
||||||
///
|
///
|
||||||
class ElementProgramSet {
|
class ProgramSet {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
alias ElementPrograms = Tuple!(CircleElementProgram);
|
alias Programs = Tuple!(CircleElementProgram);
|
||||||
|
|
||||||
///
|
///
|
||||||
this() {
|
this() {
|
||||||
@ -26,11 +26,11 @@ class ElementProgramSet {
|
|||||||
|
|
||||||
///
|
///
|
||||||
T Get(T)() out (r; r) {
|
T Get(T)() out (r; r) {
|
||||||
enum index = staticIndexOf!(T, ElementPrograms.Types);
|
enum index = staticIndexOf!(T, Programs.Types);
|
||||||
static assert(index >= 0);
|
static assert(index >= 0);
|
||||||
return programs_[index];
|
return programs_[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ElementPrograms programs_;
|
Programs programs_;
|
||||||
}
|
}
|
@ -11,7 +11,7 @@ import std.algorithm,
|
|||||||
import sjscript;
|
import sjscript;
|
||||||
|
|
||||||
import sjplayer.ElementInterface,
|
import sjplayer.ElementInterface,
|
||||||
sjplayer.ElementProgramSet,
|
sjplayer.ProgramSet,
|
||||||
sjplayer.ScheduledControllerInterface,
|
sjplayer.ScheduledControllerInterface,
|
||||||
sjplayer.VarStoreInterface,
|
sjplayer.VarStoreInterface,
|
||||||
sjplayer.util.Period;
|
sjplayer.util.Period;
|
||||||
@ -43,12 +43,12 @@ struct ElementScheduledControllerFactory(ScheduledController, ElementDrawer)
|
|||||||
Parameters!(__traits(getOverloads, ElementDrawer, "__ctor")[0])[0];
|
Parameters!(__traits(getOverloads, ElementDrawer, "__ctor")[0])[0];
|
||||||
|
|
||||||
static assert(staticIndexOf!(
|
static assert(staticIndexOf!(
|
||||||
ElementProgram, ElementProgramSet.ElementPrograms.Types) >= 0);
|
ElementProgram, ProgramSet.Programs.Types) >= 0);
|
||||||
static assert(is(Element[] :
|
static assert(is(Element[] :
|
||||||
Parameters!(__traits(getOverloads, ElementDrawer, "__ctor")[0])[1]));
|
Parameters!(__traits(getOverloads, ElementDrawer, "__ctor")[0])[1]));
|
||||||
|
|
||||||
///
|
///
|
||||||
this(ElementProgramSet programs, VarStoreInterface varstore) {
|
this(ProgramSet programs, VarStoreInterface varstore) {
|
||||||
program_ = programs.Get!ElementProgram;
|
program_ = programs.Get!ElementProgram;
|
||||||
varstore_ = varstore;
|
varstore_ = varstore;
|
||||||
}
|
}
|
||||||
|
@ -5,15 +5,15 @@ import sjscript;
|
|||||||
|
|
||||||
public {
|
public {
|
||||||
import sjplayer.Context,
|
import sjplayer.Context,
|
||||||
sjplayer.ElementProgramSet;
|
sjplayer.ProgramSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
Context CreateContextFromText(string src, ElementProgramSet programs) {
|
Context CreateContextFromText(string src, ProgramSet programs) {
|
||||||
return src.CreateScriptAst().CreateContextFromScriptAst(programs);
|
return src.CreateScriptAst().CreateContextFromScriptAst(programs);
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
Context CreateContextFromScriptAst(
|
Context CreateContextFromScriptAst(
|
||||||
ParametersBlock[] params, ElementProgramSet programs) {
|
ParametersBlock[] params, ProgramSet programs) {
|
||||||
return Context(params, programs);
|
return Context(params, programs);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ int main(string[] args) {
|
|||||||
scope(exit) sfMusic_destroy(music);
|
scope(exit) sfMusic_destroy(music);
|
||||||
sfMusic_play(music);
|
sfMusic_play(music);
|
||||||
|
|
||||||
auto programs = new ElementProgramSet;
|
auto programs = new ProgramSet;
|
||||||
scope(exit) programs.destroy();
|
scope(exit) programs.destroy();
|
||||||
|
|
||||||
auto context = script_file.readText.CreateContextFromText(programs);
|
auto context = script_file.readText.CreateContextFromText(programs);
|
||||||
|
Reference in New Issue
Block a user