Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
R
rd-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
苍蓝
rd-ygopro
Commits
3d5b1523
Commit
3d5b1523
authored
Mar 14, 2019
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
24fe16fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
26 deletions
+25
-26
gframe/image_manager.cpp
gframe/image_manager.cpp
+22
-24
gframe/image_manager.h
gframe/image_manager.h
+3
-2
No files found.
gframe/image_manager.cpp
View file @
3d5b1523
...
@@ -12,9 +12,9 @@ bool ImageManager::Initial() {
...
@@ -12,9 +12,9 @@ bool ImageManager::Initial() {
tCover
[
3
]
=
GetTextureFromFile
(
"textures/cover2.jpg"
,
CARD_IMG_WIDTH
,
CARD_IMG_HEIGHT
);
tCover
[
3
]
=
GetTextureFromFile
(
"textures/cover2.jpg"
,
CARD_IMG_WIDTH
,
CARD_IMG_HEIGHT
);
if
(
!
tCover
[
3
])
if
(
!
tCover
[
3
])
tCover
[
3
]
=
tCover
[
2
];
tCover
[
3
]
=
tCover
[
2
];
tUnknown
[
0
]
=
NULL
;
tUnknown
=
NULL
;
tUnknown
[
1
]
=
NULL
;
tUnknown
Fit
=
NULL
;
tUnknown
[
2
]
=
NULL
;
tUnknown
Thumb
=
NULL
;
tAct
=
driver
->
getTexture
(
"textures/act.png"
);
tAct
=
driver
->
getTexture
(
"textures/act.png"
);
tAttack
=
driver
->
getTexture
(
"textures/attack.png"
);
tAttack
=
driver
->
getTexture
(
"textures/attack.png"
);
tChain
=
driver
->
getTexture
(
"textures/chain.png"
);
tChain
=
driver
->
getTexture
(
"textures/chain.png"
);
...
@@ -62,12 +62,6 @@ void ImageManager::ClearTexture() {
...
@@ -62,12 +62,6 @@ void ImageManager::ClearTexture() {
tMap
[
1
].
clear
();
tMap
[
1
].
clear
();
tThumb
.
clear
();
tThumb
.
clear
();
tFields
.
clear
();
tFields
.
clear
();
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
if
(
tUnknown
[
i
]
!=
NULL
)
{
driver
->
removeTexture
(
tUnknown
[
i
]);
tUnknown
[
i
]
=
NULL
;
}
}
}
}
void
ImageManager
::
RemoveTexture
(
int
code
)
{
void
ImageManager
::
RemoveTexture
(
int
code
)
{
auto
tit
=
tMap
[
0
].
find
(
code
);
auto
tit
=
tMap
[
0
].
find
(
code
);
...
@@ -86,6 +80,11 @@ void ImageManager::RemoveTexture(int code) {
...
@@ -86,6 +80,11 @@ void ImageManager::RemoveTexture(int code) {
void
ImageManager
::
ResizeTexture
()
{
void
ImageManager
::
ResizeTexture
()
{
irr
::
s32
imgWidth
=
CARD_IMG_WIDTH
*
mainGame
->
xScale
;
irr
::
s32
imgWidth
=
CARD_IMG_WIDTH
*
mainGame
->
xScale
;
irr
::
s32
imgHeight
=
CARD_IMG_HEIGHT
*
mainGame
->
yScale
;
irr
::
s32
imgHeight
=
CARD_IMG_HEIGHT
*
mainGame
->
yScale
;
irr
::
s32
imgWidthThumb
=
CARD_THUMB_WIDTH
*
mainGame
->
xScale
;
irr
::
s32
imgHeightThumb
=
CARD_THUMB_HEIGHT
*
mainGame
->
yScale
;
float
mul
=
(
mainGame
->
xScale
>
mainGame
->
yScale
)
?
mainGame
->
yScale
:
mainGame
->
xScale
;
irr
::
s32
imgWidthFit
=
CARD_IMG_WIDTH
*
mul
;
irr
::
s32
imgHeightFit
=
CARD_IMG_HEIGHT
*
mul
;
irr
::
s32
bgWidth
=
1024
*
mainGame
->
xScale
;
irr
::
s32
bgWidth
=
1024
*
mainGame
->
xScale
;
irr
::
s32
bgHeight
=
640
*
mainGame
->
yScale
;
irr
::
s32
bgHeight
=
640
*
mainGame
->
yScale
;
driver
->
removeTexture
(
tCover
[
0
]);
driver
->
removeTexture
(
tCover
[
0
]);
...
@@ -94,8 +93,12 @@ void ImageManager::ResizeTexture() {
...
@@ -94,8 +93,12 @@ void ImageManager::ResizeTexture() {
tCover
[
1
]
=
GetTextureFromFile
(
"textures/cover2.jpg"
,
imgWidth
,
imgHeight
);
tCover
[
1
]
=
GetTextureFromFile
(
"textures/cover2.jpg"
,
imgWidth
,
imgHeight
);
if
(
!
tCover
[
1
])
if
(
!
tCover
[
1
])
tCover
[
1
]
=
tCover
[
0
];
tCover
[
1
]
=
tCover
[
0
];
//driver->removeTexture(tUnknown);
driver
->
removeTexture
(
tUnknown
);
//tUnknown = GetTextureFromFile("textures/unknown.jpg", imgWidth, imgHeight);
driver
->
removeTexture
(
tUnknownFit
);
driver
->
removeTexture
(
tUnknownThumb
);
tUnknown
=
GetTextureFromFile
(
"textures/unknown.jpg"
,
CARD_IMG_WIDTH
,
CARD_IMG_HEIGHT
);
tUnknownFit
=
GetTextureFromFile
(
"textures/unknown.jpg"
,
imgWidthFit
,
imgHeightFit
);
tUnknownThumb
=
GetTextureFromFile
(
"textures/unknown.jpg"
,
imgWidthThumb
,
imgHeightThumb
);
driver
->
removeTexture
(
tBackGround
);
driver
->
removeTexture
(
tBackGround
);
tBackGround
=
GetTextureFromFile
(
"textures/bg.jpg"
,
bgWidth
,
bgHeight
);
tBackGround
=
GetTextureFromFile
(
"textures/bg.jpg"
,
bgWidth
,
bgHeight
);
driver
->
removeTexture
(
tBackGround_menu
);
driver
->
removeTexture
(
tBackGround_menu
);
...
@@ -200,12 +203,9 @@ irr::video::ITexture* ImageManager::GetTextureFromFile(char* file, s32 width, s3
...
@@ -200,12 +203,9 @@ irr::video::ITexture* ImageManager::GetTextureFromFile(char* file, s32 width, s3
return
driver
->
getTexture
(
file
);
return
driver
->
getTexture
(
file
);
}
}
}
}
irr
::
video
::
ITexture
*
ImageManager
::
GetTextureUnknown
(
s32
width
,
s32
height
,
int
index
)
{
if
(
tUnknown
[
index
]
==
NULL
)
tUnknown
[
index
]
=
GetTextureFromFile
(
"textures/unknown.jpg"
,
width
,
height
);
return
tUnknown
[
index
];
}
irr
::
video
::
ITexture
*
ImageManager
::
GetTexture
(
int
code
,
bool
fit
)
{
irr
::
video
::
ITexture
*
ImageManager
::
GetTexture
(
int
code
,
bool
fit
)
{
if
(
code
==
0
)
return
fit
?
tUnknownFit
:
tUnknown
;
int
width
=
CARD_IMG_WIDTH
;
int
width
=
CARD_IMG_WIDTH
;
int
height
=
CARD_IMG_HEIGHT
;
int
height
=
CARD_IMG_HEIGHT
;
if
(
fit
)
{
if
(
fit
)
{
...
@@ -215,8 +215,6 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
...
@@ -215,8 +215,6 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
width
=
width
*
mul
;
width
=
width
*
mul
;
height
=
height
*
mul
;
height
=
height
*
mul
;
}
}
if
(
code
==
0
)
return
GetTextureUnknown
(
width
,
height
,
fit
?
1
:
0
);
auto
tit
=
tMap
[
fit
?
1
:
0
].
find
(
code
);
auto
tit
=
tMap
[
fit
?
1
:
0
].
find
(
code
);
if
(
tit
==
tMap
[
fit
?
1
:
0
].
end
())
{
if
(
tit
==
tMap
[
fit
?
1
:
0
].
end
())
{
char
file
[
256
];
char
file
[
256
];
...
@@ -231,19 +229,19 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
...
@@ -231,19 +229,19 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
return
GetTextureThumb
(
code
);
return
GetTextureThumb
(
code
);
}
}
tMap
[
fit
?
1
:
0
][
code
]
=
img
;
tMap
[
fit
?
1
:
0
][
code
]
=
img
;
return
(
img
==
NULL
)
?
GetTextureUnknown
(
width
,
height
,
fit
?
1
:
0
)
:
img
;
return
(
img
==
NULL
)
?
(
fit
?
tUnknownFit
:
tUnknown
)
:
img
;
}
}
if
(
tit
->
second
)
if
(
tit
->
second
)
return
tit
->
second
;
return
tit
->
second
;
else
else
return
mainGame
->
gameConf
.
use_image_scale
?
GetTextureUnknown
(
width
,
height
,
fit
?
1
:
0
)
:
GetTextureThumb
(
code
);
return
mainGame
->
gameConf
.
use_image_scale
?
(
fit
?
tUnknownFit
:
tUnknown
)
:
GetTextureThumb
(
code
);
}
}
irr
::
video
::
ITexture
*
ImageManager
::
GetTextureThumb
(
int
code
)
{
irr
::
video
::
ITexture
*
ImageManager
::
GetTextureThumb
(
int
code
)
{
if
(
code
==
0
)
return
tUnknownThumb
;
auto
tit
=
tThumb
.
find
(
code
);
auto
tit
=
tThumb
.
find
(
code
);
int
width
=
CARD_THUMB_WIDTH
*
mainGame
->
xScale
;
int
width
=
CARD_THUMB_WIDTH
*
mainGame
->
xScale
;
int
height
=
CARD_THUMB_HEIGHT
*
mainGame
->
yScale
;
int
height
=
CARD_THUMB_HEIGHT
*
mainGame
->
yScale
;
if
(
code
==
0
)
return
GetTextureUnknown
(
width
,
height
,
2
);
if
(
tit
==
tThumb
.
end
())
{
if
(
tit
==
tThumb
.
end
())
{
char
file
[
256
];
char
file
[
256
];
sprintf
(
file
,
"expansions/pics/thumbnail/%d.jpg"
,
code
);
sprintf
(
file
,
"expansions/pics/thumbnail/%d.jpg"
,
code
);
...
@@ -261,12 +259,12 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
...
@@ -261,12 +259,12 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
}
}
}
}
tThumb
[
code
]
=
img
;
tThumb
[
code
]
=
img
;
return
(
img
==
NULL
)
?
GetTextureUnknown
(
width
,
height
,
2
)
:
img
;
return
(
img
==
NULL
)
?
tUnknownThumb
:
img
;
}
}
if
(
tit
->
second
)
if
(
tit
->
second
)
return
tit
->
second
;
return
tit
->
second
;
else
else
return
GetTextureUnknown
(
width
,
height
,
2
)
;
return
tUnknownThumb
;
}
}
irr
::
video
::
ITexture
*
ImageManager
::
GetTextureField
(
int
code
)
{
irr
::
video
::
ITexture
*
ImageManager
::
GetTextureField
(
int
code
)
{
if
(
code
==
0
)
if
(
code
==
0
)
...
...
gframe/image_manager.h
View file @
3d5b1523
...
@@ -15,7 +15,6 @@ public:
...
@@ -15,7 +15,6 @@ public:
void
RemoveTexture
(
int
code
);
void
RemoveTexture
(
int
code
);
void
ResizeTexture
();
void
ResizeTexture
();
irr
::
video
::
ITexture
*
GetTextureFromFile
(
char
*
file
,
s32
width
,
s32
height
);
irr
::
video
::
ITexture
*
GetTextureFromFile
(
char
*
file
,
s32
width
,
s32
height
);
irr
::
video
::
ITexture
*
GetTextureUnknown
(
s32
width
,
s32
height
,
int
index
);
irr
::
video
::
ITexture
*
GetTexture
(
int
code
,
bool
fit
=
false
);
irr
::
video
::
ITexture
*
GetTexture
(
int
code
,
bool
fit
=
false
);
irr
::
video
::
ITexture
*
GetTextureThumb
(
int
code
);
irr
::
video
::
ITexture
*
GetTextureThumb
(
int
code
);
irr
::
video
::
ITexture
*
GetTextureField
(
int
code
);
irr
::
video
::
ITexture
*
GetTextureField
(
int
code
);
...
@@ -26,7 +25,9 @@ public:
...
@@ -26,7 +25,9 @@ public:
irr
::
IrrlichtDevice
*
device
;
irr
::
IrrlichtDevice
*
device
;
irr
::
video
::
IVideoDriver
*
driver
;
irr
::
video
::
IVideoDriver
*
driver
;
irr
::
video
::
ITexture
*
tCover
[
4
];
irr
::
video
::
ITexture
*
tCover
[
4
];
irr
::
video
::
ITexture
*
tUnknown
[
3
];
irr
::
video
::
ITexture
*
tUnknown
;
irr
::
video
::
ITexture
*
tUnknownFit
;
irr
::
video
::
ITexture
*
tUnknownThumb
;
irr
::
video
::
ITexture
*
tAct
;
irr
::
video
::
ITexture
*
tAct
;
irr
::
video
::
ITexture
*
tAttack
;
irr
::
video
::
ITexture
*
tAttack
;
irr
::
video
::
ITexture
*
tNegated
;
irr
::
video
::
ITexture
*
tNegated
;
...
...
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