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
c3783925
Commit
c3783925
authored
Aug 10, 2017
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fh' into sound
parents
1f18b68c
06ea1af8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
24 deletions
+43
-24
gframe/CGUITTFont.cpp
gframe/CGUITTFont.cpp
+27
-22
gframe/CGUITTFont.h
gframe/CGUITTFont.h
+10
-0
gframe/deck_con.cpp
gframe/deck_con.cpp
+2
-1
gframe/game.cpp
gframe/game.cpp
+2
-1
strings.conf
strings.conf
+2
-0
No files found.
gframe/CGUITTFont.cpp
View file @
c3783925
...
@@ -153,7 +153,7 @@ void SGUITTGlyph::preload(u32 char_index, FT_Face face, video::IVideoDriver* dri
...
@@ -153,7 +153,7 @@ void SGUITTGlyph::preload(u32 char_index, FT_Face face, video::IVideoDriver* dri
}
}
glyph_page
=
parent
->
getLastGlyphPageIndex
();
glyph_page
=
parent
->
getLastGlyphPageIndex
();
u32
texture_side_length
=
page
->
texture
->
getOriginalSize
()
.
Width
;
u32
texture_side_length
=
page
->
texture
_size
.
Width
;
core
::
vector2di
page_position
(
core
::
vector2di
page_position
(
(
page
->
used_slots
%
(
texture_side_length
/
font_size
))
*
font_size
,
(
page
->
used_slots
%
(
texture_side_length
/
font_size
))
*
font_size
,
(
page
->
used_slots
/
(
texture_side_length
/
font_size
))
*
font_size
(
page
->
used_slots
/
(
texture_side_length
/
font_size
))
*
font_size
...
@@ -230,7 +230,7 @@ CGUITTFont* CGUITTFont::create(IrrlichtDevice *device, const io::path& filename,
...
@@ -230,7 +230,7 @@ CGUITTFont* CGUITTFont::create(IrrlichtDevice *device, const io::path& filename,
//! Constructor.
//! Constructor.
CGUITTFont
::
CGUITTFont
(
IGUIEnvironment
*
env
)
CGUITTFont
::
CGUITTFont
(
IGUIEnvironment
*
env
)
:
use_monochrome
(
false
),
use_transparency
(
true
),
use_hinting
(
true
),
use_auto_hinting
(
true
),
:
use_monochrome
(
false
),
use_transparency
(
true
),
use_hinting
(
true
),
use_auto_hinting
(
true
),
batch_load_size
(
1
),
Device
(
0
),
Environment
(
env
),
Driver
(
0
),
GlobalKerningWidth
(
0
),
GlobalKerningHeight
(
0
)
{
batch_load_size
(
1
),
Device
(
0
),
Environment
(
env
),
Driver
(
0
),
GlobalKerningWidth
(
0
),
GlobalKerningHeight
(
0
)
,
supposed_line_height
(
0
)
{
#ifdef _DEBUG
#ifdef _DEBUG
setDebugName
(
"CGUITTFont"
);
setDebugName
(
"CGUITTFont"
);
#endif
#endif
...
@@ -345,6 +345,24 @@ bool CGUITTFont::load(const io::path& filename, const u32 size, const bool antia
...
@@ -345,6 +345,24 @@ bool CGUITTFont::load(const io::path& filename, const u32 size, const bool antia
getGlyphIndexByChar
((
uchar32_t
)
0
);
getGlyphIndexByChar
((
uchar32_t
)
0
);
batch_load_size
=
old_size
;
batch_load_size
=
old_size
;
// Calculate the supposed line height of this font (of this size) --
// Not using FT_SizeMetric::ascender or height, but actually by testing some of the glyphs,
// to see what should give a reasonable not cluttered line height.
// The ascender or height info may as well just be arbitrary ones.
// Get the maximum font height. Unfortunately, we have to do this hack as
// Irrlicht will draw things wrong. In FreeType, the font size is the
// maximum size for a single glyph, but that glyph may hang "under" the
// draw line, increasing the total font height to beyond the set size.
// Irrlicht does not understand this concept when drawing fonts. Also, I
// add +1 to give it a 1 pixel blank border. This makes things like
// tooltips look nicer.
s32
test1
=
getHeightFromCharacter
((
uchar32_t
)
'g'
)
+
1
;
s32
test2
=
getHeightFromCharacter
((
uchar32_t
)
'j'
)
+
1
;
s32
test3
=
getHeightFromCharacter
((
uchar32_t
)
0x55B5
)
+
1
;
supposed_line_height
=
core
::
max_
(
test1
,
core
::
max_
(
test2
,
test3
));
return
true
;
return
true
;
}
}
...
@@ -443,9 +461,8 @@ CGUITTGlyphPage* CGUITTFont::createGlyphPage(const u8& pixel_mode) {
...
@@ -443,9 +461,8 @@ CGUITTGlyphPage* CGUITTFont::createGlyphPage(const u8& pixel_mode) {
if
(
page_texture_size
.
Width
>
max_texture_size
.
Width
||
page_texture_size
.
Height
>
max_texture_size
.
Height
)
if
(
page_texture_size
.
Width
>
max_texture_size
.
Width
||
page_texture_size
.
Height
>
max_texture_size
.
Height
)
page_texture_size
=
max_texture_size
;
page_texture_size
=
max_texture_size
;
if
(
!
page
->
createPageTexture
(
pixel_mode
,
page_texture_size
))
page
->
texture_size
=
page_texture_size
;
// TODO: add error message?
page
->
pixel_mode
=
pixel_mode
;
return
0
;
if
(
page
)
{
if
(
page
)
{
// Determine the number of glyph slots on the page and add it to the list of pages.
// Determine the number of glyph slots on the page and add it to the list of pages.
...
@@ -522,7 +539,7 @@ void CGUITTFont::draw(const core::stringw& text, const core::rect<s32>& position
...
@@ -522,7 +539,7 @@ void CGUITTFont::draw(const core::stringw& text, const core::rect<s32>& position
if
(
lineBreak
)
{
if
(
lineBreak
)
{
previousChar
=
0
;
previousChar
=
0
;
offset
.
Y
+=
font_metrics
.
ascender
/
64
;
offset
.
Y
+=
supposed_line_height
;
//
font_metrics.ascender / 64;
offset
.
X
=
position
.
UpperLeftCorner
.
X
;
offset
.
X
=
position
.
UpperLeftCorner
.
X
;
if
(
hcenter
)
if
(
hcenter
)
...
@@ -577,20 +594,8 @@ core::dimension2d<u32> CGUITTFont::getDimension(const wchar_t* text) const {
...
@@ -577,20 +594,8 @@ core::dimension2d<u32> CGUITTFont::getDimension(const wchar_t* text) const {
}
}
core
::
dimension2d
<
u32
>
CGUITTFont
::
getDimension
(
const
core
::
ustring
&
text
)
const
{
core
::
dimension2d
<
u32
>
CGUITTFont
::
getDimension
(
const
core
::
ustring
&
text
)
const
{
// Get the maximum font height. Unfortunately, we have to do this hack as
core
::
dimension2d
<
u32
>
text_dimension
(
0
,
supposed_line_height
);
// Irrlicht will draw things wrong. In FreeType, the font size is the
core
::
dimension2d
<
u32
>
line
(
0
,
supposed_line_height
);
// maximum size for a single glyph, but that glyph may hang "under" the
// draw line, increasing the total font height to beyond the set size.
// Irrlicht does not understand this concept when drawing fonts. Also, I
// add +1 to give it a 1 pixel blank border. This makes things like
// tooltips look nicer.
s32
test1
=
getHeightFromCharacter
((
uchar32_t
)
'g'
)
+
1
;
s32
test2
=
getHeightFromCharacter
((
uchar32_t
)
'j'
)
+
1
;
s32
test3
=
getHeightFromCharacter
((
uchar32_t
)
'_'
)
+
1
;
s32
max_font_height
=
core
::
max_
(
test1
,
core
::
max_
(
test2
,
test3
));
core
::
dimension2d
<
u32
>
text_dimension
(
0
,
max_font_height
);
core
::
dimension2d
<
u32
>
line
(
0
,
max_font_height
);
uchar32_t
previousChar
=
0
;
uchar32_t
previousChar
=
0
;
core
::
ustring
::
const_iterator
iter
=
text
.
begin
();
core
::
ustring
::
const_iterator
iter
=
text
.
begin
();
...
@@ -619,7 +624,7 @@ core::dimension2d<u32> CGUITTFont::getDimension(const core::ustring& text) const
...
@@ -619,7 +624,7 @@ core::dimension2d<u32> CGUITTFont::getDimension(const core::ustring& text) const
if
(
text_dimension
.
Width
<
line
.
Width
)
if
(
text_dimension
.
Width
<
line
.
Width
)
text_dimension
.
Width
=
line
.
Width
;
text_dimension
.
Width
=
line
.
Width
;
line
.
Width
=
0
;
line
.
Width
=
0
;
line
.
Height
=
max_font
_height
;
line
.
Height
=
supposed_line
_height
;
continue
;
continue
;
}
}
line
.
Width
+=
getWidthFromCharacter
(
p
);
line
.
Width
+=
getWidthFromCharacter
(
p
);
...
@@ -938,7 +943,7 @@ core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text
...
@@ -938,7 +943,7 @@ core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text
if
(
line_break
)
{
if
(
line_break
)
{
previous_char
=
0
;
previous_char
=
0
;
offset
.
Y
-=
tt_face
->
size
->
metrics
.
ascender
/
64
;
offset
.
Y
-=
supposed_line_height
;
//
tt_face->size->metrics.ascender / 64;
offset
.
X
=
start_point
.
X
;
offset
.
X
=
start_point
.
X
;
if
(
center
)
if
(
center
)
offset
.
X
+=
(
text_size
.
Width
-
getDimensionUntilEndOfLine
(
text
+
1
).
Width
)
>>
1
;
offset
.
X
+=
(
text_size
.
Width
-
getDimensionUntilEndOfLine
(
text
+
1
).
Width
)
>>
1
;
...
...
gframe/CGUITTFont.h
View file @
c3783925
...
@@ -143,6 +143,12 @@ public:
...
@@ -143,6 +143,12 @@ public:
void
updateTexture
()
{
void
updateTexture
()
{
if
(
!
dirty
)
return
;
if
(
!
dirty
)
return
;
if
(
!
texture
)
{
if
(
!
createPageTexture
(
pixel_mode
,
texture_size
))
// TODO: add error message?
return
;
}
void
*
ptr
=
texture
->
lock
();
void
*
ptr
=
texture
->
lock
();
video
::
ECOLOR_FORMAT
format
=
texture
->
getColorFormat
();
video
::
ECOLOR_FORMAT
format
=
texture
->
getColorFormat
();
core
::
dimension2du
size
=
texture
->
getOriginalSize
();
core
::
dimension2du
size
=
texture
->
getOriginalSize
();
...
@@ -176,6 +182,9 @@ public:
...
@@ -176,6 +182,9 @@ public:
core
::
array
<
core
::
vector2di
>
render_positions
;
core
::
array
<
core
::
vector2di
>
render_positions
;
core
::
array
<
core
::
recti
>
render_source_rects
;
core
::
array
<
core
::
recti
>
render_source_rects
;
core
::
dimension2du
texture_size
;
u8
pixel_mode
;
private:
private:
core
::
array
<
const
SGUITTGlyph
*>
glyph_to_be_paged
;
core
::
array
<
const
SGUITTGlyph
*>
glyph_to_be_paged
;
video
::
IVideoDriver
*
driver
;
video
::
IVideoDriver
*
driver
;
...
@@ -368,6 +377,7 @@ private:
...
@@ -368,6 +377,7 @@ private:
s32
GlobalKerningWidth
;
s32
GlobalKerningWidth
;
s32
GlobalKerningHeight
;
s32
GlobalKerningHeight
;
s32
supposed_line_height
;
core
::
ustring
Invisible
;
core
::
ustring
Invisible
;
};
};
...
...
gframe/deck_con.cpp
View file @
c3783925
...
@@ -96,7 +96,7 @@ void DeckBuilder::Terminate() {
...
@@ -96,7 +96,7 @@ void DeckBuilder::Terminate() {
mainGame
->
PopupElement
(
mainGame
->
wMainMenu
);
mainGame
->
PopupElement
(
mainGame
->
wMainMenu
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
wACMessage
->
setVisible
(
false
);
mainGame
->
wACMessage
->
setVisible
(
false
);
imageManager
.
ClearTexture
();
mainGame
->
ClearTextures
();
mainGame
->
scrFilter
->
setVisible
(
false
);
mainGame
->
scrFilter
->
setVisible
(
false
);
int
sel
=
mainGame
->
cbDBDecks
->
getSelected
();
int
sel
=
mainGame
->
cbDBDecks
->
getSelected
();
if
(
sel
>=
0
)
if
(
sel
>=
0
)
...
@@ -228,6 +228,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -228,6 +228,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1410
));
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1410
));
break
;
break
;
}
}
mainGame
->
imgCard
->
setImage
(
imageManager
.
tCover
[
0
]);
char
deckbuf
[
1024
];
char
deckbuf
[
1024
];
char
*
pdeck
=
deckbuf
;
char
*
pdeck
=
deckbuf
;
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
main
.
size
()
+
deckManager
.
current_deck
.
extra
.
size
());
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
main
.
size
()
+
deckManager
.
current_deck
.
extra
.
size
());
...
...
gframe/game.cpp
View file @
c3783925
...
@@ -202,6 +202,7 @@ bool Game::Initialize() {
...
@@ -202,6 +202,7 @@ bool Game::Initialize() {
wCardImg
->
setBackgroundColor
(
0xc0c0c0c0
);
wCardImg
->
setBackgroundColor
(
0xc0c0c0c0
);
wCardImg
->
setVisible
(
false
);
wCardImg
->
setVisible
(
false
);
imgCard
=
env
->
addImage
(
rect
<
s32
>
(
10
,
9
,
187
,
263
),
wCardImg
);
imgCard
=
env
->
addImage
(
rect
<
s32
>
(
10
,
9
,
187
,
263
),
wCardImg
);
imgCard
->
setImage
(
imageManager
.
tCover
[
0
]);
imgCard
->
setUseAlphaChannel
(
true
);
imgCard
->
setUseAlphaChannel
(
true
);
//phase
//phase
wPhase
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
480
,
310
,
855
,
330
));
wPhase
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
480
,
310
,
855
,
330
));
...
@@ -1450,7 +1451,7 @@ void Game::AddDebugMsg(char* msg)
...
@@ -1450,7 +1451,7 @@ void Game::AddDebugMsg(char* msg)
}
}
void
Game
::
ClearTextures
()
{
void
Game
::
ClearTextures
()
{
matManager
.
mCard
.
setTexture
(
0
,
0
);
matManager
.
mCard
.
setTexture
(
0
,
0
);
mainGame
->
imgCard
->
setImage
(
0
);
mainGame
->
imgCard
->
setImage
(
imageManager
.
tCover
[
0
]
);
mainGame
->
btnPSAU
->
setImage
();
mainGame
->
btnPSAU
->
setImage
();
mainGame
->
btnPSDU
->
setImage
();
mainGame
->
btnPSDU
->
setImage
();
for
(
int
i
=
0
;
i
<=
4
;
++
i
)
{
for
(
int
i
=
0
;
i
<=
4
;
++
i
)
{
...
...
strings.conf
View file @
c3783925
...
@@ -846,3 +846,5 @@
...
@@ -846,3 +846,5 @@
!
setname
0
x103
幻变骚灵 オルターガイスト
!
setname
0
x103
幻变骚灵 オルターガイスト
!
setname
0
x104
机怪虫 クローラー
!
setname
0
x104
机怪虫 クローラー
!
setname
0
x105
玄化 メタファイズ
!
setname
0
x105
玄化 メタファイズ
!
setname
0
x106
复仇死灵
Vendread
!
setname
0
x107
F
.
A
.
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