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