@@ -58,6 +58,52 @@ static bool check_set_code(const CardDataC& data, int set_code) {
5858 return res;
5959}
6060
61+ inline void ShowBigCard (int code, float zoom) {
62+ mainGame->deckBuilder .bigcard_code = code;
63+ mainGame->deckBuilder .bigcard_zoom = zoom;
64+ ITexture* img = imageManager.GetBigPicture (code, zoom);
65+ mainGame->imgBigCard ->setImage (img);
66+ auto size = img->getSize ();
67+ s32 left = mainGame->window_size .Width / 2 - size.Width / 2 ;
68+ s32 top = mainGame->window_size .Height / 2 - size.Height / 2 ;
69+ mainGame->imgBigCard ->setRelativePosition (recti (0 , 0 , size.Width , size.Height ));
70+ mainGame->wBigCard ->setRelativePosition (recti (left, top, left + size.Width , top + size.Height ));
71+ mainGame->gMutex .lock ();
72+ mainGame->btnBigCardOriginalSize ->setVisible (true );
73+ mainGame->btnBigCardZoomIn ->setVisible (true );
74+ mainGame->btnBigCardZoomOut ->setVisible (true );
75+ mainGame->btnBigCardClose ->setVisible (true );
76+ mainGame->ShowElement (mainGame->wBigCard );
77+ mainGame->env ->getRootGUIElement ()->bringToFront (mainGame->wBigCard );
78+ mainGame->gMutex .unlock ();
79+ }
80+ inline void ZoomBigCard (s32 centerx = -1 , s32 centery = -1 ) {
81+ if (mainGame->deckBuilder .bigcard_zoom >= 4 )
82+ mainGame->deckBuilder .bigcard_zoom = 4 ;
83+ if (mainGame->deckBuilder .bigcard_zoom <= 0.2 )
84+ mainGame->deckBuilder .bigcard_zoom = 0.2 ;
85+ ITexture* img = imageManager.GetBigPicture (mainGame->deckBuilder .bigcard_code , mainGame->deckBuilder .bigcard_zoom );
86+ mainGame->imgBigCard ->setImage (img);
87+ auto size = img->getSize ();
88+ auto pos = mainGame->wBigCard ->getRelativePosition ();
89+ if (centerx == -1 ) {
90+ centerx = pos.UpperLeftCorner .X + pos.getWidth () / 2 ;
91+ centery = pos.UpperLeftCorner .Y + pos.getHeight () * 0 .444f ;
92+ }
93+ float posx = (float )(centerx - pos.UpperLeftCorner .X ) / pos.getWidth ();
94+ float posy = (float )(centery - pos.UpperLeftCorner .Y ) / pos.getHeight ();
95+ s32 left = centerx - size.Width * posx;
96+ s32 top = centery - size.Height * posy;
97+ mainGame->imgBigCard ->setRelativePosition (recti (0 , 0 , size.Width , size.Height ));
98+ mainGame->wBigCard ->setRelativePosition (recti (left, top, left + size.Width , top + size.Height ));
99+ }
100+ inline void CloseBigCard () {
101+ mainGame->HideElement (mainGame->wBigCard );
102+ mainGame->btnBigCardOriginalSize ->setVisible (false );
103+ mainGame->btnBigCardZoomIn ->setVisible (false );
104+ mainGame->btnBigCardZoomOut ->setVisible (false );
105+ mainGame->btnBigCardClose ->setVisible (false );
106+ }
61107void DeckBuilder::Initialize () {
62108 mainGame->is_building = true ;
63109 mainGame->is_siding = false ;
@@ -99,6 +145,11 @@ void DeckBuilder::Terminate() {
99145 mainGame->wCardImg ->setVisible (false );
100146 mainGame->wInfos ->setVisible (false );
101147 mainGame->btnLeaveGame ->setVisible (false );
148+ mainGame->wBigCard ->setVisible (false );
149+ mainGame->btnBigCardOriginalSize ->setVisible (false );
150+ mainGame->btnBigCardZoomIn ->setVisible (false );
151+ mainGame->btnBigCardZoomOut ->setVisible (false );
152+ mainGame->btnBigCardClose ->setVisible (false );
102153 mainGame->PopupElement (mainGame->wMainMenu );
103154 mainGame->device ->setEventReceiver (&mainGame->menuHandler );
104155 mainGame->wACMessage ->setVisible (false );
@@ -254,6 +305,24 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
254305 deckManager.LoadDeck (mainGame->cbDeckSelect ->getItem (mainGame->cbDeckSelect ->getSelected ()));
255306 break ;
256307 }
308+ case BUTTON_BIG_CARD_ORIG_SIZE: {
309+ ShowBigCard (bigcard_code, 1 );
310+ break ;
311+ }
312+ case BUTTON_BIG_CARD_ZOOM_IN: {
313+ bigcard_zoom += 0.2 ;
314+ ZoomBigCard ();
315+ break ;
316+ }
317+ case BUTTON_BIG_CARD_ZOOM_OUT: {
318+ bigcard_zoom -= 0.2 ;
319+ ZoomBigCard ();
320+ break ;
321+ }
322+ case BUTTON_BIG_CARD_CLOSE: {
323+ CloseBigCard ();
324+ break ;
325+ }
257326 case BUTTON_MSG_OK: {
258327 mainGame->HideElement (mainGame->wMessage );
259328 mainGame->actionSignal .Set ();
@@ -531,6 +600,11 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
531600 }
532601 case irr::EMIE_LMOUSE_LEFT_UP: {
533602 is_starting_dragging = false ;
603+ irr::gui::IGUIElement* root = mainGame->env ->getRootGUIElement ();
604+ if (!is_draging && !mainGame->is_siding && root->getElementFromPoint (mouse_pos) == mainGame->imgCard ) {
605+ ShowBigCard (mainGame->showingcode , 1 );
606+ break ;
607+ }
534608 if (!is_draging)
535609 break ;
536610 soundManager.PlaySoundEffect (SOUND_CARD_DROP);
@@ -554,6 +628,14 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
554628 is_draging = false ;
555629 break ;
556630 }
631+ case irr::EMIE_LMOUSE_DOUBLE_CLICK: {
632+ irr::gui::IGUIElement* root = mainGame->env ->getRootGUIElement ();
633+ if (!is_draging && !mainGame->is_siding && root->getElementFromPoint (mouse_pos) == root && hovered_code) {
634+ ShowBigCard (hovered_code, 1 );
635+ break ;
636+ }
637+ break ;
638+ }
557639 case irr::EMIE_RMOUSE_LEFT_UP: {
558640 if (mainGame->is_siding ) {
559641 if (is_draging)
@@ -576,6 +658,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
576658 }
577659 break ;
578660 }
661+ if (mainGame->wBigCard ->isVisible ()) {
662+ CloseBigCard ();
663+ break ;
664+ }
579665 if (mainGame->wCategories ->isVisible () || mainGame->wQuery ->isVisible ())
580666 break ;
581667 if (!is_draging) {
@@ -658,11 +744,16 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
658744 break ;
659745 }
660746 case irr::EMIE_MOUSE_WHEEL: {
747+ irr::gui::IGUIElement* root = mainGame->env ->getRootGUIElement ();
748+ if (root->getElementFromPoint (mouse_pos) == mainGame->imgBigCard ) {
749+ bigcard_zoom += 0 .1f * event.MouseInput .Wheel ;
750+ ZoomBigCard (mouse_pos.X , mouse_pos.Y );
751+ break ;
752+ }
661753 if (!mainGame->scrFilter ->isVisible ())
662754 break ;
663755 if (mainGame->env ->hasFocus (mainGame->scrFilter ))
664756 break ;
665- irr::gui::IGUIElement* root = mainGame->env ->getRootGUIElement ();
666757 if (root->getElementFromPoint (mouse_pos) != root)
667758 break ;
668759 if (event.MouseInput .Wheel < 0 ) {
0 commit comments