/* Copyright (c) 2022 Alex Diener This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Alex Diener alex@ludobloom.com */ #ifndef __UIDrawingInterface2DMultitexture_H__ #define __UIDrawingInterface2DMultitexture_H__ #ifdef __cplusplus extern "C" { #endif typedef struct UIDrawingInterface2DMultitexture UIDrawingInterface2DMultitexture; #define UIDrawingInterface2DMultitexture_superclass UIDrawingInterface #include "uitoolkit/UIDrawingInterface.h" #include "uitoolkit/UITypeface.h" #include "utilities/HashTable.h" #define UIDrawingInterface2DMultitexture_ivars \ UIDrawingInterface_ivars \ \ unsigned int uiTextureIndex; \ HashTable * typefaceTable; #define UIDrawingInterface2DMultitexture_vtable(self_type) \ UIDrawingInterface_vtable(self_type) stemobject_declare(UIDrawingInterface2DMultitexture) // Use for vertex formats compatible with p2f_t2f_c4f_i1f // All geometry drawn with with virtual functions of this object will use the specified uiTextureIndex. // To use other textures, write to VertexIO directly instead. UIDrawingInterface2DMultitexture * UIDrawingInterface2DMultitexture_create(unsigned int uiTextureIndex); bool UIDrawingInterface2DMultitexture_init(UIDrawingInterface2DMultitexture * self, unsigned int uiTextureIndex); void UIDrawingInterface2DMultitexture_dispose(UIDrawingInterface2DMultitexture * self); // Specific typefaces can reside at different texture indexes. Registering a typeface will cause the specified // index to be used instead of uiTextureIndex when using it with drawString or drawTextLayout. void UIDrawingInterface2DMultitexture_registerTypeface(UIDrawingInterface2DMultitexture * self, compat_type(UITypeface *) typeface, int textureIndex); void UIDrawingInterface2DMultitexture_unregisterTypeface(UIDrawingInterface2DMultitexture * self, compat_type(UITypeface *) typeface); void UIDrawingInterface2DMultitexture_drawQuad(UIDrawingInterface2DMultitexture * self, Rect4f vertexBounds, Rect4f textureBounds, Color4f color, VertexIO * vertexIO); void UIDrawingInterface2DMultitexture_drawQuadWithTransform(UIDrawingInterface2DMultitexture * self, Rect4f vertexBounds, Rect4f textureBounds, quadTransformBits transformBits, Color4f color, VertexIO * vertexIO); void UIDrawingInterface2DMultitexture_drawQuadWithSeparateColors(UIDrawingInterface2DMultitexture * self, Rect4f vertexBounds, Rect4f textureBounds, Color4f colorBottomLeft, Color4f colorBottomRight, Color4f colorTopLeft, Color4f colorTopRight, VertexIO * vertexIO); void UIDrawingInterface2DMultitexture_drawSlicedQuad3x3(UIDrawingInterface2DMultitexture * self, Rect4f vertexBounds, Rect4f textureBounds, UISliceGrid3x3 slices, Color4f color, VertexIO * vertexIO); void UIDrawingInterface2DMultitexture_drawSlicedQuad3x1(UIDrawingInterface2DMultitexture * self, Rect4f vertexBounds, Rect4f textureBounds, UISliceGrid3x1 slices, Color4f color, VertexIO * vertexIO); void UIDrawingInterface2DMultitexture_drawSlicedQuad1x3(UIDrawingInterface2DMultitexture * self, Rect4f vertexBounds, Rect4f textureBounds, UISliceGrid1x3 slices, Color4f color, VertexIO * vertexIO); void UIDrawingInterface2DMultitexture_drawSlicedQuad3x3WithAlternatingRowColors(UIDrawingInterface2DMultitexture * self, Rect4f vertexBounds, Rect4f textureBounds, UISliceGrid3x3 slices, float inset, float rowHeight, Color4f evenColor, Color4f oddColor, VertexIO * vertexIO); void UIDrawingInterface2DMultitexture_drawIndexedVertices_p2f_t2f_c4f(UIDrawingInterface2DMultitexture * self, unsigned int vertexCount, const struct vertex_p2f_t2f_c4f * vertices, unsigned int indexCount, const uint32_t * indexes, VertexIO * vertexIO); void UIDrawingInterface2DMultitexture_drawString(UIDrawingInterface2DMultitexture * self, compat_type(UITypeface *) typeface, String string, Vector2f offset, Vector2f relativeOrigin, float textScale, Color4f color, VertexIO * vertexIO); void UIDrawingInterface2DMultitexture_drawTextLayout(UIDrawingInterface2DMultitexture * self, compat_type(UITextLayout *) textLayout, Vector2f offset, Vector2f relativeOrigin, float textScale, Color4f color, VertexIO * vertexIO); #ifdef __cplusplus } #endif #endif