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
1
Merge Requests
1
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
57914b4c
Commit
57914b4c
authored
Feb 05, 2026
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dynamically build trying route
parent
1274720b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
60 deletions
+47
-60
gframe/image_manager.cpp
gframe/image_manager.cpp
+43
-60
gframe/image_manager.h
gframe/image_manager.h
+4
-0
No files found.
gframe/image_manager.cpp
View file @
57914b4c
...
@@ -8,6 +8,9 @@
...
@@ -8,6 +8,9 @@
namespace
ygo
{
namespace
ygo
{
const
char
*
const
ImageManager
::
SUPPORTED_EXTENSIONS
[]
=
{
"png"
,
"jpg"
};
const
size_t
ImageManager
::
SUPPORTED_EXTENSIONS_COUNT
=
sizeof
(
SUPPORTED_EXTENSIONS
)
/
sizeof
(
SUPPORTED_EXTENSIONS
[
0
]);
ImageManager
imageManager
;
ImageManager
imageManager
;
bool
ImageManager
::
Initial
()
{
bool
ImageManager
::
Initial
()
{
...
@@ -321,35 +324,27 @@ irr::video::ITexture* ImageManager::GetTextureFromFile(const char* file, irr::s3
...
@@ -321,35 +324,27 @@ irr::video::ITexture* ImageManager::GetTextureFromFile(const char* file, irr::s3
* Files in the expansions directory have priority, allowing custom pictures to be loaded without modifying the original files.
* Files in the expansions directory have priority, allowing custom pictures to be loaded without modifying the original files.
* @return Image pointer. Must be dropped after use. */
* @return Image pointer. Must be dropped after use. */
irr
::
video
::
IImage
*
ImageManager
::
GetImage
(
int
code
)
{
irr
::
video
::
IImage
*
ImageManager
::
GetImage
(
int
code
)
{
char
file
[
256
];
// Build path prefix list
irr
::
video
::
IImage
*
img
=
nullptr
;
std
::
vector
<
std
::
string
>
basePaths
;
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
())
{
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
())
{
if
(
img
==
nullptr
)
{
basePaths
.
push_back
(
ex
+
"/"
);
mysnprintf
(
file
,
"%s/pics/%d.png"
,
ex
.
c_str
(),
code
);
img
=
driver
->
createImageFromFile
(
file
);
}
if
(
img
==
nullptr
)
{
mysnprintf
(
file
,
"%s/pics/%d.jpg"
,
ex
.
c_str
(),
code
);
img
=
driver
->
createImageFromFile
(
file
);
}
}
if
(
img
==
nullptr
)
{
mysnprintf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.png"
),
code
);
img
=
driver
->
createImageFromFile
(
file
);
}
if
(
img
==
nullptr
)
{
mysnprintf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.jpg"
),
code
);
img
=
driver
->
createImageFromFile
(
file
);
}
}
if
(
img
==
nullptr
)
{
basePaths
.
push_back
(
mainGame
->
GetLocaleDir
(
""
));
mysnprintf
(
file
,
"pics/%d.png"
,
code
);
basePaths
.
push_back
(
""
);
img
=
driver
->
createImageFromFile
(
file
);
}
// Try all combinations
if
(
img
==
nullptr
)
{
char
file
[
256
];
mysnprintf
(
file
,
"pics/%d.jpg"
,
code
);
for
(
const
auto
&
base
:
basePaths
)
{
img
=
driver
->
createImageFromFile
(
file
);
for
(
size_t
i
=
0
;
i
<
SUPPORTED_EXTENSIONS_COUNT
;
++
i
)
{
mysnprintf
(
file
,
"%spics/%d.%s"
,
base
.
c_str
(),
code
,
SUPPORTED_EXTENSIONS
[
i
]);
irr
::
video
::
IImage
*
img
=
driver
->
createImageFromFile
(
file
);
if
(
img
!=
nullptr
)
{
return
img
;
}
}
}
}
return
img
;
return
nullptr
;
}
}
/** Load card picture.
/** Load card picture.
* @return Texture pointer. Remove via `driver->removeTexture` (do not `drop`). */
* @return Texture pointer. Remove via `driver->removeTexture` (do not `drop`). */
...
@@ -505,44 +500,32 @@ irr::video::ITexture* ImageManager::GetTextureField(int code) {
...
@@ -505,44 +500,32 @@ irr::video::ITexture* ImageManager::GetTextureField(int code) {
if
(
tit
==
tFields
.
end
())
{
if
(
tit
==
tFields
.
end
())
{
irr
::
s32
width
=
512
*
mainGame
->
xScale
;
irr
::
s32
width
=
512
*
mainGame
->
xScale
;
irr
::
s32
height
=
512
*
mainGame
->
yScale
;
irr
::
s32
height
=
512
*
mainGame
->
yScale
;
char
file
[
256
];
irr
::
video
::
ITexture
*
img
=
nullptr
;
// Build path prefix list
std
::
vector
<
std
::
string
>
basePaths
;
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
())
{
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
())
{
if
(
img
==
nullptr
)
{
basePaths
.
push_back
(
ex
+
"/"
);
mysnprintf
(
file
,
"%s/pics/field/%d.png"
,
ex
.
c_str
(),
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
if
(
img
==
nullptr
)
{
mysnprintf
(
file
,
"%s/pics/field/%d.jpg"
,
ex
.
c_str
(),
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
}
if
(
img
==
nullptr
)
{
mysnprintf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/field/%d.png"
),
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
if
(
img
==
nullptr
)
{
mysnprintf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/field/%d.jpg"
),
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
if
(
img
==
nullptr
)
{
mysnprintf
(
file
,
"pics/field/%d.png"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
}
if
(
img
==
nullptr
)
{
basePaths
.
push_back
(
mainGame
->
GetLocaleDir
(
""
));
mysnprintf
(
file
,
"pics/field/%d.jpg"
,
code
);
basePaths
.
push_back
(
""
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
if
(
img
==
nullptr
)
{
// Try all combinations
tFields
[
code
]
=
nullptr
;
char
file
[
256
];
return
nullptr
;
irr
::
video
::
ITexture
*
img
=
nullptr
;
}
else
{
for
(
const
auto
&
base
:
basePaths
)
{
tFields
[
code
]
=
img
;
for
(
size_t
i
=
0
;
i
<
SUPPORTED_EXTENSIONS_COUNT
;
++
i
)
{
return
img
;
mysnprintf
(
file
,
"%spics/field/%d.%s"
,
base
.
c_str
(),
code
,
SUPPORTED_EXTENSIONS
[
i
]);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
if
(
img
!=
nullptr
)
{
tFields
[
code
]
=
img
;
return
img
;
}
}
}
}
else
{
tFields
[
code
]
=
img
;
return
img
;
}
}
// Not found
tFields
[
code
]
=
nullptr
;
return
nullptr
;
}
}
if
(
tit
->
second
)
if
(
tit
->
second
)
return
tit
->
second
;
return
tit
->
second
;
...
...
gframe/image_manager.h
View file @
57914b4c
...
@@ -13,6 +13,10 @@ class ImageManager {
...
@@ -13,6 +13,10 @@ class ImageManager {
private:
private:
irr
::
video
::
ITexture
*
addTexture
(
const
char
*
name
,
irr
::
video
::
IImage
*
srcimg
,
irr
::
s32
width
,
irr
::
s32
height
);
irr
::
video
::
ITexture
*
addTexture
(
const
char
*
name
,
irr
::
video
::
IImage
*
srcimg
,
irr
::
s32
width
,
irr
::
s32
height
);
public:
public:
// Supported image file extensions
static
const
char
*
const
SUPPORTED_EXTENSIONS
[];
static
const
size_t
SUPPORTED_EXTENSIONS_COUNT
;
std
::
vector
<
std
::
wstring
>
ImageList
[
7
];
std
::
vector
<
std
::
wstring
>
ImageList
[
7
];
int
saved_image_id
[
7
];
int
saved_image_id
[
7
];
bool
Initial
();
bool
Initial
();
...
...
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