#ifdef INTERFACE
+void setterDummy(entity, float);
CLASS(Animation, Object)
METHOD(Animation, configureAnimation, void(entity, entity, void(entity, float), float, float, float, float))
METHOD(Animation, setTimeStartEnd, void(entity, float, float))
ATTRIB(Animation, stopped, float, false)
ATTRIB(Animation, finished, float, false)
ENDCLASS(Animation)
-void setterDummy(entity, float);
#endif
#ifdef IMPLEMENTATION
#ifdef INTERFACE
-CLASS(Easing, Animation)
- METHOD(Easing, calcValue, float(entity, float, float, float, float))
- METHOD(Easing, setMath, void(entity, float(float, float, float, float)))
- ATTRIB(Easing, math, float(float, float, float, float), easingLinear)
-ENDCLASS(Easing)
entity makeHostedEasing(entity, void(entity, float), float(float, float, float, float), float, float, float);
entity makeEasing(entity, void(entity, float), float(float, float, float, float), float, float, float, float);
float easingLinear(float, float, float, float);
float easingQuadIn(float, float, float, float);
float easingQuadOut(float, float, float, float);
float easingQuadInOut(float, float, float, float);
+CLASS(Easing, Animation)
+ METHOD(Easing, calcValue, float(entity, float, float, float, float))
+ METHOD(Easing, setMath, void(entity, float(float, float, float, float)))
+ ATTRIB(Easing, math, float(float, float, float, float), easingLinear)
+ENDCLASS(Easing)
#endif
#ifdef IMPLEMENTATION
#define BASE_H
.string classname;
-entity Object_vtbl;
.string vtblname;
.entity vtblbase;
-// THIS LINE INTENTIONALLY LEFT BLANK
-entity spawnVtbl(entity e, entity b)
+entity spawnVtbl(entity this, entity base)
{
- entity v;
- v = spawn();
- copyentity(e, v);
- v.vtblname = v.classname;
- v.classname = "vtbl";
- if(b)
- v.vtblbase = b;
- else
- v.vtblbase = v;
- return v;
+ entity vtbl = spawn();
+ copyentity(this, vtbl);
+ vtbl.vtblname = vtbl.classname;
+ vtbl.classname = "vtbl";
+ vtbl.vtblbase = base ? base : vtbl; // Top level objects use vtbl as base
+ return vtbl;
}
-entity spawnObject()
+
+entity Object_vtbl;
+entity spawnObject(entity this, entity)
{
- entity e;
- e = spawn();
- e.classname = "Object";
- if(!Object_vtbl)
- Object_vtbl = spawnVtbl(e, null_entity);
- return e;
+ this = spawn();
+ this.classname = "Object";
+ if (!Object_vtbl) Object_vtbl = spawnVtbl(this, null_entity);
+ return this;
}
-#define NEW(cname) (spawn##cname())
+#define NEW(cname) (spawn##cname(null_entity, null_entity))
#endif
#undef SUPER
#endif
-// for the constructor
-#define CLASS(cname,base) entity spawn##cname() { entity me = spawn##base (); entity basevtbl; basevtbl = base##_vtbl;
-#define METHOD(cname,name,prototype) me.name = cname##_##name;
-#define ATTRIB(cname,name,type,val) me.name = val;
-#define ATTRIBARRAY(cname,name,type,cnt)
-#define ENDCLASS(cname) me.instanceOf##cname = 1; me.classname = #cname; if(!cname##_vtbl) cname##_vtbl = spawnVtbl(me, basevtbl); return me; }
-
-// for the implementation
+#define CLASS(cname, base)
+#define METHOD(cname, name, prototype)
+#define ATTRIB(cname, name, type, val)
+#define ATTRIBARRAY(cname, name, type, cnt)
+#define ENDCLASS(cname)
#define SUPER(cname) (cname##_vtbl.vtblbase)
#include "../classes.inc"
#undef SUPER
#endif
-#define CLASS(cname,base) entity spawn##cname(); entity cname##_vtbl;
-#define METHOD(cname,name,prototype) prototype cname##_##name; .prototype name;
-#define ATTRIB(cname,name,type,val) .type name;
-#define ATTRIBARRAY(cname,name,type,cnt) .type name[cnt];
-#define ENDCLASS(cname) .float instanceOf##cname;
+#define CLASS(cname, base) \
+[[accumulate]] entity spawn##cname(entity this, entity basevtbl) { \
+ this = NEW(base); basevtbl = base##_vtbl; \
+}
+
+#define METHOD(cname, name, prototype) \
+prototype cname##_##name; \
+.prototype name; \
+[[accumulate]] entity spawn##cname(entity this, entity basevtbl) { \
+ this.name = cname##_##name; \
+}
+
+#define ATTRIB(cname, name, type, val) \
+.type name; \
+[[accumulate]] entity spawn##cname(entity this, entity basevtbl) { \
+ this.name = val; \
+}
+
+#define ATTRIBARRAY(cname, name, type, cnt) \
+.type name[cnt];
+
+#define ENDCLASS(cname) \
+.bool instanceOf##cname; \
+entity cname##_vtbl; \
+[[accumulate]] entity spawn##cname(entity this, entity basevtbl) { \
+ this.instanceOf##cname = true; \
+ this.classname = #cname; \
+ if (!cname##_vtbl) cname##_vtbl = spawnVtbl(this, basevtbl); \
+ return this; \
+}
+
#define SUPER(cname)
#include "../classes.inc"
-#ifdef INTERFACE
+#ifndef DIALOG_FIRSTRUN_H
+#define DIALOG_FIRSTRUN_H
+#include "rootdialog.qc"
CLASS(XonoticFirstRunDialog, XonoticRootDialog)
METHOD(XonoticFirstRunDialog, fill, void(entity)) // to be overridden by user to fill the dialog with controls
ATTRIB(XonoticFirstRunDialog, title, string, _("Welcome"))
-#ifdef INTERFACE
+#ifndef LISTBOX_H
+#define LISTBOX_H
CLASS(XonoticListBox, ListBox)
METHOD(XonoticListBox, configureXonoticListBox, void(entity))
ATTRIB(XonoticListBox, fontSize, float, SKINFONTSIZE_NORMAL)
-#ifdef INTERFACE
+#ifndef PLAYERLIST_H
+#define PLAYERLIST_H
+#include "listbox.qc"
CLASS(XonoticPlayerList, XonoticListBox)
ATTRIB(XonoticPlayerList, rowsPerItem, float, 1)
METHOD(XonoticPlayerList, resizeNotify, void(entity, vector, vector, vector, vector))
-#ifdef INTERFACE
+#ifndef ROOTDIALOG_H
+#define ROOTDIALOG_H
CLASS(XonoticRootDialog, XonoticDialog)
// still to be customized by user
/*
-#ifdef INTERFACE
+#ifndef SLIDER_RESOLUTION_H
+#define SLIDER_RESOLUTION_H
+#include "textslider.qc"
CLASS(XonoticResolutionSlider, XonoticTextSlider)
METHOD(XonoticResolutionSlider, configureXonoticResolutionSlider, void(entity))
METHOD(XonoticResolutionSlider, loadResolutions, void(entity, float))
-#ifdef INTERFACE
+#ifndef TEXTSLIDER_H
+#define TEXTSLIDER_H
CLASS(XonoticTextSlider, TextSlider)
METHOD(XonoticTextSlider, configureXonoticTextSlider, void(entity, string))
METHOD(XonoticTextSlider, setValue, void(entity, float))