Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-2pick
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ygopro-2pick
Commits
75a2d55d
Commit
75a2d55d
authored
Jun 17, 2019
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'patch-imagebutton' of github.com:mercury233/ygopro
parents
519a0c54
7eb2e82e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
6 deletions
+33
-6
gframe/CGUIImageButton.cpp
gframe/CGUIImageButton.cpp
+23
-0
gframe/CGUIImageButton.h
gframe/CGUIImageButton.h
+4
-0
gframe/game.cpp
gframe/game.cpp
+6
-6
No files found.
gframe/CGUIImageButton.cpp
View file @
75a2d55d
...
...
@@ -97,8 +97,10 @@ void Draw2DImageQuad(video::IVideoDriver* driver, video::ITexture* image, core::
CGUIImageButton
::
CGUIImageButton
(
IGUIEnvironment
*
environment
,
IGUIElement
*
parent
,
s32
id
,
core
::
rect
<
s32
>
rectangle
)
:
CGUIButton
(
environment
,
parent
,
id
,
rectangle
)
{
isDrawImage
=
true
;
isFixedSize
=
false
;
imageRotation
=
0.0
f
;
imageScale
=
core
::
vector2df
(
1.0
f
,
1.0
f
);
imageSize
=
core
::
dimension2di
(
rectangle
.
getWidth
(),
rectangle
.
getHeight
());
}
CGUIImageButton
*
CGUIImageButton
::
addImageButton
(
IGUIEnvironment
*
env
,
const
core
::
rect
<
s32
>&
rectangle
,
IGUIElement
*
parent
,
s32
id
)
{
CGUIImageButton
*
button
=
new
CGUIImageButton
(
env
,
parent
?
parent
:
0
,
id
,
rectangle
);
...
...
@@ -129,6 +131,23 @@ void CGUIImageButton::draw() {
irr
::
gui
::
Draw2DImageRotation
(
driver
,
Image
,
ImageRect
,
pos
,
center
,
imageRotation
,
imageScale
);
IGUIElement
::
draw
();
}
void
CGUIImageButton
::
setImage
(
video
::
ITexture
*
image
)
{
if
(
image
)
image
->
grab
();
if
(
Image
)
Image
->
drop
();
Image
=
image
;
if
(
image
)
{
ImageRect
=
core
::
rect
<
s32
>
(
core
::
position2d
<
s32
>
(
0
,
0
),
image
->
getOriginalSize
());
if
(
isFixedSize
)
imageScale
=
core
::
vector2df
((
irr
::
f32
)
imageSize
.
Width
/
image
->
getSize
().
Width
,
(
irr
::
f32
)
imageSize
.
Height
/
image
->
getSize
().
Height
);
}
if
(
!
PressedImage
)
setPressedImage
(
Image
);
}
void
CGUIImageButton
::
setDrawImage
(
bool
b
)
{
isDrawImage
=
b
;
}
...
...
@@ -138,6 +157,10 @@ void CGUIImageButton::setImageRotation(f32 r) {
void
CGUIImageButton
::
setImageScale
(
core
::
vector2df
s
)
{
imageScale
=
s
;
}
void
CGUIImageButton
::
setImageSize
(
core
::
dimension2di
s
)
{
isFixedSize
=
true
;
imageSize
=
s
;
}
IGUIFont
*
CGUIImageButton
::
getOverrideFont
(
void
)
const
{
...
...
gframe/CGUIImageButton.h
View file @
75a2d55d
...
...
@@ -17,16 +17,20 @@ public:
CGUIImageButton
(
IGUIEnvironment
*
environment
,
IGUIElement
*
parent
,
s32
id
,
core
::
rect
<
s32
>
rectangle
);
static
CGUIImageButton
*
addImageButton
(
IGUIEnvironment
*
env
,
const
core
::
rect
<
s32
>&
rectangle
,
IGUIElement
*
parent
,
s32
id
);
virtual
void
draw
();
virtual
void
setImage
(
video
::
ITexture
*
image
=
0
);
virtual
void
setDrawImage
(
bool
b
);
virtual
void
setImageRotation
(
f32
r
);
virtual
void
setImageScale
(
core
::
vector2df
s
);
virtual
void
setImageSize
(
core
::
dimension2di
s
);
virtual
IGUIFont
*
getOverrideFont
(
void
)
const
;
virtual
IGUIFont
*
getActiveFont
()
const
;
private:
bool
isDrawImage
;
bool
isFixedSize
;
f32
imageRotation
;
core
::
vector2df
imageScale
;
core
::
dimension2di
imageSize
;
};
}
...
...
gframe/game.cpp
View file @
75a2d55d
...
...
@@ -449,15 +449,15 @@ bool Game::Initialize() {
wPosSelect->getCloseButton()->setVisible(false);
wPosSelect->setVisible(false);
btnPSAU = irr::gui::CGUIImageButton::addImageButton(env, rect<s32>(10, 45, 150, 185), wPosSelect, BUTTON_POS_AU);
btnPSAU
->
setImageS
cale
(
core
::
vector2df
(
0.5
,
0.5
));
btnPSAU->setImageS
ize(core::dimension2di(CARD_IMG_WIDTH * 0.5f, CARD_IMG_HEIGHT * 0.5f
));
btnPSAD = irr::gui::CGUIImageButton::addImageButton(env, rect<s32>(155, 45, 295, 185), wPosSelect, BUTTON_POS_AD);
btnPSAD
->
setImageS
cale
(
core
::
vector2df
(
0.5
,
0.5
));
btnPSAD->setImageS
ize(core::dimension2di(CARD_IMG_WIDTH * 0.5f, CARD_IMG_HEIGHT * 0.5f
));
btnPSAD->setImage(imageManager.tCover[2]);
btnPSDU = irr::gui::CGUIImageButton::addImageButton(env, rect<s32>(300, 45, 440, 185), wPosSelect, BUTTON_POS_DU);
btnPSDU
->
setImageS
cale
(
core
::
vector2df
(
0.5
,
0.5
));
btnPSDU->setImageS
ize(core::dimension2di(CARD_IMG_WIDTH * 0.5f, CARD_IMG_HEIGHT * 0.5f
));
btnPSDU->setImageRotation(270);
btnPSDD = irr::gui::CGUIImageButton::addImageButton(env, rect<s32>(445, 45, 585, 185), wPosSelect, BUTTON_POS_DD);
btnPSDD
->
setImageS
cale
(
core
::
vector2df
(
0.5
,
0.5
));
btnPSDD->setImageS
ize(core::dimension2di(CARD_IMG_WIDTH * 0.5f, CARD_IMG_HEIGHT * 0.5f
));
btnPSDD->setImageRotation(270);
btnPSDD->setImage(imageManager.tCover[2]);
//card select
...
...
@@ -469,7 +469,7 @@ bool Game::Initialize() {
stCardPos[i]->setBackgroundColor(0xffffffff);
stCardPos[i]->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
btnCardSelect[i] = irr::gui::CGUIImageButton::addImageButton(env, rect<s32>(30 + 125 * i, 55, 150 + 125 * i, 225), wCardSelect, BUTTON_CARD_0 + i);
btnCardSelect
[
i
]
->
setImageS
cale
(
core
::
vector2df
(
0.6
f
,
0.6
f
));
btnCardSelect[i]->setImageS
ize(core::dimension2di(CARD_IMG_WIDTH * 0.6f, CARD_IMG_HEIGHT *
0.6f));
}
scrCardList = env->addScrollBar(true, rect<s32>(30, 235, 650, 255), wCardSelect, SCROLL_CARD_SELECT);
btnSelectOK = env->addButton(rect<s32>(300, 265, 380, 290), wCardSelect, BUTTON_CARD_SEL_OK, dataManager.GetSysString(1211));
...
...
@@ -482,7 +482,7 @@ bool Game::Initialize() {
stDisplayPos[i]->setBackgroundColor(0xffffffff);
stDisplayPos[i]->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
btnCardDisplay[i] = irr::gui::CGUIImageButton::addImageButton(env, rect<s32>(30 + 125 * i, 55, 150 + 125 * i, 225), wCardDisplay, BUTTON_DISPLAY_0 + i);
btnCardDisplay
[
i
]
->
setImageS
cale
(
core
::
vector2df
(
0.6
f
,
0.6
f
));
btnCardDisplay[i]->setImageS
ize(core::dimension2di(CARD_IMG_WIDTH * 0.6f, CARD_IMG_HEIGHT *
0.6f));
}
scrDisplayList = env->addScrollBar(true, rect<s32>(30, 235, 650, 255), wCardDisplay, SCROLL_CARD_DISPLAY);
btnDisplayOK = env->addButton(rect<s32>(300, 265, 380, 290), wCardDisplay, BUTTON_CARD_DISP_OK, dataManager.GetSysString(1211));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment