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
nanahira
ygopro
Commits
d67e7239
Commit
d67e7239
authored
Jul 08, 2018
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
e154490f
' into test
parents
641ca439
e154490f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
14 deletions
+38
-14
gframe/game.cpp
gframe/game.cpp
+5
-2
gframe/image_manager.cpp
gframe/image_manager.cpp
+32
-12
gframe/image_manager.h
gframe/image_manager.h
+1
-0
No files found.
gframe/game.cpp
View file @
d67e7239
...
...
@@ -40,6 +40,8 @@ bool Game::Initialize() {
device
=
irr
::
createDeviceEx
(
params
);
if
(
!
device
)
return
false
;
xScale
=
1
;
yScale
=
1
;
linePatternD3D
=
0
;
linePatternGL
=
0x0f0f
;
waitFrame
=
0
;
...
...
@@ -1547,6 +1549,9 @@ void Game::OnResize() {
//old_guiFont->drop();
old_textFont
->
drop
();
imageManager
.
ClearTexture
();
imageManager
.
ResizeTexture
();
recti
menuposition
=
ResizeWin
(
370
,
200
,
650
,
415
);
wMainMenu
->
setRelativePosition
(
recti
(
menuposition
.
UpperLeftCorner
.
X
,
menuposition
.
UpperLeftCorner
.
Y
,
menuposition
.
LowerRightCorner
.
X
+
300
,
menuposition
.
LowerRightCorner
.
Y
+
185
));
wDeckEdit
->
setRelativePosition
(
Resize
(
309
,
5
,
605
,
130
));
...
...
@@ -1677,8 +1682,6 @@ void Game::OnResize() {
btnChainWhenAvail
->
setRelativePosition
(
Resize
(
205
,
180
,
295
,
215
));
btnShuffle
->
setRelativePosition
(
Resize
(
205
,
230
,
295
,
265
));
btnCancelOrFinish
->
setRelativePosition
(
Resize
(
205
,
230
,
295
,
265
));
imageManager
.
ClearTexture
();
}
recti
Game
::
Resize
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
)
{
x
=
x
*
xScale
;
...
...
gframe/image_manager.cpp
View file @
d67e7239
...
...
@@ -6,11 +6,9 @@ namespace ygo {
ImageManager
imageManager
;
bool
ImageManager
::
Initial
()
{
tCover
[
0
]
=
driver
->
getTexture
(
"textures/cover.jpg"
);
tCover
[
1
]
=
driver
->
getTexture
(
"textures/cover2.jpg"
);
if
(
!
tCover
[
1
])
tCover
[
1
]
=
tCover
[
0
];
tUnknown
=
driver
->
getTexture
(
"textures/unknown.jpg"
);
tCover
[
0
]
=
NULL
;
tCover
[
1
]
=
NULL
;
tUnknown
=
NULL
;
tAct
=
driver
->
getTexture
(
"textures/act.png"
);
tAttack
=
driver
->
getTexture
(
"textures/attack.png"
);
tChain
=
driver
->
getTexture
(
"textures/chain.png"
);
...
...
@@ -27,17 +25,14 @@ bool ImageManager::Initial() {
tHand
[
0
]
=
driver
->
getTexture
(
"textures/f1.jpg"
);
tHand
[
1
]
=
driver
->
getTexture
(
"textures/f2.jpg"
);
tHand
[
2
]
=
driver
->
getTexture
(
"textures/f3.jpg"
);
tBackGround
=
driver
->
getTexture
(
"textures/bg.jpg"
);
tBackGround_menu
=
driver
->
getTexture
(
"textures/bg_menu.jpg"
);
if
(
!
tBackGround_menu
)
tBackGround_menu
=
tBackGround
;
tBackGround_deck
=
driver
->
getTexture
(
"textures/bg_deck.jpg"
);
if
(
!
tBackGround_deck
)
tBackGround_deck
=
tBackGround
;
tBackGround
=
NULL
;
tBackGround_menu
=
NULL
;
tBackGround_deck
=
NULL
;
tField
[
0
]
=
driver
->
getTexture
(
"textures/field2.png"
);
tFieldTransparent
[
0
]
=
driver
->
getTexture
(
"textures/field-transparent2.png"
);
tField
[
1
]
=
driver
->
getTexture
(
"textures/field3.png"
);
tFieldTransparent
[
1
]
=
driver
->
getTexture
(
"textures/field-transparent3.png"
);
ResizeTexture
();
return
true
;
}
void
ImageManager
::
SetDevice
(
irr
::
IrrlichtDevice
*
dev
)
{
...
...
@@ -60,6 +55,7 @@ void ImageManager::ClearTexture() {
tMap
[
0
].
clear
();
tMap
[
1
].
clear
();
tThumb
.
clear
();
tFields
.
clear
();
}
void
ImageManager
::
RemoveTexture
(
int
code
)
{
auto
tit
=
tMap
[
0
].
find
(
code
);
...
...
@@ -75,6 +71,30 @@ void ImageManager::RemoveTexture(int code) {
tMap
[
1
].
erase
(
tit
);
}
}
void
ImageManager
::
ResizeTexture
()
{
irr
::
s32
imgWidth
=
CARD_IMG_WIDTH
*
mainGame
->
xScale
;
irr
::
s32
imgHeight
=
CARD_IMG_HEIGHT
*
mainGame
->
yScale
;
irr
::
s32
bgWidth
=
1024
*
mainGame
->
xScale
;
irr
::
s32
bgHeight
=
640
*
mainGame
->
yScale
;
driver
->
removeTexture
(
tCover
[
0
]);
driver
->
removeTexture
(
tCover
[
1
]);
tCover
[
0
]
=
GetTextureFromFile
(
"textures/cover.jpg"
,
imgWidth
,
imgHeight
);
tCover
[
1
]
=
GetTextureFromFile
(
"textures/cover2.jpg"
,
imgWidth
,
imgHeight
);
if
(
!
tCover
[
1
])
tCover
[
1
]
=
tCover
[
0
];
driver
->
removeTexture
(
tUnknown
);
tUnknown
=
GetTextureFromFile
(
"textures/unknown.jpg"
,
imgWidth
,
imgHeight
);
driver
->
removeTexture
(
tBackGround
);
tBackGround
=
GetTextureFromFile
(
"textures/bg.jpg"
,
bgWidth
,
bgHeight
);
driver
->
removeTexture
(
tBackGround_menu
);
tBackGround_menu
=
GetTextureFromFile
(
"textures/bg_menu.jpg"
,
bgWidth
,
bgHeight
);
if
(
!
tBackGround_menu
)
tBackGround_menu
=
tBackGround
;
driver
->
removeTexture
(
tBackGround_deck
);
tBackGround_deck
=
GetTextureFromFile
(
"textures/bg_deck.jpg"
,
bgWidth
,
bgHeight
);
if
(
!
tBackGround_deck
)
tBackGround_deck
=
tBackGround
;
}
// function by Warr1024, from https://github.com/minetest/minetest/issues/2419 , modified
void
imageScaleNNAA
(
irr
::
video
::
IImage
*
src
,
irr
::
video
::
IImage
*
dest
)
{
double
sx
,
sy
,
minsx
,
maxsx
,
minsy
,
maxsy
,
area
,
ra
,
ga
,
ba
,
aa
,
pw
,
ph
,
pa
;
...
...
gframe/image_manager.h
View file @
d67e7239
...
...
@@ -13,6 +13,7 @@ public:
void
SetDevice
(
irr
::
IrrlichtDevice
*
dev
);
void
ClearTexture
();
void
RemoveTexture
(
int
code
);
void
ResizeTexture
();
irr
::
video
::
ITexture
*
GetTextureFromFile
(
char
*
file
,
s32
width
,
s32
height
);
irr
::
video
::
ITexture
*
GetTexture
(
int
code
,
bool
fit
=
false
);
irr
::
video
::
ITexture
*
GetTextureThumb
(
int
code
);
...
...
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