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
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
Commits
393c7072
Commit
393c7072
authored
Nov 04, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
catchup
parent
8a76a76c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
70 deletions
+22
-70
gframe/game.cpp
gframe/game.cpp
+7
-25
gframe/image_manager.cpp
gframe/image_manager.cpp
+15
-45
No files found.
gframe/game.cpp
View file @
393c7072
...
...
@@ -1015,31 +1015,11 @@ void Game::RefreshSingleplay() {
void
Game
::
RefreshLocales
()
{
cbLocale
->
clear
();
cbLocale
->
addItem
(
L"default"
);
#ifdef _WIN32
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
L"./locales/*"
,
&
fdataw
);
if
(
fh
==
INVALID_HANDLE_VALUE
)
return
;
do
{
if
((
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
&&
wcscmp
(
fdataw
.
cFileName
,
L"."
)
&&
wcscmp
(
fdataw
.
cFileName
,
L".."
))
cbLocale
->
addItem
(
fdataw
.
cFileName
);
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./locales/"
))
==
NULL
)
return
;
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
size_t
len
=
strlen
(
dirp
->
d_name
);
wchar_t
wname
[
256
];
BufferIO
::
DecodeUTF8
(
dirp
->
d_name
,
wname
);
if
(
!
wcscmp
(
wname
,
L"."
)
||
!
wcscmp
(
wname
,
L".."
))
continue
;
cbLocale
->
addItem
(
wname
);
}
closedir
(
dir
);
#endif
lstSinglePlayList
->
clear
();
FileSystem
::
TraversalDir
(
L"./locales"
,
[
this
](
const
wchar_t
*
name
,
bool
isdir
)
{
if
(
isdir
&&
wcscmp
(
name
,
L"."
)
&&
wcscmp
(
name
,
L".."
))
lstSinglePlayList
->
addItem
(
name
);
});
for
(
size_t
i
=
0
;
i
<
cbLocale
->
getItemCount
();
++
i
)
{
if
(
!
wcscmp
(
cbLocale
->
getItem
(
i
),
gameConf
.
locale
))
{
cbLocale
->
setSelected
(
i
);
...
...
@@ -2067,6 +2047,8 @@ void Game::FlashWindow() {
#endif
}
void
Game
::
takeScreenshot
()
{
if
(
!
FileSystem
::
IsDirExists
(
L"./screenshots"
)
&&
!
FileSystem
::
MakeDir
(
L"./screenshots"
))
return
;
irr
::
video
::
IImage
*
const
image
=
driver
->
createScreenShot
();
if
(
image
)
{
irr
::
c8
filename
[
64
];
...
...
gframe/image_manager.cpp
View file @
393c7072
#include "image_manager.h"
#include "game.h"
#ifndef _WIN32
#include <dirent.h>
#endif
namespace
ygo
{
...
...
@@ -95,54 +92,27 @@ irr::video::ITexture* ImageManager::GetRandomImage(int image_type, s32 width, s3
return
GetTextureFromFile
(
ImageName
,
width
,
height
);
}
void
ImageManager
::
RefreshRandomImageList
()
{
RefreshImageDir
(
L"bg
/
"
,
TEXTURE_DUEL
);
RefreshImageDir
(
L"bg_duel
/
"
,
TEXTURE_DUEL
);
RefreshImageDir
(
L"bg_deck
/
"
,
TEXTURE_DECK
);
RefreshImageDir
(
L"bg_menu
/
"
,
TEXTURE_MENU
);
RefreshImageDir
(
L"cover
/
"
,
TEXTURE_COVER_S
);
RefreshImageDir
(
L"cover2
/
"
,
TEXTURE_COVER_O
);
RefreshImageDir
(
L"attack
/
"
,
TEXTURE_ATTACK
);
RefreshImageDir
(
L"act
/
"
,
TEXTURE_ACTIVATE
);
RefreshImageDir
(
L"bg"
,
TEXTURE_DUEL
);
RefreshImageDir
(
L"bg_duel"
,
TEXTURE_DUEL
);
RefreshImageDir
(
L"bg_deck"
,
TEXTURE_DECK
);
RefreshImageDir
(
L"bg_menu"
,
TEXTURE_MENU
);
RefreshImageDir
(
L"cover"
,
TEXTURE_COVER_S
);
RefreshImageDir
(
L"cover2"
,
TEXTURE_COVER_O
);
RefreshImageDir
(
L"attack"
,
TEXTURE_ATTACK
);
RefreshImageDir
(
L"act"
,
TEXTURE_ACTIVATE
);
for
(
int
i
=
0
;
i
<
7
;
++
i
)
{
saved_image_id
[
i
]
=
-
1
;
}
}
void
ImageManager
::
RefreshImageDir
(
std
::
wstring
path
,
int
image_type
)
{
#ifdef _WIN32
WIN32_FIND_DATAW
fdataw
;
std
::
wstring
search
=
L"./textures/"
+
path
+
L"*.*"
;
HANDLE
fh
=
FindFirstFileW
(
search
.
c_str
(),
&
fdataw
);
if
(
fh
==
INVALID_HANDLE_VALUE
)
return
;
do
{
size_t
len
=
wcslen
(
fdataw
.
cFileName
);
if
((
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
||
len
<
5
||
!
(
_wcsicmp
(
fdataw
.
cFileName
+
len
-
4
,
L".jpg"
)
==
0
||
_wcsicmp
(
fdataw
.
cFileName
+
len
-
4
,
L".png"
)
==
0
))
continue
;
std
::
wstring
filename
=
path
+
(
std
::
wstring
)
fdataw
.
cFileName
;
ImageList
[
image_type
].
push_back
(
filename
);
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
std
::
wstring
wsearchpath
=
L"./textures/"
+
path
;
char
searchpath
[
256
];
BufferIO
::
EncodeUTF8
(
wsearchpath
.
c_str
(),
searchpath
);
if
((
dir
=
opendir
(
searchpath
))
==
NULL
)
return
;
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
size_t
len
=
strlen
(
dirp
->
d_name
);
if
(
len
<
5
||
!
(
strcasecmp
(
dirp
->
d_name
+
len
-
4
,
".jpg"
)
==
0
||
strcasecmp
(
dirp
->
d_name
+
len
-
4
,
".png"
)))
continue
;
wchar_t
wname
[
256
];
BufferIO
::
DecodeUTF8
(
dirp
->
d_name
,
wname
);
std
::
wstring
filename
=
path
+
(
std
::
wstring
)
wname
;
ImageList
[
image_type
].
push_back
(
filename
);
}
closedir
(
dir
);
#endif
std
::
wstring
search
=
L"./textures/"
+
path
;
FileSystem
::
TraversalDir
(
search
.
c_str
(),
[
this
,
&
path
,
image_type
](
const
wchar_t
*
name
,
bool
isdir
)
{
if
(
!
isdir
&&
(
!
mywcsncasecmp
(
wcsrchr
(
name
,
'.'
),
L".jpg"
,
4
)
||
!
mywcsncasecmp
(
wcsrchr
(
name
,
'.'
),
L".png"
,
4
)))
{
std
::
wstring
filename
=
path
+
L"/"
+
name
;
ImageList
[
image_type
].
push_back
(
filename
);
}
});
}
void
ImageManager
::
SetDevice
(
irr
::
IrrlichtDevice
*
dev
)
{
device
=
dev
;
...
...
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