Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
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
List
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
REIKAI
ygopro
Commits
20c42df6
Commit
20c42df6
authored
May 07, 2018
by
nanahira
Committed by
mercury233
May 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update img card display (#9)
parent
3fe03703
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
22 deletions
+89
-22
gframe/drawing.cpp
gframe/drawing.cpp
+26
-18
gframe/game.cpp
gframe/game.cpp
+52
-2
gframe/game.h
gframe/game.h
+6
-0
gframe/image_manager.cpp
gframe/image_manager.cpp
+5
-2
No files found.
gframe/drawing.cpp
View file @
20c42df6
...
...
@@ -745,11 +745,13 @@ void Game::DrawGUI() {
env
->
drawAll
();
}
void
Game
::
DrawSpec
()
{
s32
midx
=
574
+
(
CARD_IMG_WIDTH
*
0.5
);
s32
midy
=
150
+
(
CARD_IMG_HEIGHT
*
0.5
);
if
(
showcard
)
{
switch
(
showcard
)
{
case
1
:
{
driver
->
draw2DImage
(
imageManager
.
GetTexture
(
showcardcode
,
true
),
Resize
(
574
,
150
));
driver
->
draw2DImage
(
imageManager
.
tMask
,
Resize
(
574
,
150
,
574
+
(
showcarddif
>
CARD_IMG_WIDTH
?
CARD_IMG_WIDTH
:
showcarddif
),
150
+
CARD_IMG_HEIGHT
),
driver
->
draw2DImage
(
imageManager
.
GetTexture
(
showcardcode
,
true
),
Resize
CardHint
(
574
,
150
));
driver
->
draw2DImage
(
imageManager
.
tMask
,
Resize
CardMid
(
574
,
150
,
574
+
(
showcarddif
>
CARD_IMG_WIDTH
?
CARD_IMG_WIDTH
:
showcarddif
),
150
+
CARD_IMG_HEIGHT
,
midx
,
midy
),
recti
(
CARD_IMG_HEIGHT
-
showcarddif
,
0
,
CARD_IMG_HEIGHT
-
(
showcarddif
>
CARD_IMG_WIDTH
?
showcarddif
-
CARD_IMG_WIDTH
:
0
),
CARD_IMG_HEIGHT
),
0
,
0
,
true
);
showcarddif
+=
15
;
if
(
showcarddif
>=
CARD_IMG_HEIGHT
)
{
...
...
@@ -759,8 +761,8 @@ void Game::DrawSpec() {
break
;
}
case
2
:
{
driver
->
draw2DImage
(
imageManager
.
GetTexture
(
showcardcode
,
true
),
Resize
(
574
,
150
));
driver
->
draw2DImage
(
imageManager
.
tMask
,
Resize
(
574
+
showcarddif
,
150
,
574
+
CARD_IMG_WIDTH
,
150
+
CARD_IMG_HEIGHT
),
driver
->
draw2DImage
(
imageManager
.
GetTexture
(
showcardcode
,
true
),
Resize
CardHint
(
574
,
150
));
driver
->
draw2DImage
(
imageManager
.
tMask
,
Resize
CardMid
(
574
+
showcarddif
,
150
,
574
+
CARD_IMG_WIDTH
,
150
+
CARD_IMG_HEIGHT
,
midx
,
midy
),
recti
(
0
,
0
,
CARD_IMG_WIDTH
-
showcarddif
,
CARD_IMG_HEIGHT
),
0
,
0
,
true
);
showcarddif
+=
15
;
if
(
showcarddif
>=
CARD_IMG_WIDTH
)
{
...
...
@@ -769,8 +771,8 @@ void Game::DrawSpec() {
break
;
}
case
3
:
{
driver
->
draw2DImage
(
imageManager
.
GetTexture
(
showcardcode
,
true
),
Resize
(
574
,
150
));
driver
->
draw2DImage
(
imageManager
.
tNegated
,
Resize
(
536
+
showcarddif
,
141
+
showcarddif
,
792
-
showcarddif
,
397
-
showcarddif
),
recti
(
0
,
0
,
128
,
128
),
0
,
0
,
true
);
driver
->
draw2DImage
(
imageManager
.
GetTexture
(
showcardcode
,
true
),
Resize
CardHint
(
574
,
150
));
driver
->
draw2DImage
(
imageManager
.
tNegated
,
Resize
CardMid
(
536
+
showcarddif
,
141
+
showcarddif
,
792
-
showcarddif
,
397
-
showcarddif
,
midx
,
midy
),
recti
(
0
,
0
,
128
,
128
),
0
,
0
,
true
);
if
(
showcarddif
<
64
)
showcarddif
+=
4
;
break
;
...
...
@@ -780,8 +782,8 @@ void Game::DrawSpec() {
matManager
.
c2d
[
1
]
=
(
showcarddif
<<
24
)
|
0xffffff
;
matManager
.
c2d
[
2
]
=
(
showcarddif
<<
24
)
|
0xffffff
;
matManager
.
c2d
[
3
]
=
(
showcarddif
<<
24
)
|
0xffffff
;
driver
->
draw2DImage
(
imageManager
.
GetTexture
(
showcardcode
,
true
),
Resize
(
574
,
150
,
574
+
CARD_IMG_WIDTH
,
150
+
CARD_IMG_HEIGHT
),
Resize
(
0
,
0
,
CARD_IMG_WIDTH
,
CARD_IMG_HEIGHT
),
0
,
matManager
.
c2d
,
true
);
driver
->
draw2DImage
(
imageManager
.
GetTexture
(
showcardcode
,
true
),
Resize
CardHint
(
574
,
150
,
574
+
CARD_IMG_WIDTH
,
150
+
CARD_IMG_HEIGHT
),
Resize
Fit
(
0
,
0
,
CARD_IMG_WIDTH
,
CARD_IMG_HEIGHT
),
0
,
matManager
.
c2d
,
true
);
if
(
showcarddif
<
255
)
showcarddif
+=
17
;
break
;
...
...
@@ -791,28 +793,34 @@ void Game::DrawSpec() {
matManager
.
c2d
[
1
]
=
(
showcarddif
<<
25
)
|
0xffffff
;
matManager
.
c2d
[
2
]
=
(
showcarddif
<<
25
)
|
0xffffff
;
matManager
.
c2d
[
3
]
=
(
showcarddif
<<
25
)
|
0xffffff
;
driver
->
draw2DImage
(
imageManager
.
GetTexture
(
showcardcode
,
true
),
Resize
(
662
-
showcarddif
*
0.69685
f
,
277
-
showcarddif
,
662
+
showcarddif
*
0.69685
f
,
277
+
showcarddif
),
Resize
(
0
,
0
,
CARD_IMG_WIDTH
,
CARD_IMG_HEIGHT
),
0
,
matManager
.
c2d
,
true
);
driver
->
draw2DImage
(
imageManager
.
GetTexture
(
showcardcode
,
true
),
Resize
CardMid
(
662
-
showcarddif
*
0.69685
f
,
277
-
showcarddif
,
662
+
showcarddif
*
0.69685
f
,
277
+
showcarddif
,
midx
,
midy
),
Resize
Fit
(
0
,
0
,
CARD_IMG_WIDTH
,
CARD_IMG_HEIGHT
),
0
,
matManager
.
c2d
,
true
);
if
(
showcarddif
<
127
)
showcarddif
+=
9
;
break
;
}
case
6
:
{
driver
->
draw2DImage
(
imageManager
.
GetTexture
(
showcardcode
,
true
),
Resize
(
574
,
150
));
driver
->
draw2DImage
(
imageManager
.
tNumber
,
Resize
(
536
+
showcarddif
,
141
+
showcarddif
,
792
-
showcarddif
,
397
-
showcarddif
),
driver
->
draw2DImage
(
imageManager
.
GetTexture
(
showcardcode
,
true
),
Resize
CardHint
(
574
,
150
));
driver
->
draw2DImage
(
imageManager
.
tNumber
,
Resize
CardMid
(
536
+
showcarddif
,
141
+
showcarddif
,
792
-
showcarddif
,
397
-
showcarddif
,
midx
,
midy
),
recti
((
showcardp
%
5
)
*
64
,
(
showcardp
/
5
)
*
64
,
(
showcardp
%
5
+
1
)
*
64
,
(
showcardp
/
5
+
1
)
*
64
),
0
,
0
,
true
);
if
(
showcarddif
<
64
)
showcarddif
+=
4
;
break
;
}
case
7
:
{
float
mul
=
xScale
;
if
(
xScale
>
yScale
)
mul
=
yScale
;
core
::
position2d
<
s32
>
corner
[
4
];
float
y
=
sin
(
showcarddif
*
3.1415926
f
/
180.0
f
)
*
CARD_IMG_HEIGHT
*
yScale
;
corner
[
0
]
=
core
::
position2d
<
s32
>
(
574
*
xScale
-
(
CARD_IMG_HEIGHT
*
yScale
-
y
)
*
0.3
f
,
404
*
yScale
-
y
);
corner
[
1
]
=
core
::
position2d
<
s32
>
(
751
*
xScale
+
(
CARD_IMG_HEIGHT
*
yScale
-
y
)
*
0.3
f
,
404
*
yScale
-
y
);
corner
[
2
]
=
core
::
position2d
<
s32
>
(
574
*
xScale
,
404
*
yScale
);
corner
[
3
]
=
core
::
position2d
<
s32
>
(
751
*
xScale
,
404
*
yScale
);
irr
::
gui
::
Draw2DImageQuad
(
driver
,
imageManager
.
GetTexture
(
showcardcode
,
true
),
Resize
(
0
,
0
,
CARD_IMG_WIDTH
,
CARD_IMG_HEIGHT
),
corner
);
float
y
=
sin
(
showcarddif
*
3.1415926
f
/
180.0
f
)
*
CARD_IMG_HEIGHT
*
mul
;
s32
winx
=
midx
*
xScale
+
(
574
-
midx
)
*
mul
;
s32
winx2
=
midx
*
xScale
+
(
751
-
midx
)
*
mul
;
s32
winy
=
midy
*
yScale
+
(
404
-
midy
)
*
mul
;
corner
[
0
]
=
core
::
position2d
<
s32
>
(
winx
-
(
CARD_IMG_HEIGHT
*
mul
-
y
)
*
0.3
f
,
winy
-
y
);
corner
[
1
]
=
core
::
position2d
<
s32
>
(
winx2
+
(
CARD_IMG_HEIGHT
*
mul
-
y
)
*
0.3
f
,
winy
-
y
);
corner
[
2
]
=
core
::
position2d
<
s32
>
(
winx
,
winy
);
corner
[
3
]
=
core
::
position2d
<
s32
>
(
winx2
,
winy
);
irr
::
gui
::
Draw2DImageQuad
(
driver
,
imageManager
.
GetTexture
(
showcardcode
,
true
),
ResizeFit
(
0
,
0
,
CARD_IMG_WIDTH
,
CARD_IMG_HEIGHT
),
corner
);
showcardp
++
;
showcarddif
+=
9
;
if
(
showcarddif
>=
90
)
...
...
gframe/game.cpp
View file @
20c42df6
...
...
@@ -1550,8 +1550,8 @@ void Game::OnResize() {
btnReset
->
setRelativePosition
(
recti
(
1
,
1
,
width
,
height
));
}
wCardImg
->
setRelativePosition
(
Resize
(
1
,
1
,
1
+
CARD_IMG_WIDTH
+
20
,
1
+
CARD_IMG_HEIGHT
+
18
));
imgCard
->
setRelativePosition
(
Resize
(
10
,
9
,
10
+
CARD_IMG_WIDTH
,
9
+
CARD_IMG_HEIGHT
));
wCardImg
->
setRelativePosition
(
Resize
Card
(
1
,
1
,
20
,
18
));
imgCard
->
setRelativePosition
(
Resize
Card
(
10
,
9
,
0
,
0
));
wInfos
->
setRelativePosition
(
Resize
(
1
,
275
,
301
,
639
));
stName
->
setRelativePosition
(
recti
(
10
,
10
,
287
*
xScale
,
32
));
lstLog
->
setRelativePosition
(
Resize
(
10
,
10
,
290
,
290
));
...
...
@@ -1635,6 +1635,56 @@ recti Game::ResizeElem(s32 x, s32 y, s32 x2, s32 y2) {
y2
=
sy
+
y
;
return
recti
(
x
,
y
,
x2
,
y2
);
}
recti
Game
::
ResizeCard
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
)
{
float
mul
=
xScale
;
if
(
xScale
>
yScale
)
mul
=
yScale
;
s32
sx
=
CARD_IMG_WIDTH
*
mul
+
x2
*
xScale
;
s32
sy
=
CARD_IMG_HEIGHT
*
mul
+
y2
*
yScale
;
x
=
x
*
xScale
;
y
=
y
*
yScale
;
x2
=
sx
+
x
;
y2
=
sy
+
y
;
return
recti
(
x
,
y
,
x2
,
y2
);
}
recti
Game
::
ResizeCardHint
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
)
{
return
ResizeCardMid
(
x
,
y
,
x2
,
y2
,
(
x
+
x2
)
*
0.5
,
(
y
+
y2
)
*
0.5
);
}
position2di
Game
::
ResizeCardHint
(
s32
x
,
s32
y
)
{
return
ResizeCardMid
(
x
,
y
,
x
+
CARD_IMG_WIDTH
*
0.5
,
y
+
CARD_IMG_HEIGHT
*
0.5
);
}
recti
Game
::
ResizeCardMid
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
,
s32
midx
,
s32
midy
)
{
float
mul
=
xScale
;
if
(
xScale
>
yScale
)
mul
=
yScale
;
s32
cx
=
midx
*
xScale
;
s32
cy
=
midy
*
yScale
;
x
=
cx
+
(
x
-
midx
)
*
mul
;
y
=
cy
+
(
y
-
midy
)
*
mul
;
x2
=
cx
+
(
x2
-
midx
)
*
mul
;
y2
=
cy
+
(
y2
-
midy
)
*
mul
;
return
recti
(
x
,
y
,
x2
,
y2
);
}
position2di
Game
::
ResizeCardMid
(
s32
x
,
s32
y
,
s32
midx
,
s32
midy
)
{
float
mul
=
xScale
;
if
(
xScale
>
yScale
)
mul
=
yScale
;
s32
cx
=
midx
*
xScale
;
s32
cy
=
midy
*
yScale
;
x
=
cx
+
(
x
-
midx
)
*
mul
;
y
=
cy
+
(
y
-
midy
)
*
mul
;
return
position2di
(
x
,
y
);
}
recti
Game
::
ResizeFit
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
)
{
float
mul
=
xScale
;
if
(
xScale
>
yScale
)
mul
=
yScale
;
x
=
x
*
mul
;
y
=
y
*
mul
;
x2
=
x2
*
mul
;
y2
=
y2
*
mul
;
return
recti
(
x
,
y
,
x2
,
y2
);
}
void
Game
::
SetWindowsIcon
()
{
#ifdef _WIN32
HINSTANCE
hInstance
=
(
HINSTANCE
)
GetModuleHandleW
(
NULL
);
...
...
gframe/game.h
View file @
20c42df6
...
...
@@ -156,6 +156,12 @@ public:
position2di
ResizeReverse
(
s32
x
,
s32
y
);
recti
ResizeElem
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
);
recti
ResizeWin
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
,
bool
chat
=
false
);
recti
ResizeCard
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
);
recti
ResizeCardHint
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
);
position2di
ResizeCardHint
(
s32
x
,
s32
y
);
recti
ResizeCardMid
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
,
s32
midx
,
s32
midy
);
position2di
ResizeCardMid
(
s32
x
,
s32
y
,
s32
midx
,
s32
midy
);
recti
ResizeFit
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
);
void
SetWindowsIcon
();
void
FlashWindow
();
...
...
gframe/image_manager.cpp
View file @
20c42df6
...
...
@@ -174,8 +174,11 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
int
width
=
CARD_IMG_WIDTH
;
int
height
=
CARD_IMG_HEIGHT
;
if
(
fit
)
{
width
=
width
*
mainGame
->
xScale
;
height
=
height
*
mainGame
->
yScale
;
float
mul
=
mainGame
->
xScale
;
if
(
mainGame
->
xScale
>
mainGame
->
yScale
)
mul
=
mainGame
->
yScale
;
width
=
width
*
mul
;
height
=
height
*
mul
;
}
auto
tit
=
tMap
[
fit
?
1
:
0
].
find
(
code
);
if
(
tit
==
tMap
[
fit
?
1
:
0
].
end
())
{
...
...
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