Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void (*ori__cocos2d2ui4Text_generic)(void *, std::string) = nullptr;
- void cocos2d2ui4Text_generic(void *self, std::string string) {
- if (Debug == true) { UD_LOGI("cocos2d2ui4Text_generic : called"); }
- auto Description = getDescription(self);
- if (Debug == true) { UD_LOGI("cocos2d2ui4Text_generic : %s", Description.c_str()); }
- if (Description != "TextBMFont") {
- auto labelRenderer = getVirtualRenderer(self);
- if (Debug == true) { UD_LOGI("cocos2d2ui4Text_generic : getKerning"); }
- static float OldKerning = getKerning(labelRenderer);
- if (Debug == true) { UD_LOGI("cocos2d2ui4Text_generic : %f", OldKerning); }
- if (Debug == true) { UD_LOGI("cocos2d2ui4Text_generic : setKerning"); }
- static float NewKerning = OldKerning/2;
- setKerning(labelRenderer, NewKerning);
- if (Debug == true) { UD_LOGI("cocos2d2ui4Text_generic : %f", NewKerning); }
- if (Debug == true) { UD_LOGI("cocos2d2ui4Text_generic : Finishing !"); }
- } else {
- auto labelRenderer = getVirtualRenderer(self);
- if (Debug == true) { UD_LOGI("cocos2d2ui4Text_generic : TextBMFont : getKerning"); }
- static float OldKerning = getKerning(labelRenderer);
- if (Debug == true) { UD_LOGI("cocos2d2ui4Text_generic : TextBMFont : %f", OldKerning); }
- if (OldKerning != BMKerning) {
- static float NewKerning = OldKerning/4;
- setKerning(labelRenderer, NewKerning);
- if (Debug == true) { UD_LOGI("cocos2d2ui4Text_generic : TextBMFont : %f", NewKerning); }
- }
- ori__cocos2d2ui4Text_generic(self, string);
- }
- }
- void (*ori__setBMFontSize_generic)(void *, const std::string &, const ud_cocos2d::Vec2 &, float) = nullptr;
- void setBMFontSize_generic(void *self, const std::string &fntfile, const ud_cocos2d::Vec2 &unk, float unk2) {
- if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : called"); }
- ori__setBMFontSize_generic(self,fntfile,unk,unk2);
- if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : getDescription"); }
- auto Description = getDescription(self);
- if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : %s", Description.c_str()); }
- if (Description == "TextBMFont") {
- if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : Thie is a TextBMFont let continue !"); }
- if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : %s", fntfile.c_str()); }
- if (fntfile == "fonts/ja/custom/btn_normal/btn_normal.fnt") {
- if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : Thie is a btn_normal let continue !"); }
- if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : getVirtualRendererBM"); }
- auto labelRendererBM = getVirtualRendererBM(self);
- if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : getBMFontSize"); }
- static float Font_size = getBMFontSize(labelRendererBM);
- if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : Calculate new Fontsize"); }
- static float FontSizeBmFont = (Font_size*100)/115;
- if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : setBMFontSize"); }
- setFontSizeBmFont(labelRendererBM, FontSizeBmFont);
- if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : setLineBreakNoSpace"); }
- setLineBreakNoSpace(labelRendererBM, true);
- float LineSpacing = (Font_size * 1.8) - FontSizeBmFont;
- if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : setLineSpacing"); }
- setLineSpacing(labelRendererBM, -10.0f);
- if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : setLineHeight"); }
- float LineHeight = FontSizeBmFont * 2.6;
- setLineHeight(labelRendererBM, LineHeight);
- if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : setKerning"); }
- setKerning(labelRendererBM, BMKerning);
- if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : Finishing [btn_normal]!"); }
- } else {
- if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : Thie is not a btn_normal !"); }
- }
- } else {
- if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : Thie is not a TextBMFont!"); }
- }
- }
- void (*ori__setAdditionalKerning_generic)(void *, float) = nullptr;
- void setAdditionalKerning_generic(void *self, float passed_kerning) {
- UD_LOGI("setAdditionalKerning_generic : called");
- UD_LOGI("setAdditionalKerning_generic : size is : %f", passed_kerning);
- UD_LOGI("setAdditionalKerning_generic : BMKerning is: %f", BMKerning);
- if (passed_kerning != BMKerning) {
- passed_kerning = 100.0f;
- }
- UD_LOGI("setAdditionalKerning_generic : newvalue is : %f", passed_kerning);
- ori__setAdditionalKerning_generic(self, passed_kerning);
- }
- void (*ori__setLineSpacing_generic)(void *, float) = nullptr;
- void setLineSpacing_generic(void *self, float LineSpacing) {
- if (Debug == true) { UD_LOGI("setLineSpacing_generic : called"); }
- auto Description = getDescription(self);
- if (Debug == true) { UD_LOGI("setLineSpacing_generic : %s", Description.c_str()); }
- if (LineSpacing != -10.0f) {
- LineSpacing = 0.0f;
- }
- ori__setLineSpacing_generic(self, LineSpacing);
- }
- void (*ori__enableOutline_generic)(void *, ud_cocos2d::Color4B &, int) = nullptr;
- void enableOutline_generic(void *self, ud_cocos2d::Color4B &outlineColor, int outlineSize) {
- if (Debug == true) { UD_LOGI("enableOutline_generic : called"); }
- if (Debug == true) { UD_LOGI("enableOutline_generic : size is : %d", outlineSize); }
- if (outlineSize >= 2) { outlineSize = outlineSize/2; }
- if (Debug == true) { UD_LOGI("enableOutline_generic : newvalue is : %d", outlineSize); }
- ori__enableOutline_generic(self, outlineColor, outlineSize);
- }
Add Comment
Please, Sign In to add comment