Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
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
fallenstardust
YGOMobile-Cn-Ko-En
Commits
826d0df9
Commit
826d0df9
authored
Mar 03, 2025
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update Gframe
parent
82b242e1
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
74 additions
and
61 deletions
+74
-61
Classes/gframe/CGUIImageButton.cpp
Classes/gframe/CGUIImageButton.cpp
+5
-5
Classes/gframe/CGUIImageButton.h
Classes/gframe/CGUIImageButton.h
+2
-2
Classes/gframe/CGUITTFont.cpp
Classes/gframe/CGUITTFont.cpp
+3
-3
Classes/gframe/data_manager.cpp
Classes/gframe/data_manager.cpp
+3
-1
Classes/gframe/deck_con.cpp
Classes/gframe/deck_con.cpp
+4
-4
Classes/gframe/deck_con.h
Classes/gframe/deck_con.h
+3
-3
Classes/gframe/drawing.cpp
Classes/gframe/drawing.cpp
+11
-10
Classes/gframe/event_handler.cpp
Classes/gframe/event_handler.cpp
+18
-18
Classes/gframe/game.cpp
Classes/gframe/game.cpp
+17
-8
Classes/gframe/game.h
Classes/gframe/game.h
+5
-4
Classes/gframe/menu_handler.h
Classes/gframe/menu_handler.h
+3
-3
No files found.
Classes/gframe/CGUIImageButton.cpp
View file @
826d0df9
...
...
@@ -11,7 +11,7 @@ namespace irr {
namespace
gui
{
void
Draw2DImageRotation
(
video
::
IVideoDriver
*
driver
,
video
::
ITexture
*
image
,
core
::
rect
<
s32
>
sourceRect
,
core
::
position2d
<
s32
>
position
,
core
::
position
2d
<
s32
>
rotationPoint
,
f32
rotation
,
core
::
vector2df
scale
,
bool
useAlphaChannel
,
video
::
SColor
color
)
{
core
::
vector2d
<
s32
>
position
,
core
::
vector
2d
<
s32
>
rotationPoint
,
f32
rotation
,
core
::
vector2df
scale
,
bool
useAlphaChannel
,
video
::
SColor
color
)
{
irr
::
video
::
SMaterial
material
;
irr
::
core
::
matrix4
oldProjMat
=
driver
->
getTransform
(
irr
::
video
::
ETS_PROJECTION
);
driver
->
setTransform
(
irr
::
video
::
ETS_PROJECTION
,
irr
::
core
::
matrix4
());
...
...
@@ -70,7 +70,7 @@ void Draw2DImageRotation(video::IVideoDriver* driver, video::ITexture* image, co
driver
->
setTransform
(
irr
::
video
::
ETS_VIEW
,
oldViewMat
);
}
void
Draw2DImageQuad
(
video
::
IVideoDriver
*
driver
,
video
::
ITexture
*
image
,
core
::
rect
<
s32
>
sourceRect
,
core
::
position
2d
<
s32
>
corner
[
4
],
bool
useAlphaChannel
,
video
::
SColor
color
)
{
core
::
vector
2d
<
s32
>
corner
[
4
],
bool
useAlphaChannel
,
video
::
SColor
color
)
{
irr
::
video
::
SMaterial
material
;
irr
::
core
::
matrix4
oldProjMat
=
driver
->
getTransform
(
irr
::
video
::
ETS_PROJECTION
);
driver
->
setTransform
(
irr
::
video
::
ETS_PROJECTION
,
irr
::
core
::
matrix4
());
...
...
@@ -136,8 +136,8 @@ void CGUIImageButton::draw() {
return
;
IGUISkin
*
skin
=
Environment
->
getSkin
();
video
::
IVideoDriver
*
driver
=
Environment
->
getVideoDriver
();
core
::
position
2di
center
=
AbsoluteRect
.
getCenter
();
core
::
position
2di
pos
=
center
;
core
::
vector
2di
center
=
AbsoluteRect
.
getCenter
();
core
::
vector
2di
pos
=
center
;
pos
.
X
-=
(
s32
)(
ImageRect
.
getWidth
()
*
imageScale
.
X
*
0.5
f
);
pos
.
Y
-=
(
s32
)(
ImageRect
.
getHeight
()
*
imageScale
.
Y
*
0.5
f
);
if
(
Pressed
)
{
...
...
@@ -164,7 +164,7 @@ void CGUIImageButton::setImage(video::ITexture* image)
Image
=
image
;
if
(
image
)
{
ImageRect
=
core
::
rect
<
s32
>
(
core
::
position
2d
<
s32
>
(
0
,
0
),
image
->
getOriginalSize
());
ImageRect
=
core
::
rect
<
s32
>
(
core
::
vector
2d
<
s32
>
(
0
,
0
),
image
->
getOriginalSize
());
if
(
isFixedSize
)
imageScale
=
core
::
vector2df
((
irr
::
f32
)
imageSize
.
Width
/
image
->
getSize
().
Width
,
(
irr
::
f32
)
imageSize
.
Height
/
image
->
getSize
().
Height
);
}
...
...
Classes/gframe/CGUIImageButton.h
View file @
826d0df9
...
...
@@ -8,10 +8,10 @@ namespace irr {
namespace
gui
{
void
Draw2DImageRotation
(
video
::
IVideoDriver
*
driver
,
video
::
ITexture
*
image
,
core
::
rect
<
s32
>
sourceRect
,
core
::
position2d
<
s32
>
position
,
core
::
position
2d
<
s32
>
rotationPoint
,
f32
rotation
=
0.0
f
,
core
::
vector2d
<
s32
>
position
,
core
::
vector
2d
<
s32
>
rotationPoint
,
f32
rotation
=
0.0
f
,
core
::
vector2df
scale
=
core
::
vector2df
(
1.0
,
1.0
),
bool
useAlphaChannel
=
true
,
video
::
SColor
color
=
0xffffffff
);
void
Draw2DImageQuad
(
video
::
IVideoDriver
*
driver
,
video
::
ITexture
*
image
,
core
::
rect
<
s32
>
sourceRect
,
core
::
position
2d
<
s32
>
corner
[
4
],
bool
useAlphaChannel
=
true
,
video
::
SColor
color
=
0xffffffff
);
core
::
vector
2d
<
s32
>
corner
[
4
],
bool
useAlphaChannel
=
true
,
video
::
SColor
color
=
0xffffffff
);
class
CGUIImageButton
:
public
CGUIButton
{
public:
CGUIImageButton
(
IGUIEnvironment
*
environment
,
IGUIElement
*
parent
,
s32
id
,
core
::
rect
<
s32
>
rectangle
);
...
...
Classes/gframe/CGUITTFont.cpp
View file @
826d0df9
...
...
@@ -505,7 +505,7 @@ void CGUITTFont::drawUstring(const core::ustring& utext, const core::rect<s32>&p
// Set up some variables.
core
::
dimension2d
<
s32
>
textDimension
;
core
::
position
2d
<
s32
>
offset
=
position
.
UpperLeftCorner
;
core
::
vector
2d
<
s32
>
offset
=
position
.
UpperLeftCorner
;
// Determine offset positions.
if
(
hcenter
||
vcenter
)
{
...
...
@@ -561,7 +561,7 @@ void CGUITTFont::drawUstring(const core::ustring& utext, const core::rect<s32>&p
// Determine rendering information.
SGUITTGlyph
&
glyph
=
Glyphs
[
n
-
1
];
CGUITTGlyphPage
*
const
page
=
Glyph_Pages
[
glyph
.
glyph_page
];
page
->
render_positions
.
push_back
(
core
::
position
2di
(
offset
.
X
+
offx
,
offset
.
Y
+
offy
));
page
->
render_positions
.
push_back
(
core
::
vector
2di
(
offset
.
X
+
offx
,
offset
.
Y
+
offy
));
page
->
render_source_rects
.
push_back
(
glyph
.
source_rect
);
Render_Map
.
set
(
glyph
.
glyph_page
,
page
);
}
...
...
@@ -832,7 +832,7 @@ video::IImage* CGUITTFont::createTextureFromChar(const uchar32_t& ch) {
// Copy the image data out of the page texture.
core
::
dimension2du
glyph_size
(
glyph
.
source_rect
.
getSize
());
video
::
IImage
*
image
=
Driver
->
createImage
(
format
,
glyph_size
);
pageholder
->
copyTo
(
image
,
core
::
position
2di
(
0
,
0
),
glyph
.
source_rect
);
pageholder
->
copyTo
(
image
,
core
::
vector
2di
(
0
,
0
),
glyph
.
source_rect
);
tex
->
unlock
();
return
image
;
...
...
Classes/gframe/data_manager.cpp
View file @
826d0df9
...
...
@@ -422,7 +422,9 @@ unsigned char* DataManager::ReadScriptFromIrrFS(const char* script_name, int* sl
return
scriptBuffer
;
}
unsigned
char
*
DataManager
::
ReadScriptFromFile
(
const
char
*
script_name
,
int
*
slen
)
{
FILE
*
fp
=
std
::
fopen
(
script_name
,
"rb"
);
wchar_t
fname
[
256
]{};
BufferIO
::
DecodeUTF8
(
script_name
,
fname
);
FILE
*
fp
=
mywfopen
(
fname
,
"rb"
);
if
(
!
fp
)
return
nullptr
;
size_t
len
=
std
::
fread
(
scriptBuffer
,
1
,
sizeof
scriptBuffer
,
fp
);
...
...
Classes/gframe/deck_con.cpp
View file @
826d0df9
...
...
@@ -136,14 +136,14 @@ void DeckBuilder::Terminate() {
mainGame
->
scrPackCards
->
setPos
(
0
);
int
catesel
=
mainGame
->
cbDBCategory
->
getSelected
();
char
linebuf
[
256
];
if
(
catesel
>=
0
)
BufferIO
::
CopyW
Str
(
mainGame
->
cbDBCategory
->
getItem
(
catesel
),
mainGame
->
gameConf
.
lastcategory
,
64
);
if
(
catesel
>=
0
)
BufferIO
::
CopyW
ideString
(
mainGame
->
cbDBCategory
->
getItem
(
catesel
),
mainGame
->
gameConf
.
lastcategory
);
BufferIO
::
EncodeUTF8
(
mainGame
->
gameConf
.
lastcategory
,
linebuf
);
android
::
setLastCategory
(
mainGame
->
appMain
,
linebuf
);
//irr:os::Printer::log("setLastCategory", linebuf);
int
decksel
=
mainGame
->
cbDBDecks
->
getSelected
();
if
(
decksel
>=
0
)
BufferIO
::
CopyW
Str
(
mainGame
->
cbDBDecks
->
getItem
(
decksel
),
mainGame
->
gameConf
.
lastdeck
,
64
);
if
(
decksel
>=
0
)
BufferIO
::
CopyW
ideString
(
mainGame
->
cbDBDecks
->
getItem
(
decksel
),
mainGame
->
gameConf
.
lastdeck
);
BufferIO
::
EncodeUTF8
(
mainGame
->
gameConf
.
lastdeck
,
linebuf
);
android
::
setLastDeck
(
mainGame
->
appMain
,
linebuf
);
//os::Printer::log("setLastDeck", linebuf);
...
...
Classes/gframe/deck_con.h
View file @
826d0df9
#ifndef DECK_CON_H
#define DECK_CON_H
#include "config.h"
#include <unordered_map>
#include <vector>
#include <irrlicht.h>
#include "data_manager.h"
#include "../ocgcore/mtrandom.h"
#ifdef _IRR_ANDROID_PLATFORM_
...
...
@@ -57,7 +57,7 @@ public:
unsigned
int
filter_scl
{};
unsigned
int
filter_marks
{};
int
filter_lm
{};
position
2di
mouse_pos
;
irr
::
core
::
vector
2di
mouse_pos
;
int
hovered_code
{};
int
hovered_pos
{};
int
hovered_seq
{
-
1
};
...
...
@@ -75,7 +75,7 @@ public:
code_pointer
draging_pointer
;
int
prev_category
{};
int
prev_deck
{};
s32
prev_operation
{};
irr
::
s32
prev_operation
{};
int
prev_sel
{
-
1
};
bool
is_modified
{};
bool
readonly
{};
...
...
Classes/gframe/drawing.cpp
View file @
826d0df9
...
...
@@ -43,6 +43,7 @@ void Game::DrawSelectionLine(irr::video::S3DVertex* vec, bool strip, int width,
driver
->
draw3DLine
(
vec
[
3
].
Pos
,
vec
[
2
].
Pos
);
driver
->
draw3DLine
(
vec
[
2
].
Pos
,
vec
[
0
].
Pos
);
}
}
void
Game
::
DrawSelectionLine
(
irr
::
gui
::
IGUIElement
*
element
,
int
width
,
irr
::
video
::
SColor
color
)
{
recti
pos
=
element
->
getAbsolutePosition
();
...
...
@@ -896,12 +897,12 @@ void Game::DrawSpec() {
break
;
}
case
7
:
{
//show normal summoning
core
::
position
2d
<
s32
>
corner
[
4
];
irr
::
core
::
vector
2d
<
s32
>
corner
[
4
];
float
y
=
sin
(
showcarddif
*
3.1415926
f
/
180.0
f
)
*
CARD_IMG_HEIGHT
*
mainGame
->
yScale
;
corner
[
0
]
=
core
::
position
2d
<
s32
>
(
660
*
xScale
-
(
CARD_IMG_WIDTH
/
2
)
*
yScale
-
(
CARD_IMG_HEIGHT
*
mainGame
->
yScale
-
y
)
*
0.3
f
,
404
*
mainGame
->
yScale
-
y
);
corner
[
1
]
=
core
::
position
2d
<
s32
>
(
660
*
xScale
+
(
CARD_IMG_WIDTH
/
2
)
*
yScale
+
(
CARD_IMG_HEIGHT
*
mainGame
->
yScale
-
y
)
*
0.3
f
,
404
*
mainGame
->
yScale
-
y
);
corner
[
2
]
=
core
::
position
2d
<
s32
>
(
660
*
xScale
-
(
CARD_IMG_WIDTH
/
2
)
*
yScale
,
404
*
mainGame
->
yScale
);
corner
[
3
]
=
core
::
position
2d
<
s32
>
(
660
*
xScale
+
(
CARD_IMG_WIDTH
/
2
)
*
yScale
,
404
*
mainGame
->
yScale
);
corner
[
0
]
=
irr
::
core
::
vector
2d
<
s32
>
(
660
*
xScale
-
(
CARD_IMG_WIDTH
/
2
)
*
yScale
-
(
CARD_IMG_HEIGHT
*
mainGame
->
yScale
-
y
)
*
0.3
f
,
404
*
mainGame
->
yScale
-
y
);
corner
[
1
]
=
irr
::
core
::
vector
2d
<
s32
>
(
660
*
xScale
+
(
CARD_IMG_WIDTH
/
2
)
*
yScale
+
(
CARD_IMG_HEIGHT
*
mainGame
->
yScale
-
y
)
*
0.3
f
,
404
*
mainGame
->
yScale
-
y
);
corner
[
2
]
=
irr
::
core
::
vector
2d
<
s32
>
(
660
*
xScale
-
(
CARD_IMG_WIDTH
/
2
)
*
yScale
,
404
*
mainGame
->
yScale
);
corner
[
3
]
=
irr
::
core
::
vector
2d
<
s32
>
(
660
*
xScale
+
(
CARD_IMG_WIDTH
/
2
)
*
yScale
,
404
*
mainGame
->
yScale
);
irr
::
gui
::
Draw2DImageQuad
(
driver
,
showimg
,
rect
<
s32
>
(
0
,
0
,
orisize
.
Width
,
orisize
.
Height
),
corner
);
showcardp
++
;
showcarddif
+=
9
;
...
...
@@ -1039,7 +1040,7 @@ void Game::DrawSpec() {
recti
rectloc
(
x
,
y
-
chatRectY
-
h
,
x
+
2
+
w
,
y
-
chatRectY
);
recti
msgloc
(
x
,
y
-
chatRectY
-
h
,
x
-
4
,
y
-
chatRectY
);
recti
shadowloc
=
msgloc
+
position
2di
(
1
,
1
);
recti
shadowloc
=
msgloc
+
irr
::
core
::
vector
2di
(
1
,
1
);
driver
->
draw2DRectangle
(
rectloc
,
0xa0000000
,
0xa0000000
,
0xa0000000
,
0xa0000000
);
guiFont
->
drawUstring
(
msg
,
msgloc
,
0xff000000
,
false
,
false
);
...
...
@@ -1060,7 +1061,7 @@ void Game::ShowElement(irr::gui::IGUIElement * win, int autoframe) {
for
(
auto
fit
=
fadingList
.
begin
();
fit
!=
fadingList
.
end
();
++
fit
)
if
(
win
==
fit
->
guiFading
&&
win
!=
wOptions
&&
win
!=
wANNumber
)
// the size of wOptions is always setted by ClientField::ShowSelectOption before showing it
fu
.
fadingSize
=
fit
->
fadingSize
;
irr
::
core
::
position
2di
center
=
fu
.
fadingSize
.
getCenter
();
irr
::
core
::
vector
2di
center
=
fu
.
fadingSize
.
getCenter
();
fu
.
fadingDiff
.
X
=
fu
.
fadingSize
.
getWidth
()
/
10
;
fu
.
fadingDiff
.
Y
=
(
fu
.
fadingSize
.
getHeight
()
-
4
)
/
10
;
fu
.
fadingUL
=
center
;
...
...
@@ -1145,7 +1146,7 @@ void Game::WaitFrameSignal(int frame) {
signalFrame
=
(
gameConf
.
quick_animation
&&
frame
>=
12
)
?
12
:
frame
;
frameSignal
.
Wait
();
}
void
Game
::
DrawThumb
(
code_pointer
cp
,
position
2di
pos
,
const
std
::
unordered_map
<
int
,
int
>*
lflist
,
bool
drag
)
{
void
Game
::
DrawThumb
(
code_pointer
cp
,
irr
::
core
::
vector
2di
pos
,
const
std
::
unordered_map
<
int
,
int
>*
lflist
,
bool
drag
)
{
int
code
=
cp
->
first
;
int
lcode
=
cp
->
second
.
alias
;
if
(
lcode
==
0
)
...
...
@@ -1249,7 +1250,7 @@ void Game::DrawDeckBd() {
int
j
=
i
+
padding
;
DrawThumb
(
deckManager
.
current_deck
.
main
[
j
],
Resize
(
314
+
(
i
%
lx
)
*
dx
,
164
+
(
i
/
lx
)
*
dy
),
deckBuilder
.
filterList
);
if
(
deckBuilder
.
hovered_pos
==
1
&&
deckBuilder
.
hovered_seq
==
j
)
driver
->
draw2DRectangleOutline
(
recti
((
313
+
(
i
%
lx
)
*
dx
)
*
xScale
+
CARD_THUMB_WIDTH
*
(
mainGame
->
xScale
-
mainGame
->
yScale
)
/
2
,
(
163
+
(
i
/
lx
)
*
dy
)
*
yScale
,
(
313
+
(
i
%
lx
)
*
dx
+
1
)
*
xScale
+
CARD_THUMB_WIDTH
*
(
mainGame
->
xScale
+
mainGame
->
yScale
)
/
2
,
(
163
+
(
i
/
lx
)
*
dy
+
CARD_THUMB_HEIGHT
+
1
)
*
yScale
));
driver
->
draw2DRectangleOutline
(
recti
((
313
+
(
i
%
lx
)
*
dx
)
*
xScale
+
CARD_THUMB_WIDTH
*
(
mainGame
->
xScale
-
mainGame
->
yScale
)
/
2
,
(
163
+
(
i
/
lx
)
*
dy
)
*
yScale
,
(
313
+
(
i
%
lx
)
*
dx
+
1
)
*
xScale
+
CARD_THUMB_WIDTH
*
(
mainGame
->
xScale
+
mainGame
->
yScale
)
/
2
,
(
163
+
(
i
/
lx
)
*
dy
+
CARD_THUMB_HEIGHT
+
1
)
*
yScale
));
}
if
(
!
deckBuilder
.
showing_pack
)
{
//extra deck
...
...
@@ -1377,7 +1378,7 @@ void Game::DrawDeckBd() {
}
}
if
(
deckBuilder
.
is_draging
)
{
DrawThumb
(
deckBuilder
.
draging_pointer
,
position2di
(
deckBuilder
.
dragx
-
CARD_THUMB_WIDTH
/
2
,
deckBuilder
.
dragy
-
CARD_THUMB_HEIGHT
/
2
),
deckBuilder
.
filterList
,
true
);
DrawThumb
(
deckBuilder
.
draging_pointer
,
irr
::
core
::
vector2di
(
deckBuilder
.
dragx
-
CARD_THUMB_WIDTH
/
2
*
mainGame
->
xScale
,
deckBuilder
.
dragy
-
CARD_THUMB_HEIGHT
/
2
*
mainGame
->
yScale
),
deckBuilder
.
filterList
,
true
);
}
}
}
Classes/gframe/event_handler.cpp
View file @
826d0df9
...
...
@@ -1158,7 +1158,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
s32
x
=
event
.
MouseInput
.
X
;
s32
y
=
event
.
MouseInput
.
Y
;
hovered_location
=
0
;
irr
::
core
::
position
2di
pos
(
x
,
y
);
irr
::
core
::
vector
2di
pos
(
x
,
y
);
if
(
x
<
300
*
mainGame
->
xScale
)
break
;
if
(
mainGame
->
gameConf
.
control_mode
==
1
)
{
...
...
@@ -1580,7 +1580,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
bool
should_show_tip
=
false
;
s32
x
=
event
.
MouseInput
.
X
;
s32
y
=
event
.
MouseInput
.
Y
;
irr
::
core
::
position
2di
pos
(
x
,
y
);
irr
::
core
::
vector
2di
pos
(
x
,
y
);
wchar_t
formatBuffer
[
2048
];
if
(
x
<
300
)
{
irr
::
gui
::
IGUIElement
*
root
=
mainGame
->
env
->
getRootGUIElement
();
...
...
@@ -1621,9 +1621,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if
(
deck
[
hovered_controler
].
size
())
mcard
=
deck
[
hovered_controler
].
back
();
}
else
{
if
(
irr
::
core
::
recti
(
327
*
mainGame
->
xScale
,
8
*
mainGame
->
yScale
,
630
*
mainGame
->
xScale
,
72
*
mainGame
->
yScale
).
isPointInside
(
pos
))
if
(
mainGame
->
Resize
(
327
,
8
,
630
,
72
).
isPointInside
(
pos
))
mplayer
=
0
;
else
if
(
irr
::
core
::
recti
(
689
*
mainGame
->
xScale
,
8
*
mainGame
->
yScale
,
991
*
mainGame
->
xScale
,
72
*
mainGame
->
yScale
).
isPointInside
(
pos
))
else
if
(
mainGame
->
Resize
(
689
,
8
,
991
,
72
).
isPointInside
(
pos
))
mplayer
=
1
;
}
}
...
...
@@ -1635,7 +1635,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if
(
mainGame
->
stTip
->
isVisible
())
{
should_show_tip
=
true
;
irr
::
core
::
recti
tpos
=
mainGame
->
stTip
->
getRelativePosition
();
mainGame
->
stTip
->
setRelativePosition
(
irr
::
core
::
position
2di
(
x
-
tpos
.
getWidth
()
-
10
*
mainGame
->
xScale
,
mcard
?
y
-
tpos
.
getHeight
()
-
(
10
*
mainGame
->
yScale
)
:
y
+
10
*
mainGame
->
xScale
));
mainGame
->
stTip
->
setRelativePosition
(
irr
::
core
::
vector
2di
(
x
-
tpos
.
getWidth
()
-
10
*
mainGame
->
xScale
,
mcard
?
y
-
tpos
.
getHeight
()
-
(
10
*
mainGame
->
yScale
)
:
y
+
10
*
mainGame
->
xScale
));
}
}
if
(
mcard
!=
hovered_card
)
{
...
...
@@ -2196,7 +2196,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
}
case
irr
:
:
EET_MOUSE_INPUT_EVENT
:
{
IGUIElement
*
root
=
mainGame
->
env
->
getRootGUIElement
();
position2di
mousepos
=
position
2di
(
event
.
MouseInput
.
X
,
event
.
MouseInput
.
Y
);
irr
::
core
::
vector2di
mousepos
=
irr
::
core
::
vector
2di
(
event
.
MouseInput
.
X
,
event
.
MouseInput
.
Y
);
irr
::
gui
::
IGUIElement
*
eventElement
=
root
->
getElementFromPoint
(
mousepos
);
u32
static
presstime
,
leftuptime
;
switch
(
event
.
MouseInput
.
Event
)
{
...
...
@@ -2402,7 +2402,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
void
ClientField
::
GetHoverField
(
int
x
,
int
y
)
{
irr
::
core
::
recti
sfRect
(
430
*
mainGame
->
xScale
,
504
*
mainGame
->
yScale
,
875
*
mainGame
->
xScale
,
600
*
mainGame
->
yScale
);
irr
::
core
::
recti
ofRect
(
531
*
mainGame
->
xScale
,
135
*
mainGame
->
yScale
,
800
*
mainGame
->
xScale
,
191
*
mainGame
->
yScale
);
irr
::
core
::
position
2di
pos
(
x
,
y
);
irr
::
core
::
vector
2di
pos
(
x
,
y
);
int
rule
=
(
mainGame
->
dInfo
.
duel_rule
>=
4
)
?
1
:
0
;
if
(
sfRect
.
isPointInside
(
pos
))
{
int
hc
=
hand
[
0
].
size
();
...
...
@@ -2635,31 +2635,31 @@ void ClientField::ShowMenu(int flag, int x, int y) {
return
;
}
menu_card
=
clicked_card
;
int
height
=
0
;
int
height
=
1
;
if
(
flag
&
COMMAND_ACTIVATE
)
{
mainGame
->
btnActivate
->
setVisible
(
true
);
mainGame
->
btnActivate
->
setRelativePosition
(
position2di
(
0
,
height
));
mainGame
->
btnActivate
->
setRelativePosition
(
irr
::
core
::
vector2di
(
1
,
height
));
#ifdef _IRR_ANDROID_PLATFORM_
height
+=
60
*
mainGame
->
yScale
;
#endif
}
else
mainGame
->
btnActivate
->
setVisible
(
false
);
if
(
flag
&
COMMAND_SUMMON
)
{
mainGame
->
btnSummon
->
setVisible
(
true
);
mainGame
->
btnSummon
->
setRelativePosition
(
position2di
(
0
,
height
));
mainGame
->
btnSummon
->
setRelativePosition
(
irr
::
core
::
vector2di
(
1
,
height
));
#ifdef _IRR_ANDROID_PLATFORM_
height
+=
60
*
mainGame
->
yScale
;
#endif
}
else
mainGame
->
btnSummon
->
setVisible
(
false
);
if
(
flag
&
COMMAND_SPSUMMON
)
{
mainGame
->
btnSPSummon
->
setVisible
(
true
);
mainGame
->
btnSPSummon
->
setRelativePosition
(
position2di
(
0
,
height
));
mainGame
->
btnSPSummon
->
setRelativePosition
(
irr
::
core
::
vector2di
(
1
,
height
));
#ifdef _IRR_ANDROID_PLATFORM_
height
+=
60
*
mainGame
->
yScale
;
#endif
}
else
mainGame
->
btnSPSummon
->
setVisible
(
false
);
if
(
flag
&
COMMAND_MSET
)
{
mainGame
->
btnMSet
->
setVisible
(
true
);
mainGame
->
btnMSet
->
setRelativePosition
(
position2di
(
0
,
height
));
mainGame
->
btnMSet
->
setRelativePosition
(
irr
::
core
::
vector2di
(
1
,
height
));
#ifdef _IRR_ANDROID_PLATFORM_
height
+=
60
*
mainGame
->
yScale
;
#endif
...
...
@@ -2670,7 +2670,7 @@ void ClientField::ShowMenu(int flag, int x, int y) {
else
mainGame
->
btnSSet
->
setText
(
dataManager
.
GetSysString
(
1159
));
mainGame
->
btnSSet
->
setVisible
(
true
);
mainGame
->
btnSSet
->
setRelativePosition
(
position2di
(
0
,
height
));
mainGame
->
btnSSet
->
setRelativePosition
(
irr
::
core
::
vector2di
(
1
,
height
));
#ifdef _IRR_ANDROID_PLATFORM_
height
+=
60
*
mainGame
->
yScale
;
#endif
...
...
@@ -2683,35 +2683,35 @@ void ClientField::ShowMenu(int flag, int x, int y) {
else
mainGame
->
btnRepos
->
setText
(
dataManager
.
GetSysString
(
1156
));
mainGame
->
btnRepos
->
setVisible
(
true
);
mainGame
->
btnRepos
->
setRelativePosition
(
position2di
(
0
,
height
));
mainGame
->
btnRepos
->
setRelativePosition
(
irr
::
core
::
vector2di
(
1
,
height
));
#ifdef _IRR_ANDROID_PLATFORM_
height
+=
60
*
mainGame
->
yScale
;
#endif
}
else
mainGame
->
btnRepos
->
setVisible
(
false
);
if
(
flag
&
COMMAND_ATTACK
)
{
mainGame
->
btnAttack
->
setVisible
(
true
);
mainGame
->
btnAttack
->
setRelativePosition
(
position2di
(
0
,
height
));
mainGame
->
btnAttack
->
setRelativePosition
(
irr
::
core
::
vector2di
(
1
,
height
));
#ifdef _IRR_ANDROID_PLATFORM_
height
+=
60
*
mainGame
->
yScale
;
#endif
}
else
mainGame
->
btnAttack
->
setVisible
(
false
);
if
(
flag
&
COMMAND_LIST
)
{
mainGame
->
btnShowList
->
setVisible
(
true
);
mainGame
->
btnShowList
->
setRelativePosition
(
position2di
(
0
,
height
));
mainGame
->
btnShowList
->
setRelativePosition
(
irr
::
core
::
vector2di
(
1
,
height
));
#ifdef _IRR_ANDROID_PLATFORM_
height
+=
60
*
mainGame
->
yScale
;
#endif
}
else
mainGame
->
btnShowList
->
setVisible
(
false
);
if
(
flag
&
COMMAND_OPERATION
)
{
mainGame
->
btnOperation
->
setVisible
(
true
);
mainGame
->
btnOperation
->
setRelativePosition
(
position2di
(
0
,
height
));
mainGame
->
btnOperation
->
setRelativePosition
(
irr
::
core
::
vector2di
(
1
,
height
));
#ifdef _IRR_ANDROID_PLATFORM_
height
+=
60
*
mainGame
->
yScale
;
#endif
}
else
mainGame
->
btnOperation
->
setVisible
(
false
);
if
(
flag
&
COMMAND_RESET
)
{
mainGame
->
btnReset
->
setVisible
(
true
);
mainGame
->
btnReset
->
setRelativePosition
(
position2di
(
0
,
height
));
mainGame
->
btnReset
->
setRelativePosition
(
irr
::
core
::
vector2di
(
1
,
height
));
#ifdef _IRR_ANDROID_PLATFORM_
height
+=
60
*
mainGame
->
yScale
;
#endif
...
...
Classes/gframe/game.cpp
View file @
826d0df9
...
...
@@ -133,6 +133,15 @@ void Game::onHandleAndroidCommand(ANDROID_APP app, int32_t cmd){
break
;
}
}
bool
IsExtension
(
const
char
*
filename
,
const
char
*
extension
)
{
auto
flen
=
std
::
strlen
(
filename
);
auto
elen
=
std
::
strlen
(
extension
);
if
(
!
elen
||
flen
<
elen
)
return
false
;
return
!
mystrncasecmp
(
filename
+
(
flen
-
elen
),
extension
,
elen
);
}
bool
Game
::
Initialize
(
ANDROID_APP
app
,
android
::
InitOptions
*
options
)
{
this
->
appMain
=
app
;
srand
(
time
(
0
));
...
...
@@ -157,7 +166,7 @@ bool Game::Initialize(ANDROID_APP app, android::InitOptions *options) {
if
(
!
android
::
perfromTrick
(
app
))
{
return
false
;
}
core
::
position
2di
appPosition
=
android
::
initJavaBridge
(
app
,
device
);
irr
::
core
::
vector
2di
appPosition
=
android
::
initJavaBridge
(
app
,
device
);
setPositionFix
(
appPosition
);
device
->
setProcessReceiver
(
this
);
...
...
@@ -2216,15 +2225,15 @@ recti Game::Resize(s32 x, s32 y, s32 x2, s32 y2, s32 dx, s32 dy, s32 dx2, s32 dy
y2
=
y2
*
yScale
+
dy2
;
return
recti
(
x
,
y
,
x2
,
y2
);
}
position
2di
Game
::
Resize
(
s32
x
,
s32
y
)
{
irr
::
core
::
vector
2di
Game
::
Resize
(
s32
x
,
s32
y
)
{
x
=
x
*
xScale
;
y
=
y
*
yScale
;
return
position
2di
(
x
,
y
);
return
irr
::
core
::
vector
2di
(
x
,
y
);
}
position
2di
Game
::
ResizeReverse
(
s32
x
,
s32
y
)
{
irr
::
core
::
vector
2di
Game
::
ResizeReverse
(
s32
x
,
s32
y
)
{
x
=
x
/
xScale
;
y
=
y
/
yScale
;
return
position
2di
(
x
,
y
);
return
irr
::
core
::
vector
2di
(
x
,
y
);
}
recti
Game
::
ResizeWin
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
)
{
s32
w
=
x2
-
x
;
...
...
@@ -2247,12 +2256,12 @@ recti Game::Resize_Y(s32 x, s32 y, s32 x2, s32 y2) {
y
=
y
*
yScale
;
x2
=
x2
*
yScale
;
y2
=
y2
*
yScale
;
return
recti
(
x
,
y
,
x2
,
y2
);
return
recti
(
x
,
y
,
x2
,
y2
);
}
position
2di
Game
::
Resize_Y
(
s32
x
,
s32
y
)
{
irr
::
core
::
vector
2di
Game
::
Resize_Y
(
s32
x
,
s32
y
)
{
x
=
x
*
yScale
;
y
=
y
*
yScale
;
return
position
2di
(
x
,
y
);
return
irr
::
core
::
vector
2di
(
x
,
y
);
}
void
Game
::
ChangeToIGUIImageWindow
(
irr
::
gui
::
IGUIWindow
*
window
,
irr
::
gui
::
IGUIImage
**
pWindowBackground
,
irr
::
video
::
ITexture
*
image
)
{
window
->
setDrawBackground
(
false
);
...
...
Classes/gframe/game.h
View file @
826d0df9
...
...
@@ -28,6 +28,7 @@ constexpr int TEXT_LINE_SIZE = 256;
namespace
ygo
{
bool
IsExtension
(
const
wchar_t
*
filename
,
const
wchar_t
*
extension
);
bool
IsExtension
(
const
char
*
filename
,
const
char
*
extension
);
#ifdef _IRR_ANDROID_PLATFORM_
#define LOG_TAG "ygo-jni"
...
...
@@ -189,7 +190,7 @@ public:
void
HideElement
(
irr
::
gui
::
IGUIElement
*
element
,
bool
set_action
=
false
);
void
PopupElement
(
irr
::
gui
::
IGUIElement
*
element
,
int
hideframe
=
0
);
void
WaitFrameSignal
(
int
frame
);
void
DrawThumb
(
code_pointer
cp
,
position
2di
pos
,
const
std
::
unordered_map
<
int
,
int
>*
lflist
,
bool
drag
=
false
);
void
DrawThumb
(
code_pointer
cp
,
irr
::
core
::
vector
2di
pos
,
const
std
::
unordered_map
<
int
,
int
>*
lflist
,
bool
drag
=
false
);
void
DrawDeckBd
();
void
LoadConfig
();
void
SaveConfig
();
...
...
@@ -229,12 +230,12 @@ public:
void
ResizeChatInputWindow
();
recti
Resize
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
);
recti
Resize
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
,
s32
dx
,
s32
dy
,
s32
dx2
,
s32
dy2
);
position
2di
Resize
(
s32
x
,
s32
y
);
position
2di
ResizeReverse
(
s32
x
,
s32
y
);
irr
::
core
::
vector
2di
Resize
(
s32
x
,
s32
y
);
irr
::
core
::
vector
2di
ResizeReverse
(
s32
x
,
s32
y
);
recti
ResizePhaseHint
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
,
s32
width
);
recti
ResizeWin
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
);
recti
Resize_Y
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
);
position
2di
Resize_Y
(
s32
x
,
s32
y
);
irr
::
core
::
vector
2di
Resize_Y
(
s32
x
,
s32
y
);
template
<
typename
T
>
static
std
::
vector
<
T
>
TokenizeString
(
T
input
,
const
T
&
token
);
template
<
typename
T
>
...
...
Classes/gframe/menu_handler.h
View file @
826d0df9
#ifndef MENU_HANDLER_H
#define MENU_HANDLER_H
#include
"config.h"
#include
<irrlicht.h>
#ifdef _IRR_ANDROID_PLATFORM_
#include <android/TouchEventTransferAndroid.h>
#endif
...
...
@@ -11,8 +11,8 @@ namespace ygo {
class
MenuHandler
:
public
irr
::
IEventReceiver
{
public:
bool
OnEvent
(
const
irr
::
SEvent
&
event
)
override
;
s32
prev_operation
;
int
prev_sel
;
irr
::
s32
prev_operation
{
0
}
;
int
prev_sel
{
-
1
}
;
};
...
...
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