Rope: Add SetFront() and SetBack() functions

rope
Armin Burgmeier 2012-05-05 22:52:23 +02:00
parent 76dfb050e4
commit 012507805f
2 changed files with 17 additions and 1 deletions

View File

@ -79,7 +79,9 @@ public:
C4RopeElement* GetFront() const { return Front; }
C4RopeElement* GetBack() const { return Back; }
void SetFront(C4Object* obj, C4Real x, C4Real y) { Front->Object = obj; Front->x = x; Front->y = y; }
void SetBack(C4Object* obj, C4Real x, C4Real y) { Back->Object = obj; Back->x = x; Back->y = y; }
C4Real GetFrontAutoSegmentation() const { return FrontAutoSegmentation; }
C4Real GetBackAutoSegmentation() const { return BackAutoSegmentation; }
void SetFrontAutoSegmentation(C4Real max) { FrontAutoSegmentation = max; }

View File

@ -34,6 +34,18 @@ static C4Object* FnGetBack(C4AulContext* Context)
return static_cast<C4Rope*>(Context->Def)->GetBack()->GetObject();
}
static C4Void FnSetFront(C4AulContext* Context, C4Object* obj, Nillable<int> x, Nillable<int> y)
{
static_cast<C4Rope*>(Context->Def)->SetFront(obj, x.IsNil() ? Fix0 : itofix(x), y.IsNil() ? Fix0 : itofix(y));
return C4Void();
}
static C4Void FnSetBack(C4AulContext* Context, C4Object* obj, Nillable<int> x, Nillable<int> y)
{
static_cast<C4Rope*>(Context->Def)->SetBack(obj, x.IsNil() ? Fix0 : itofix(x), y.IsNil() ? Fix0 : itofix(y));
return C4Void();
}
static C4Void FnSetFrontAutoSegmentation(C4AulContext* Context, int max)
{
static_cast<C4Rope*>(Context->Def)->SetFrontAutoSegmentation(itofix(max));
@ -79,6 +91,8 @@ void C4RopeAul::InitFunctionMap(C4AulScriptEngine* pEngine)
::AddFunc(this, "Remove", FnRemove);
::AddFunc(this, "GetFront", FnGetFront);
::AddFunc(this, "GetBack", FnGetBack);
::AddFunc(this, "SetFront", FnSetFront);
::AddFunc(this, "SetBack", FnSetBack);
::AddFunc(this, "SetFrontAutoSegmentation", FnSetFrontAutoSegmentation);
::AddFunc(this, "SetBackAutoSegmentation", FnSetBackAutoSegmentation);
::AddFunc(this, "SetFrontFixed", FnSetFrontFixed);