<commit_before>#include <stdexcept>

#include <spine/spine.h>
#include <spine/extension.h>

#include <NinjaParty/SpineAnimationPlayer.hpp>
#include <NinjaParty/SpriteBatch.hpp>
#include <NinjaParty/Texture.hpp>
#include <NinjaParty/TextureDictionary.hpp>
#include <NinjaParty/TextureRegion.hpp>

namespace spine
{    
    void _AtlasPage_createTexture(AtlasPage*, const char*)
    {
        throw std::runtime_error("_AtlasPage_createTexture not supported");
    }

    void _AtlasPage_disposeTexture(AtlasPage*)
    {
        throw std::runtime_error("_AtlasPage_disposeTexture not supported");
    }
    
    char* _Util_readFile(const char *path, int *length)
    {
        return _readFile(path, length);
    }
    
    struct TextureRegionAttachment
    {
        RegionAttachment super;
        NinjaParty::TextureRegion textureRegion;
    };
    
    void TextureRegionAttachment_draw(Attachment *attachment, Slot *slot, NinjaParty::SpriteBatch *spriteBatch, const NinjaParty::Color &tintColor, NinjaParty::Texture *texture)
    {
        RegionAttachment *regionAttachment = (RegionAttachment*)attachment;
        TextureRegionAttachment *textureRegionAttachment = (TextureRegionAttachment*)attachment;
        
        float offsetX = (regionAttachment->offset[0] + regionAttachment->offset[4]) / 2;
        float offsetY = (regionAttachment->offset[1] + regionAttachment->offset[5]) / 2;
        
        float m00 = slot->bone->m00;
        float m01 = slot->bone->m01;
        float m11 = slot->bone->m11;
        float m10 = slot->bone->m10;
        
        float x = slot->bone->worldX;
        float y = slot->bone->worldY;
        
        spriteBatch->Draw(texture,
                          textureRegionAttachment->textureRegion,
                          NinjaParty::Vector2(offsetX * m00 + offsetY * m01 + x, offsetX * m10 + offsetY * m11 + y),
                          NinjaParty::Vector2(0.5f, 0.5f),
                          -(slot->bone->worldRotation + regionAttachment->rotation) * 3.14159f / 180.0f,
                          NinjaParty::Color(slot->r * tintColor.R(), slot->g * tintColor.G(), slot->b * tintColor.B(), slot->a * tintColor.A()));
    }

    void TextureRegionAttachment_dispose(Attachment *attachment)
    {
        TextureRegionAttachment *textureRegionAttachment = (TextureRegionAttachment*)attachment;
        _Attachment_deinit(attachment);
        FREE(textureRegionAttachment);
    }
    
    TextureRegionAttachment* TextureRegionAttachment_create(const char *name, NinjaParty::TextureRegion textureRegion)
    {
        TextureRegionAttachment *textureRegionAttachment = NEW(TextureRegionAttachment);
        RegionAttachment *regionAttachment = (RegionAttachment*)textureRegionAttachment;
        Attachment *attachment = (Attachment*)textureRegionAttachment;
        
        textureRegionAttachment->textureRegion = textureRegion;
        
        regionAttachment->scaleX = 1.0f;
        regionAttachment->scaleY = 1.0f;<commit_msg>Fixed scaling in Spine animations.<commit_after>#include <stdexcept>

#include <spine/spine.h>
#include <spine/extension.h>

#include <NinjaParty/SpineAnimationPlayer.hpp>
#include <NinjaParty/SpriteBatch.hpp>
#include <NinjaParty/Texture.hpp>
#include <NinjaParty/TextureDictionary.hpp>
#include <NinjaParty/TextureRegion.hpp>

namespace spine
{    
    void _AtlasPage_createTexture(AtlasPage*, const char*)
    {
        throw std::runtime_error("_AtlasPage_createTexture not supported");
    }

    void _AtlasPage_disposeTexture(AtlasPage*)
    {
        throw std::runtime_error("_AtlasPage_disposeTexture not supported");
    }
    
    char* _Util_readFile(const char *path, int *length)
    {
        return _readFile(path, length);
    }
    
    struct TextureRegionAttachment
    {
        RegionAttachment super;
        NinjaParty::TextureRegion textureRegion;
    };
    
    void TextureRegionAttachment_draw(Attachment *attachment, Slot *slot, NinjaParty::SpriteBatch *spriteBatch, const NinjaParty::Color &tintColor, NinjaParty::Texture *texture)
    {
        RegionAttachment *regionAttachment = (RegionAttachment*)attachment;
        TextureRegionAttachment *textureRegionAttachment = (TextureRegionAttachment*)attachment;
        
        float offsetX = (regionAttachment->offset[0] + regionAttachment->offset[4]) / 2;
        float offsetY = (regionAttachment->offset[1] + regionAttachment->offset[5]) / 2;
        
        float m00 = slot->bone->m00;
        float m01 = slot->bone->m01;
        float m11 = slot->bone->m11;
        float m10 = slot->bone->m10;
        
        float x = slot->bone->worldX;
        float y = slot->bone->worldY;
        
        spriteBatch->Draw(texture,
                          textureRegionAttachment->textureRegion,
                          NinjaParty::Vector2(offsetX * m00 + offsetY * m01 + x, offsetX * m10 + offsetY * m11 + y),
                          NinjaParty::Vector2(0.5f, 0.5f),
                          -(slot->bone->worldRotation + regionAttachment->rotation) * 3.14159f / 180.0f,
                          NinjaParty::Color(slot->r * tintColor.R(), slot->g * tintColor.G(), slot->b * tintColor.B(), slot->a * tintColor.A()),
						  NinjaParty::Vector2(slot->bone->scaleX, slot->bone->scaleY));
    }

    void TextureRegionAttachment_dispose(Attachment *attachment)
    {
        TextureRegionAttachment *textureRegionAttachment = (TextureRegionAttachment*)attachment;
        _Attachment_deinit(attachment);
        FREE(textureRegionAttachment);
    }
    
    TextureRegionAttachment* TextureRegionAttachment_create(const char *name, NinjaParty::TextureRegion textureRegion)
    {
        TextureRegionAttachment *textureRegionAttachment = NEW(TextureRegionAttachment);
        RegionAttachment *regionAttachment = (RegionAttachment*)textureRegionAttachment;
        Attachment *attachment = (Attachment*)textureRegionAttachment;
        
        textureRegionAttachment->textureRegion = textureRegion;
        
        regionAttachment->scaleX = 1.0f;
        regionAttachment->scaleY = 1.0f;
{'fraction_non_alphanumeric': 0.10622529644268774, 'fraction_numerical': 0.016633728590250328, 'mean_word_length': 3.0165343915343916, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 79, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6801971', 'n_tokens_mistral': 1777, 'n_tokens_neox': 1747, 'n_words': 301}