mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
Make some corrections, and document more things
Change "class" on intrinsic types to "struct" because they are not objects, and they cannot be used in arrays. Document IsAbstract() method. Document Font casts.
This commit is contained in:
parent
70e26f5d30
commit
ef776d14ce
1 changed files with 16 additions and 8 deletions
|
@ -146,23 +146,29 @@ enum EPrintLevel
|
|||
/*
|
||||
// These are here to document the intrinsic methods and fields available on
|
||||
// the built-in ZScript types
|
||||
class Vector2
|
||||
struct Vector2
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
native double Length();
|
||||
native Vector2 Unit();
|
||||
// The dot product of two vectors can be calculated like this:
|
||||
// double d = a dot b;
|
||||
}
|
||||
|
||||
class Vector3 : Vector2
|
||||
struct Vector3 : Vector2
|
||||
{
|
||||
double z;
|
||||
Vector2 xy;
|
||||
native double Length();
|
||||
native Vector3 Unit();
|
||||
// The dot product of two vectors can be calculated like this:
|
||||
// double d = a dot b;
|
||||
// The cross product of two vectors can be calculated like this:
|
||||
// Vector3 d = a cross b;
|
||||
}
|
||||
|
||||
class Array<T>
|
||||
struct Array<T>
|
||||
{
|
||||
native int Size();
|
||||
}
|
||||
|
@ -308,7 +314,7 @@ struct TextureID
|
|||
|
||||
// 32-bit RGBA color - each component is one byte, or 8-bit
|
||||
// This isn't really a class, and can be used as an integer
|
||||
class Color
|
||||
struct Color
|
||||
{
|
||||
// Constructor - alpha channel is optional
|
||||
Color(int alpha, int red, int green, int blue);
|
||||
|
@ -320,7 +326,7 @@ class Color
|
|||
}
|
||||
|
||||
// Name - a string with an integer ID
|
||||
class Name
|
||||
struct Name
|
||||
{
|
||||
Name(Name name);
|
||||
Name(String name);
|
||||
|
@ -328,7 +334,7 @@ class Name
|
|||
|
||||
// Sound ID - can be created by casting from a string (name from SNDINFO) or an
|
||||
// integer (sound ID as integer).
|
||||
class Sound
|
||||
struct Sound
|
||||
{
|
||||
Sound(String soundName);
|
||||
Sound(int id);
|
||||
|
@ -570,7 +576,8 @@ struct Font native
|
|||
|
||||
const TEXTCOLOR_CHAT = "\034*";
|
||||
const TEXTCOLOR_TEAMCHAT = "\034!";
|
||||
|
||||
// native Font(const String name); // String/name to font casts
|
||||
// native Font(const Name name);
|
||||
|
||||
native int GetCharWidth(int code);
|
||||
native int StringWidth(String code);
|
||||
|
@ -663,6 +670,7 @@ class Object native
|
|||
virtual virtualscope void OnDestroy() {}
|
||||
//
|
||||
//
|
||||
// clearscope bool IsAbstract(); // Intrinsic - Query whether or not the class is abstract
|
||||
// clearscope Object GetParentClass(); // Intrinsic - Get the parent class of this object
|
||||
// clearscope Name GetClassName(); // Intrinsic - Get the name of this object's class
|
||||
// clearscope Class<Object> GetClass(); // Intrinsic - Get the object's class
|
||||
|
@ -774,7 +782,7 @@ enum EmptyTokenType
|
|||
}
|
||||
|
||||
// Although String is a builtin type, this is a convenient way to attach methods to it.
|
||||
// All of these methods, except for the static ones, are available on instances of String
|
||||
// All of these methods are available on strings
|
||||
struct StringStruct native
|
||||
{
|
||||
native static vararg String Format(String fmt, ...);
|
||||
|
|
Loading…
Reference in a new issue