diff --git a/api/Object.cpp b/api/Object.cpp index dda4fba..de8f7cb 100644 --- a/api/Object.cpp +++ b/api/Object.cpp @@ -272,7 +272,7 @@ extern "C" if (data) { - IPlayerObject* object = data->get(id) + IPlayerObject* object = data->get(id); if (object) { diff --git a/api/TextLabel.cpp b/api/TextLabel.cpp index eb3a2cc..bb80831 100644 --- a/api/TextLabel.cpp +++ b/api/TextLabel.cpp @@ -9,13 +9,13 @@ extern "C" { #endif - GOMPONENT_EXPORT void* textLabel_create(String text, uint32_t colour, float posX, float posY, float posZ, float drawDist, int vw, unsigned char los) + GOMPONENT_EXPORT void* textLabel_create(String text, uint32_t colour, float posX, float posY, float posZ, float drawDistance, int vw, unsigned char los) { ITextLabelsComponent* textlabels = Gomponent::Get()->textlabels; if (textlabels) { - ITextLabel* textlabel = textlabels->create(StringView(text.buf, text.length), Colour::FromRGBA(colour), Vector3(posX, posY, posZ), drawDist, vw, los != 0); + ITextLabel* textlabel = textlabels->create(StringView(text.buf, text.length), Colour::FromRGBA(colour), Vector3(posX, posY, posZ), drawDistance, vw, los != 0); if (textlabel) { @@ -130,6 +130,124 @@ extern "C" return static_cast(textLabel)->getVirtualWorld(); } + // PlayerTextLabel + + GOMPONENT_EXPORT void* playerTextLabel_create(void* player, String text, uint32_t colour, float posX, float posY, float posZ, float drawDistance, unsigned char los) + { + IPlayerTextLabelData* data = queryExtension(static_cast(player)); + + if (data) + { + IPlayerTextLabel* textlabel = data->create(StringView(text.buf, text.length), Colour::FromRGBA(colour), Vector3(posX, posY, posZ), drawDistance, los != 0); + + if (textlabel) + { + return static_cast(textlabel); + } + } + + return NULL; + } + + GOMPONENT_EXPORT void playerTextLabel_release(void* textLabel, void* player) + { + IPlayerTextLabelData* data = queryExtension(static_cast(player)); + + if (data) + { + data->release(static_cast(textLabel)->getID()); + } + } + + GOMPONENT_EXPORT void playerTextLabel_setText(void* textLabel, String text) + { + static_cast(textLabel)->setText(StringView(text.buf, text.length)); + } + + GOMPONENT_EXPORT String playerTextLabel_getText(void* textLabel) + { + StringView textView = static_cast(textLabel)->getText(); + + return { textView.data(), textView.length() }; + } + + GOMPONENT_EXPORT void playerTextLabel_setColour(void* textLabel, uint32_t colour) + { + static_cast(textLabel)->setColour(Colour::FromRGBA(colour)); + } + + GOMPONENT_EXPORT uint32_t playerTextLabel_getColour(void* textLabel) + { + return static_cast(textLabel)->getColour().RGBA(); + } + + GOMPONENT_EXPORT void playerTextLabel_setDrawDistance(void* textLabel, float drawDist) + { + static_cast(textLabel)->setDrawDistance(drawDist); + } + + GOMPONENT_EXPORT float playerTextLabel_getDrawDistance(void* textLabel) + { + return static_cast(textLabel)->getDrawDistance(); + } + + GOMPONENT_EXPORT void playerTextLabel_attachToPlayer(void* textLabel, void* player, float offsetX, float offsetY, float offsetZ) + { + static_cast(textLabel)->attachToPlayer(*static_cast(player), Vector3(offsetX, offsetY, offsetZ)); + } + + GOMPONENT_EXPORT void playerTextLabel_attachToVehicle(void* textLabel, void* vehicle, float offsetX, float offsetY, float offsetZ) + { + static_cast(textLabel)->attachToVehicle(*static_cast(vehicle), Vector3(offsetX, offsetY, offsetZ)); + } + + GOMPONENT_EXPORT TextLabelAttachmentData playerTextLabel_getAttachmentData(void* textLabel) + { + return static_cast(textLabel)->getAttachmentData(); + } + + GOMPONENT_EXPORT void playerTextLabel_detachFromPlayer(void* textLabel, float posX, float posY, float posZ) + { + static_cast(textLabel)->detachFromPlayer(Vector3(posX, posY, posZ)); + } + + GOMPONENT_EXPORT void playerTextLabel_detachFromVehicle(void* textLabel, float posX, float posY, float posZ) + { + static_cast(textLabel)->detachFromVehicle(Vector3(posX, posY, posZ)); + } + + GOMPONENT_EXPORT void playerTextLabel_setTestLOS(void* textLabel, unsigned char status) + { + static_cast(textLabel)->setTestLOS(status != 0); + } + + GOMPONENT_EXPORT unsigned char playerTextLabel_getTestLOS(void* textLabel) + { + return static_cast(textLabel)->getTestLOS() ? 1 : 0; + } + + // entity + + GOMPONENT_EXPORT void playerTextLabel_setPosition(void* textLabel, float posX, float posY, float posZ) + { + static_cast(textLabel)->setPosition(Vector3(posX, posY, posZ)); + } + + GOMPONENT_EXPORT Vector3 playerTextLabel_getPosition(void* textLabel) + { + return static_cast(textLabel)->getPosition(); + } + + GOMPONENT_EXPORT void playerTextLabel_setVirtualWorld(void* textLabel, int vw) + { + static_cast(textLabel)->setVirtualWorld(vw); + } + + GOMPONENT_EXPORT int playerTextLabel_getVirtualWorld(void* textLabel) + { + return static_cast(textLabel)->getVirtualWorld(); + } + #ifdef __cplusplus } #endif