|
@@ -33,6 +33,18 @@ void* myget_Stats(void* unused, void* unused1){
|
|
return &Stats;
|
|
return &Stats;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+int INV_ShowMyStats(laOperator* a, laEvent* e){
|
|
|
|
+ My* stats=a->This?a->This->EndInstance:0;
|
|
|
|
+ if(!stats){
|
|
|
|
+ printf("Operator not invoked from property.\n");
|
|
|
|
+ return LA_FINISHED;
|
|
|
|
+ }
|
|
|
|
+ char* name=(stats->Name&&stats->Name->Ptr)?stats->Name->Ptr:"";
|
|
|
|
+ printf("Hi! My name is %s and I'm %d years old :D\n",name,stats->Age);
|
|
|
|
+ logPrint("Hi! My name is %s and I'm %d years old :D\n",name,stats->Age);
|
|
|
|
+ return LA_FINISHED;
|
|
|
|
+}
|
|
|
|
+
|
|
void MyProperties(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
|
|
void MyProperties(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
|
|
laColumn* c=laFirstColumn(uil);
|
|
laColumn* c=laFirstColumn(uil);
|
|
laShowLabel(uil,c,"Hello world!",0,0);
|
|
laShowLabel(uil,c,"Hello world!",0,0);
|
|
@@ -40,6 +52,11 @@ void MyProperties(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, la
|
|
laShowItem(uil,c,0,"me.age");
|
|
laShowItem(uil,c,0,"me.age");
|
|
laShowItem(uil,c,0,"me.height");
|
|
laShowItem(uil,c,0,"me.height");
|
|
laShowItem(uil,c,0,"me.gender");
|
|
laShowItem(uil,c,0,"me.gender");
|
|
|
|
+ laShowLabel(uil,c," ",0,0);
|
|
|
|
+
|
|
|
|
+ laUiItem* collection=laShowItem(uil,c,0,"me");
|
|
|
|
+ laShowItem(uil,c,&collection->PP,"show");
|
|
|
|
+ laShowItem(uil,c,0,"MY_show_my_stats");
|
|
}
|
|
}
|
|
|
|
|
|
int main(int argc, char *argv[]){
|
|
int main(int argc, char *argv[]){
|
|
@@ -50,6 +67,8 @@ int main(int argc, char *argv[]){
|
|
Stats.Height=1.76;
|
|
Stats.Height=1.76;
|
|
strSafeSet(&Stats.Name,"ChengduLittleA");
|
|
strSafeSet(&Stats.Name,"ChengduLittleA");
|
|
|
|
|
|
|
|
+ laCreateOperatorType("MY_show_my_stats", "Show Stats!", "Shoy my stats!",0,0,0,INV_ShowMyStats,0,0,0);
|
|
|
|
+
|
|
laPropContainer* root=laDefineRoot();
|
|
laPropContainer* root=laDefineRoot();
|
|
laAddSubGroup(root,"me","Me","Me root", "my", 0,0,0,0,myget_Stats,0,0,0,0,0,0,0);
|
|
laAddSubGroup(root,"me","Me","Me root", "my", 0,0,0,0,myget_Stats,0,0,0,0,0,0,0);
|
|
|
|
|
|
@@ -60,6 +79,7 @@ int main(int argc, char *argv[]){
|
|
laProp* ep=laAddEnumProperty(my, "gender","Gender","My gender",0,0,0,0,0,offsetof(My,Gender),0,0,0,0,0,0,0,0,0,0);
|
|
laProp* ep=laAddEnumProperty(my, "gender","Gender","My gender",0,0,0,0,0,offsetof(My,Gender),0,0,0,0,0,0,0,0,0,0);
|
|
laAddEnumItemAs(ep,"MALE","Male","Gender being male",0,L'♂');
|
|
laAddEnumItemAs(ep,"MALE","Male","Gender being male",0,L'♂');
|
|
laAddEnumItemAs(ep,"FEMALE","female","Gender being female",1,L'♀');
|
|
laAddEnumItemAs(ep,"FEMALE","female","Gender being female",1,L'♀');
|
|
|
|
+ laAddOperatorProperty(my, "show", "Show Stats with *This","Show stats called from \"my\" container","MY_show_my_stats",0,0);
|
|
|
|
|
|
laRegisterUiTemplate("my_properties","Properties", MyProperties,0,0,"Demonstration", 0,0,0);
|
|
laRegisterUiTemplate("my_properties","Properties", MyProperties,0,0,"Demonstration", 0,0,0);
|
|
|
|
|