Baoulettes

Untitled

Jun 13th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.45 KB | None | 0 0
  1. void (*ori__cocos2d2ui4Text_generic)(void *, std::string) = nullptr;
  2. void cocos2d2ui4Text_generic(void *self, std::string string) {
  3. if (Debug == true) { UD_LOGI("cocos2d2ui4Text_generic : called"); }
  4. auto Description = getDescription(self);
  5. if (Debug == true) { UD_LOGI("cocos2d2ui4Text_generic : %s", Description.c_str()); }
  6. if (Description != "TextBMFont") {
  7. auto labelRenderer = getVirtualRenderer(self);
  8. if (Debug == true) { UD_LOGI("cocos2d2ui4Text_generic : getKerning"); }
  9. static float OldKerning = getKerning(labelRenderer);
  10. if (Debug == true) { UD_LOGI("cocos2d2ui4Text_generic : %f", OldKerning); }
  11. if (Debug == true) { UD_LOGI("cocos2d2ui4Text_generic : setKerning"); }
  12. static float NewKerning = OldKerning/2;
  13. setKerning(labelRenderer, NewKerning);
  14. if (Debug == true) { UD_LOGI("cocos2d2ui4Text_generic : %f", NewKerning); }
  15. if (Debug == true) { UD_LOGI("cocos2d2ui4Text_generic : Finishing !"); }
  16. } else {
  17. auto labelRenderer = getVirtualRenderer(self);
  18. if (Debug == true) { UD_LOGI("cocos2d2ui4Text_generic : TextBMFont : getKerning"); }
  19. static float OldKerning = getKerning(labelRenderer);
  20. if (Debug == true) { UD_LOGI("cocos2d2ui4Text_generic : TextBMFont : %f", OldKerning); }
  21. if (OldKerning != BMKerning) {
  22. static float NewKerning = OldKerning/4;
  23. setKerning(labelRenderer, NewKerning);
  24. if (Debug == true) { UD_LOGI("cocos2d2ui4Text_generic : TextBMFont : %f", NewKerning); }
  25. }
  26. ori__cocos2d2ui4Text_generic(self, string);
  27. }
  28. }
  29. void (*ori__setBMFontSize_generic)(void *, const std::string &, const ud_cocos2d::Vec2 &, float) = nullptr;
  30. void setBMFontSize_generic(void *self, const std::string &fntfile, const ud_cocos2d::Vec2 &unk, float unk2) {
  31. if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : called"); }
  32. ori__setBMFontSize_generic(self,fntfile,unk,unk2);
  33. if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : getDescription"); }
  34. auto Description = getDescription(self);
  35. if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : %s", Description.c_str()); }
  36. if (Description == "TextBMFont") {
  37. if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : Thie is a TextBMFont let continue !"); }
  38. if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : %s", fntfile.c_str()); }
  39. if (fntfile == "fonts/ja/custom/btn_normal/btn_normal.fnt") {
  40. if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : Thie is a btn_normal let continue !"); }
  41. if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : getVirtualRendererBM"); }
  42. auto labelRendererBM = getVirtualRendererBM(self);
  43. if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : getBMFontSize"); }
  44. static float Font_size = getBMFontSize(labelRendererBM);
  45. if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : Calculate new Fontsize"); }
  46. static float FontSizeBmFont = (Font_size*100)/115;
  47. if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : setBMFontSize"); }
  48. setFontSizeBmFont(labelRendererBM, FontSizeBmFont);
  49. if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : setLineBreakNoSpace"); }
  50. setLineBreakNoSpace(labelRendererBM, true);
  51. float LineSpacing = (Font_size * 1.8) - FontSizeBmFont;
  52. if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : setLineSpacing"); }
  53. setLineSpacing(labelRendererBM, -10.0f);
  54. if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : setLineHeight"); }
  55. float LineHeight = FontSizeBmFont * 2.6;
  56. setLineHeight(labelRendererBM, LineHeight);
  57. if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : setKerning"); }
  58. setKerning(labelRendererBM, BMKerning);
  59. if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : Finishing [btn_normal]!"); }
  60. } else {
  61. if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : Thie is not a btn_normal !"); }
  62. }
  63. } else {
  64. if (Debug == true) { UD_LOGI("setup_Label_BMFont_generic : Thie is not a TextBMFont!"); }
  65. }
  66. }
  67. void (*ori__setAdditionalKerning_generic)(void *, float) = nullptr;
  68. void setAdditionalKerning_generic(void *self, float passed_kerning) {
  69. UD_LOGI("setAdditionalKerning_generic : called");
  70. UD_LOGI("setAdditionalKerning_generic : size is : %f", passed_kerning);
  71. UD_LOGI("setAdditionalKerning_generic : BMKerning is: %f", BMKerning);
  72. if (passed_kerning != BMKerning) {
  73. passed_kerning = 100.0f;
  74. }
  75. UD_LOGI("setAdditionalKerning_generic : newvalue is : %f", passed_kerning);
  76. ori__setAdditionalKerning_generic(self, passed_kerning);
  77. }
  78. void (*ori__setLineSpacing_generic)(void *, float) = nullptr;
  79. void setLineSpacing_generic(void *self, float LineSpacing) {
  80. if (Debug == true) { UD_LOGI("setLineSpacing_generic : called"); }
  81. auto Description = getDescription(self);
  82. if (Debug == true) { UD_LOGI("setLineSpacing_generic : %s", Description.c_str()); }
  83. if (LineSpacing != -10.0f) {
  84. LineSpacing = 0.0f;
  85. }
  86. ori__setLineSpacing_generic(self, LineSpacing);
  87. }
  88. void (*ori__enableOutline_generic)(void *, ud_cocos2d::Color4B &, int) = nullptr;
  89. void enableOutline_generic(void *self, ud_cocos2d::Color4B &outlineColor, int outlineSize) {
  90. if (Debug == true) { UD_LOGI("enableOutline_generic : called"); }
  91. if (Debug == true) { UD_LOGI("enableOutline_generic : size is : %d", outlineSize); }
  92. if (outlineSize >= 2) { outlineSize = outlineSize/2; }
  93. if (Debug == true) { UD_LOGI("enableOutline_generic : newvalue is : %d", outlineSize); }
  94. ori__enableOutline_generic(self, outlineColor, outlineSize);
  95. }
Add Comment
Please, Sign In to add comment