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
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
REIKAI
ygopro
Commits
f7441a0c
Commit
f7441a0c
authored
Aug 17, 2017
by
Percival18
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utils
parent
f4624eb8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
100 additions
and
1 deletion
+100
-1
gframe/drawing.cpp
gframe/drawing.cpp
+2
-1
gframe/event_handler.cpp
gframe/event_handler.cpp
+23
-0
gframe/game.cpp
gframe/game.cpp
+4
-0
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+7
-0
gframe/utils.cpp
gframe/utils.cpp
+47
-0
gframe/utils.h
gframe/utils.h
+17
-0
No files found.
gframe/drawing.cpp
View file @
f7441a0c
...
...
@@ -1278,7 +1278,8 @@ void Game::DrawDeckBd() {
recti
extrapos
=
mainGame
->
Resize
(
310
,
440
,
797
,
460
);
stringw
extraDeckTypeCount
=
stringw
(
dataManager
.
GetSysString
(
1056
))
+
" "
+
stringw
(
deckManager
.
TypeCount
(
deckManager
.
current_deck
.
extra
,
TYPE_FUSION
))
+
" "
+
stringw
(
dataManager
.
GetSysString
(
1073
))
+
" "
+
stringw
(
deckManager
.
TypeCount
(
deckManager
.
current_deck
.
extra
,
TYPE_XYZ
))
+
" "
+
stringw
(
dataManager
.
GetSysString
(
1063
))
+
" "
+
stringw
(
deckManager
.
TypeCount
(
deckManager
.
current_deck
.
extra
,
TYPE_SYNCHRO
));
stringw
(
dataManager
.
GetSysString
(
1063
))
+
" "
+
stringw
(
deckManager
.
TypeCount
(
deckManager
.
current_deck
.
extra
,
TYPE_SYNCHRO
))
+
" "
+
stringw
(
dataManager
.
GetSysString
(
1076
))
+
" "
+
stringw
(
deckManager
.
TypeCount
(
deckManager
.
current_deck
.
extra
,
TYPE_LINK
));
irr
::
core
::
dimension2d
<
u32
>
extraDeckTypeSize
=
textFont
->
getDimension
(
extraDeckTypeCount
);
textFont
->
draw
(
extraDeckTypeCount
,
recti
(
extrapos
.
LowerRightCorner
.
X
-
extraDeckTypeSize
.
Width
-
5
,
extrapos
.
UpperLeftCorner
.
Y
,
extrapos
.
LowerRightCorner
.
X
,
extrapos
.
LowerRightCorner
.
Y
),
0xff000000
,
false
,
true
);
...
...
gframe/event_handler.cpp
View file @
f7441a0c
...
...
@@ -10,6 +10,7 @@
#include "single_mode.h"
#include "materials.h"
#include "../ocgcore/field.h"
#include "utils.h"
namespace
ygo
{
...
...
@@ -2014,6 +2015,22 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
case
irr
:
:
EET_GUI_EVENT
:
{
s32
id
=
event
.
GUIEvent
.
Caller
->
getID
();
switch
(
event
.
GUIEvent
.
EventType
)
{
case
irr
:
:
gui
::
EGET_ELEMENT_HOVERED
:
{
// Set cursor to an I-Beam if hovering over an edit box
if
(
event
.
GUIEvent
.
Caller
->
getType
()
==
EGUIET_EDIT_BOX
)
{
utils
.
changeCursor
(
ECI_IBEAM
);
}
break
;
}
case
irr
:
:
gui
::
EGET_ELEMENT_LEFT
:
{
// Set cursor to normal if left an edit box
if
(
event
.
GUIEvent
.
Caller
->
getType
()
==
EGUIET_EDIT_BOX
)
{
utils
.
changeCursor
(
ECI_NORMAL
);
}
break
;
}
case
irr
:
:
gui
::
EGET_BUTTON_CLICKED
:
{
switch
(
id
)
{
case
BUTTON_CLEAR_LOG
:
{
...
...
@@ -2091,6 +2108,12 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return
true
;
break
;
}
case
irr
:
:
KEY_F12
:
{
if
(
!
event
.
KeyInput
.
PressedDown
)
utils
.
takeScreenshot
(
mainGame
->
device
);
return
true
;
break
;
}
default:
break
;
}
break
;
...
...
gframe/game.cpp
View file @
f7441a0c
...
...
@@ -9,6 +9,7 @@
#include "netserver.h"
#include "single_mode.h"
#include <sstream>
#include "utils.h"
#ifndef _WIN32
#include <sys/types.h>
...
...
@@ -645,6 +646,9 @@ bool Game::Initialize() {
engineMusic
=
irrklang
::
createIrrKlangDevice
();
hideChat
=
false
;
hideChatTimer
=
0
;
utils
.
initUtils
();
return
true
;
}
void
Game
::
MainLoop
()
{
...
...
gframe/menu_handler.cpp
View file @
f7441a0c
...
...
@@ -7,6 +7,7 @@
#include "single_mode.h"
#include "image_manager.h"
#include "game.h"
#include "utils.h"
namespace
ygo
{
...
...
@@ -515,6 +516,12 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
device
->
minimizeWindow
();
break
;
}
case
irr
:
:
KEY_F12
:
{
if
(
!
event
.
KeyInput
.
PressedDown
)
utils
.
takeScreenshot
(
mainGame
->
device
);
return
true
;
break
;
}
default:
break
;
}
break
;
...
...
gframe/utils.cpp
0 → 100644
View file @
f7441a0c
#include "utils.h"
#include "game.h"
namespace
ygo
{
Utils
utils
;
void
Utils
::
initUtils
()
{
//create directories if missing
#ifdef WIN32
CreateDirectoryW
(
L"deck"
,
NULL
);
CreateDirectoryW
(
L"pics"
,
NULL
);
CreateDirectoryW
(
L"pics/field"
,
NULL
);
CreateDirectoryW
(
L"replay"
,
NULL
);
CreateDirectoryW
(
L"screenshots"
,
NULL
);
#else
#endif
}
void
Utils
::
takeScreenshot
(
irr
::
IrrlichtDevice
*
device
)
{
irr
::
video
::
IVideoDriver
*
const
driver
=
device
->
getVideoDriver
();
//get image from the last rendered frame
irr
::
video
::
IImage
*
const
image
=
driver
->
createScreenShot
();
if
(
image
)
//should always be true, but you never know. ;)
{
//construct a filename, consisting of local time and file extension
irr
::
c8
filename
[
64
];
snprintf
(
filename
,
64
,
"screenshots/ygopro_%u.png"
,
device
->
getTimer
()
->
getRealTime
());
//write screenshot to file
if
(
!
driver
->
writeImageToFile
(
image
,
filename
))
device
->
getLogger
()
->
log
(
L"Failed to take screenshot."
,
irr
::
ELL_WARNING
);
//Don't forget to drop image since we don't need it anymore.
image
->
drop
();
}
}
void
Utils
::
changeCursor
(
ECURSOR_ICON
icon
)
{
gui
::
ICursorControl
*
cursor
=
mainGame
->
device
->
getCursorControl
();
if
(
cursor
->
getActiveIcon
()
!=
icon
)
{
cursor
->
setActiveIcon
(
icon
);
}
}
}
\ No newline at end of file
gframe/utils.h
0 → 100644
View file @
f7441a0c
#pragma once
#ifndef UTILS_H
#define UTILS_H
#include "config.h"
namespace
ygo
{
class
Utils
{
public:
void
initUtils
();
void
takeScreenshot
(
irr
::
IrrlichtDevice
*
device
);
void
changeCursor
(
ECURSOR_ICON
icon
);
};
extern
Utils
utils
;
}
#endif //UTILS_H
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