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
86a9c9aa
Commit
86a9c9aa
authored
Oct 13, 2020
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
screenshot time
parent
cff90c93
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
gframe/game.cpp
gframe/game.cpp
+20
-4
No files found.
gframe/game.cpp
View file @
86a9c9aa
...
@@ -2188,17 +2188,33 @@ void Game::FlashWindow() {
...
@@ -2188,17 +2188,33 @@ void Game::FlashWindow() {
FlashWindowEx
(
&
fi
);
FlashWindowEx
(
&
fi
);
#endif
#endif
}
}
void
printTimeDiff
(
timeval
tv1
,
timeval
tv2
,
const
char
*
prefix
)
{
const
time_t
time1
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
const
time_t
time2
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
printf
(
"%s: %d
\n
"
,
prefix
,
time2
-
time1
);
}
void
Game
::
takeScreenshot
()
{
void
Game
::
takeScreenshot
()
{
if
(
!
FileSystem
::
IsDirExists
(
L"./screenshots"
)
&&
!
FileSystem
::
MakeDir
(
L"./screenshots"
))
if
(
!
FileSystem
::
IsDirExists
(
L"./screenshots"
)
&&
!
FileSystem
::
MakeDir
(
L"./screenshots"
))
return
;
return
;
irr
::
video
::
IImage
*
const
image
=
driver
->
createScreenShot
();
timeval
t1
;
if
(
image
)
{
timeval
t2
;
timeval
t3
;
gettimeofday
(
&
t1
,
NULL
);
irr
::
video
::
IImage
*
const
image
=
driver
->
createScreenShot
();
gettimeofday
(
&
t2
,
NULL
);
printTimeDiff
(
t1
,
t2
,
"Screenshot time"
);
if
(
image
)
{
irr
::
c8
filename
[
64
];
irr
::
c8
filename
[
64
];
snprintf
(
filename
,
64
,
"screenshots/ygopro_%u.
png
"
,
device
->
getTimer
()
->
getRealTime
());
snprintf
(
filename
,
64
,
"screenshots/ygopro_%u.
bmp
"
,
device
->
getTimer
()
->
getRealTime
());
if
(
!
driver
->
writeImageToFile
(
image
,
filename
))
if
(
!
driver
->
writeImageToFile
(
image
,
filename
))
device
->
getLogger
()
->
log
(
L"Failed to take screenshot."
,
irr
::
ELL_WARNING
);
device
->
getLogger
()
->
log
(
L"Failed to take screenshot."
,
irr
::
ELL_WARNING
);
image
->
drop
();
image
->
drop
();
}
else
gettimeofday
(
&
t3
,
NULL
);
printTimeDiff
(
t2
,
t3
,
"Save time"
);
printTimeDiff
(
t1
,
t3
,
"Total time"
);
}
else
device
->
getLogger
()
->
log
(
L"Failed to take screenshot."
,
irr
::
ELL_WARNING
);
device
->
getLogger
()
->
log
(
L"Failed to take screenshot."
,
irr
::
ELL_WARNING
);
}
}
bool
Game
::
CheckRegEx
(
const
std
::
wstring
&
text
,
const
std
::
wstring
&
exp
,
bool
exact
)
{
bool
Game
::
CheckRegEx
(
const
std
::
wstring
&
text
,
const
std
::
wstring
&
exp
,
bool
exact
)
{
...
...
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