11package game .cdev ;
22
3+ import flixel .addons .effects .chainable .FlxEffectSprite ;
4+ import flixel .addons .effects .chainable .FlxOutlineEffect ;
5+ import flixel .math .FlxMath ;
36import flixel .util .FlxSpriteUtil ;
47import flixel .text .FlxText ;
58import flixel .tweens .FlxEase ;
@@ -20,15 +23,22 @@ class CDevPopUp extends MusicBeatSubstate
2023 var exitButt : FlxSprite ;
2124 var bgBlack : FlxSprite ;
2225
26+ var titleS : FlxSprite ;
27+ var iconS : FlxSprite ;
28+ var titleTextS : FlxText ;
29+
2330 var buttons : Array <PopUpButton > = [];
2431 var titleT : String = " " ;
2532 var bodyT : String = " " ;
2633
2734 var _hideBG : Bool = false ;
2835 var _hideCloseButton : Bool = false ;
36+ var lastMouseWasVisible : Bool = false ;
2937 public function new (title : String , body : String , buttons : Array <PopUpButton >, ? hideBG : Bool = false ,? hideCloseButton : Bool = false )
3038 {
3139 super ();
40+ lastMouseWasVisible = FlxG .mouse .visible ;
41+ FlxG .mouse .visible = true ;// nu
3242 this .buttons = buttons ;
3343 titleT = title ;
3444 bodyT = body ;
@@ -41,53 +51,82 @@ class CDevPopUp extends MusicBeatSubstate
4151 bgBlack .scrollFactor .set ();
4252 }
4353
54+ var tempbodyText = new FlxText (0 ,0 , - 1 , bodyT , 18 );
55+ tempbodyText .font = " VCR OSD Mono" ;
56+ tempbodyText .fieldWidth = FlxMath .bound (tempbodyText .fieldWidth ,0 ,780 );
57+ @:privateAccess tempbodyText .regenGraphic ();
58+ tempbodyText .drawFrame (true );
59+ tempbodyText .scrollFactor .set ();
4460
45- box = new FlxSprite ().makeGraphic (800 , 400 , FlxColor .BLACK );
46- box .alpha = 0.7 ;
61+ var wee : Int = Std .int (tempbodyText .width + 70 );
62+ var hee : Int = Std .int (70 + tempbodyText .height + 50 );
63+ box = FlxSpriteUtil .drawRoundRect (new FlxSprite ().makeGraphic (wee ,hee , FlxColor .TRANSPARENT ), 0 , 0 , wee , hee , 15 , 15 , FlxColor .BLACK );
4764 box .screenCenter ();
48- add (box );
4965 box .scrollFactor .set ();
66+ box .alpha = 0 ;
67+
68+ // i tried FlxOutlineEffect, the results are ass
69+ var newEffect = FlxSpriteUtil .drawRoundRect (new FlxSprite ().makeGraphic (wee + 4 ,hee + 4 , FlxColor .TRANSPARENT ), 0 , 0 , wee + 4 , hee + 4 , 15 , 15 , 0xFF006EFF );
70+ newEffect .setPosition (box .x - 2 ,box .y - 2 );
71+ newEffect .antialiasing = CDevConfig .saveData .antialiasing ;
72+ newEffect .alpha = 0 ;
73+ add (newEffect );
74+ newEffect .scrollFactor .set ();
75+ add (box );
76+
77+ createBoxUI ();
78+
79+ if (! hideBG ){
80+ bgBlack .alpha = 0 ;
81+ FlxTween .tween (bgBlack , {alpha : 0.5 },0.15 ,{ease : FlxEase .linear });
82+ }
5083
5184 if (! hideCloseButton ){
5285 exitButt = new FlxSprite ().makeGraphic (30 , 20 , FlxColor .RED );
5386 exitButt .alpha = 0.7 ;
5487 exitButt .x = ((box .x + box .width ) - 30 ) - 10 ;
55- exitButt .y = ( box .y + 20 ) - 10 ;
88+ exitButt .y = box .y + 9 ;
5689 add (exitButt );
5790 exitButt .scrollFactor .set ();
5891 }
59-
60-
61- createBoxUI ();
62-
63- if (! hideBG ){
64- bgBlack .alpha = 0 ;
65- FlxTween .tween (bgBlack , {alpha : 0.5 },0.3 ,{ease : FlxEase .linear });
66- }
67-
68- box .alpha = 0 ;
69-
70- FlxSpriteUtil .drawRoundRect (box ,0 ,0 ,800 ,400 ,50 ,50 , FlxColor .BLACK );
71- box .alpha = 0 ;
72- FlxTween .tween (box , {alpha : 0.7 },0.3 ,{ease : FlxEase .linear });
92+
93+ FlxTween .tween (box , {alpha : 1 },0.15 ,{ease : FlxEase .linear });
94+ FlxTween .tween (newEffect , {alpha : 0.2 },0.15 ,{ease : FlxEase .linear });
7395 if (! hideCloseButton ){
7496 exitButt .alpha = 0 ;
75- FlxTween .tween (exitButt , {alpha : 0.7 },0.3 ,{ease : FlxEase .linear });
97+ FlxTween .tween (exitButt , {alpha : 0.7 },0.15 ,{ease : FlxEase .linear });
7698 }
7799 }
78100
79101 var bodyText : FlxText ;
80102 var buttonsCrap : Array <CDevPopUpButton > = [];
81103 function createBoxUI ()
82104 {
83- var header : FlxText = new FlxText (box .x , box .y + 10 , 800 , titleT , 40 );
84- header .setFormat (" VCR OSD Mono" , 24 , FlxColor .WHITE , CENTER , OUTLINE , FlxColor .BLACK );
85- add (header );
86- header .scrollFactor .set ();
87- bodyText = new FlxText (box .x + 30 , box .y + 40 , 680 , bodyT , 18 );
105+ titleS = FlxSpriteUtil .drawRoundRectComplex (new FlxSprite ().makeGraphic (Std .int (box .width ), 32 , FlxColor .TRANSPARENT ), 0 , 0 , Std .int (box .width ), 32 , 5 ,
106+ 5 , 0 , 0 , FlxColor .fromRGB (64 , 62 , 60 , 255 ));
107+ titleS .setPosition (box .x , box .y );
108+ titleS .alpha = 0.9 ;
109+ add (titleS );
110+
111+ iconS = new FlxSprite ().loadGraphic (Paths .image (" icon16" , " shared" ));
112+ iconS .setPosition (titleS .x + 9 , titleS .y + 9 );
113+ add (iconS );
114+
115+ titleTextS = new FlxText (iconS .x + iconS .width + 8 , 0 , - 1 , titleT , 14 );
116+ titleTextS .setFormat (" VCR OSD Mono" , 14 , FlxColor .WHITE );
117+ titleTextS .y = iconS .y + ((iconS .width / 2 ) - (titleTextS .height / 2 ));
118+ add (titleTextS );
119+
120+ titleS .scrollFactor .set ();
121+ iconS .scrollFactor .set ();
122+ titleTextS .scrollFactor .set ();
123+
124+ bodyText = new FlxText (box .x + 30 , box .y + 50 , - 1 , bodyT , 18 );
125+ bodyText .fieldWidth = FlxMath .bound (bodyText .fieldWidth ,0 ,780 );
88126 bodyText .font = " VCR OSD Mono" ;
89127 add (bodyText );
90128 bodyText .scrollFactor .set ();
129+
91130
92131 for (i in 0 ... buttons .length ){
93132 var button : CDevPopUpButton = new CDevPopUpButton (0 ,0 ,buttons [i ].text , buttons [i ].callback );
@@ -99,7 +138,9 @@ class CDevPopUp extends MusicBeatSubstate
99138 }
100139
101140 for (i in 0 ... buttonsCrap .length ){
102- buttonsCrap [i ].x = (box .x + (box .width / 2 )- (buttonsCrap [i ].bWidth / 2 ))- 20 - (buttonsCrap [i ].bWidth * i );
141+ // (box.x+(box.width / 2)-(buttonsCrap[i].bWidth/2))-20-(buttonsCrap[i].bWidth*i);
142+ var oldButtWidth = (buttonsCrap [i - 1 ] == null ? 0 : buttonsCrap [i - 1 ].bWidth );
143+ buttonsCrap [i ].x = box .x + ((box .width - (buttonsCrap [i ].bWidth + (oldButtWidth + 20 ))));
103144 buttonsCrap [i ].y = (box .y + box .height - buttonsCrap [i ].bHeight ) - 20 ;
104145 }
105146 }
@@ -140,7 +181,7 @@ class CDevPopUpButton extends FlxSpriteGroup{
140181 txt .font = " VCR OSD Mono" ;
141182 txt .alignment = CENTER ;
142183 add (txt );
143- buttBG .setGraphicSize (Std .int (txt .width + 20 ), Std .int (txt .height + 20 ));
184+ buttBG .setGraphicSize (Std .int (txt .width + 20 ), Std .int (txt .height + 12 ));
144185 bWidth = Std .int (buttBG .width );
145186 bHeight = Std .int (buttBG .height );
146187
0 commit comments