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
fddc6cf4
Commit
fddc6cf4
authored
Nov 03, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
subdir for pics
parent
1fd5c87b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
16 deletions
+62
-16
gframe/image_manager.cpp
gframe/image_manager.cpp
+60
-16
gframe/image_manager.h
gframe/image_manager.h
+2
-0
No files found.
gframe/image_manager.cpp
View file @
fddc6cf4
...
...
@@ -325,6 +325,50 @@ irr::video::ITexture* ImageManager::GetTextureUnknown(s32 width, s32 height, int
tUnknown
[
index
]
=
GetTextureFromFile
(
"textures/unknown.jpg"
,
width
,
height
);
return
tUnknown
[
index
];
}
irr
::
video
::
ITexture
*
ImageManager
::
GetTextureExpansions
(
char
*
file
,
s32
width
,
s32
height
)
{
irr
::
video
::
ITexture
*
img
=
GetTextureExpansionsDirectry
(
"./expansions"
,
file
,
width
,
height
);
if
(
img
!=
NULL
)
return
img
;
#ifdef _WIN32
char
fpath
[
1000
];
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
L"./expansions/*"
,
&
fdataw
);
if
(
fh
!=
INVALID_HANDLE_VALUE
)
{
do
{
if
((
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
{
char
fname
[
780
];
BufferIO
::
EncodeUTF8
(
fdataw
.
cFileName
,
fname
);
sprintf
(
fpath
,
"./expansions/%s"
,
fname
);
img
=
GetTextureExpansionsDirectry
(
fpath
,
file
,
width
,
height
);
if
(
img
!=
NULL
)
return
img
;
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./expansions/"
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
if
(
dirp
->
d_type
!=
DT_DIR
)
continue
;
char
filepath
[
1000
];
sprintf
(
filepath
,
"./expansions/%s/"
,
dirp
->
d_name
);
img
=
GetTextureExpansionsDirectry
(
filepath
,
file
,
width
,
height
);
if
(
img
!=
NULL
)
return
img
;
}
closedir
(
dir
);
}
#endif
return
img
;
}
irr
::
video
::
ITexture
*
ImageManager
::
GetTextureExpansionsDirectry
(
const
char
*
path
,
char
*
file
,
s32
width
,
s32
height
)
{
char
fpath
[
1000
];
sprintf
(
fpath
,
"%s/%s"
,
path
,
file
);
return
GetTextureFromFile
(
fpath
,
width
,
height
);
}
irr
::
video
::
ITexture
*
ImageManager
::
GetTexture
(
int
code
,
bool
fit
)
{
int
width
=
CARD_IMG_WIDTH
;
int
height
=
CARD_IMG_HEIGHT
;
...
...
@@ -340,11 +384,11 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
auto
tit
=
tMap
[
fit
?
1
:
0
].
find
(
code
);
if
(
tit
==
tMap
[
fit
?
1
:
0
].
end
())
{
char
file
[
256
];
sprintf
(
file
,
"
expansions/
pics/%d.png"
,
code
);
irr
::
video
::
ITexture
*
img
=
GetTexture
FromFile
(
file
,
width
,
height
);
sprintf
(
file
,
"pics/%d.png"
,
code
);
irr
::
video
::
ITexture
*
img
=
GetTexture
Expansions
(
file
,
width
,
height
);
if
(
img
==
NULL
)
{
sprintf
(
file
,
"
expansions/
pics/%d.jpg"
,
code
);
img
=
GetTexture
FromFile
(
file
,
width
,
height
);
sprintf
(
file
,
"pics/%d.jpg"
,
code
);
img
=
GetTexture
Expansions
(
file
,
width
,
height
);
}
if
(
img
==
NULL
)
{
sprintf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.png"
),
code
);
...
...
@@ -382,11 +426,11 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
return
GetTextureUnknown
(
width
,
height
,
2
);
if
(
tit
==
tThumb
.
end
())
{
char
file
[
256
];
sprintf
(
file
,
"
expansions/
pics/thumbnail/%d.png"
,
code
);
irr
::
video
::
ITexture
*
img
=
GetTexture
FromFile
(
file
,
width
,
height
);
sprintf
(
file
,
"pics/thumbnail/%d.png"
,
code
);
irr
::
video
::
ITexture
*
img
=
GetTexture
Expansions
(
file
,
width
,
height
);
if
(
img
==
NULL
)
{
sprintf
(
file
,
"
expansions/
pics/thumbnail/%d.jpg"
,
code
);
img
=
GetTexture
FromFile
(
file
,
width
,
height
);
sprintf
(
file
,
"pics/thumbnail/%d.jpg"
,
code
);
img
=
GetTexture
Expansions
(
file
,
width
,
height
);
}
if
(
img
==
NULL
)
{
sprintf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/thumbnail/%d.png"
),
code
);
...
...
@@ -405,11 +449,11 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
NULL
&&
mainGame
->
gameConf
.
use_image_scale
)
{
sprintf
(
file
,
"
expansions/
pics/%d.png"
,
code
);
img
=
GetTexture
FromFile
(
file
,
width
,
height
);
sprintf
(
file
,
"pics/%d.png"
,
code
);
img
=
GetTexture
Expansions
(
file
,
width
,
height
);
if
(
img
==
NULL
)
{
sprintf
(
file
,
"
expansions/
pics/%d.jpg"
,
code
);
img
=
GetTexture
FromFile
(
file
,
width
,
height
);
sprintf
(
file
,
"pics/%d.jpg"
,
code
);
img
=
GetTexture
Expansions
(
file
,
width
,
height
);
}
if
(
img
==
NULL
)
{
sprintf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.png"
),
code
);
...
...
@@ -442,11 +486,11 @@ irr::video::ITexture* ImageManager::GetTextureField(int code) {
auto
tit
=
tFields
.
find
(
code
);
if
(
tit
==
tFields
.
end
())
{
char
file
[
256
];
sprintf
(
file
,
"
expansions/
pics/field/%d.png"
,
code
);
irr
::
video
::
ITexture
*
img
=
GetTexture
FromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
sprintf
(
file
,
"pics/field/%d.png"
,
code
);
irr
::
video
::
ITexture
*
img
=
GetTexture
Expansions
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
if
(
img
==
NULL
)
{
sprintf
(
file
,
"
expansions/
pics/field/%d.jpg"
,
code
);
img
=
GetTexture
FromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
sprintf
(
file
,
"pics/field/%d.jpg"
,
code
);
img
=
GetTexture
Expansions
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
if
(
img
==
NULL
)
{
sprintf
(
file
,
"pics/field/%d.png"
,
code
);
...
...
gframe/image_manager.h
View file @
fddc6cf4
...
...
@@ -23,6 +23,8 @@ public:
void
ResizeTexture
();
irr
::
video
::
ITexture
*
GetTextureFromFile
(
char
*
file
,
s32
width
,
s32
height
);
irr
::
video
::
ITexture
*
GetTextureUnknown
(
s32
width
,
s32
height
,
int
index
);
irr
::
video
::
ITexture
*
GetTextureExpansions
(
char
*
file
,
s32
width
,
s32
height
);
irr
::
video
::
ITexture
*
GetTextureExpansionsDirectry
(
const
char
*
path
,
char
*
file
,
s32
width
,
s32
height
);
irr
::
video
::
ITexture
*
GetTexture
(
int
code
,
bool
fit
=
false
);
irr
::
video
::
ITexture
*
GetTextureThumb
(
int
code
);
irr
::
video
::
ITexture
*
GetTextureField
(
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