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
de84fb70
Commit
de84fb70
authored
Apr 16, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add skin
parent
70589a8f
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1318 additions
and
0 deletions
+1318
-0
gframe/CGUISkinSystem/CConfigMap.cpp
gframe/CGUISkinSystem/CConfigMap.cpp
+79
-0
gframe/CGUISkinSystem/CConfigMap.h
gframe/CGUISkinSystem/CConfigMap.h
+31
-0
gframe/CGUISkinSystem/CGUIProgressBar.cpp
gframe/CGUISkinSystem/CGUIProgressBar.cpp
+88
-0
gframe/CGUISkinSystem/CGUIProgressBar.h
gframe/CGUISkinSystem/CGUIProgressBar.h
+49
-0
gframe/CGUISkinSystem/CGUISkinSystem.cpp
gframe/CGUISkinSystem/CGUISkinSystem.cpp
+288
-0
gframe/CGUISkinSystem/CGUISkinSystem.h
gframe/CGUISkinSystem/CGUISkinSystem.h
+53
-0
gframe/CGUISkinSystem/CImageGUISkin.cpp
gframe/CGUISkinSystem/CImageGUISkin.cpp
+491
-0
gframe/CGUISkinSystem/CImageGUISkin.h
gframe/CGUISkinSystem/CImageGUISkin.h
+152
-0
gframe/CGUISkinSystem/clipRects.h
gframe/CGUISkinSystem/clipRects.h
+68
-0
gframe/game.cpp
gframe/game.cpp
+14
-0
gframe/game.h
gframe/game.h
+4
-0
system.conf
system.conf
+1
-0
No files found.
gframe/CGUISkinSystem/CConfigMap.cpp
0 → 100644
View file @
de84fb70
#include "CConfigMap.h"
core
::
stringc
CConfigMap
::
getConfig
(
const
core
::
stringc
&
name
)
{
core
::
map
<
core
::
stringc
,
core
::
stringc
>::
Node
*
node
=
Map
.
find
(
name
);
if
(
node
==
0
)
return
core
::
stringc
();
return
node
->
getValue
();
}
s32
CConfigMap
::
getConfigAsInt
(
const
core
::
stringc
&
name
)
{
core
::
stringc
cfg
=
getConfig
(
name
);
if
(
cfg
.
size
()
==
0
)
return
0
;
s32
x
=
0
;
sscanf
(
cfg
.
c_str
(),
"%d"
,
&
x
);
return
x
;
}
f32
CConfigMap
::
getConfigAsFloat
(
const
core
::
stringc
&
name
)
{
core
::
stringc
cfg
=
getConfig
(
name
);
if
(
cfg
.
size
()
==
0
)
return
0
;
f32
x
=
0.0
f
;
sscanf
(
cfg
.
c_str
(),
"%f"
,
&
x
);
return
x
;
}
core
::
vector2df
CConfigMap
::
getConfigAsVector2df
(
const
core
::
stringc
&
name
)
{
core
::
stringc
cfg
=
getConfig
(
name
);
if
(
cfg
.
size
()
==
0
)
return
core
::
vector2df
(
0
,
0
);
core
::
vector2df
vec
;
sscanf
(
cfg
.
c_str
(),
"%f , %f"
,
&
vec
.
X
,
&
vec
.
Y
);
return
vec
;
}
core
::
vector3df
CConfigMap
::
getConfigAsVector3df
(
const
core
::
stringc
&
name
)
{
core
::
stringc
cfg
=
getConfig
(
name
);
if
(
cfg
.
size
()
==
0
)
return
core
::
vector3df
(
0
,
0
,
0
);
core
::
vector3df
vec
;
sscanf
(
cfg
.
c_str
(),
"%f , %f , %f"
,
&
vec
.
X
,
&
vec
.
Y
,
&
vec
.
Z
);
return
vec
;
}
bool
CConfigMap
::
hasConfig
(
const
core
::
stringc
&
name
)
{
core
::
map
<
core
::
stringc
,
core
::
stringc
>::
Node
*
node
=
Map
.
find
(
name
);
return
(
node
!=
0
);
}
void
CConfigMap
::
setConfig
(
const
core
::
stringc
&
name
,
const
core
::
stringc
&
value
)
{
Map
.
set
(
name
,
value
);
}
gframe/CGUISkinSystem/CConfigMap.h
0 → 100644
View file @
de84fb70
#ifndef CCONFIGMAP_H_
#define CCONFIGMAP_H_
#include <irrMap.h>
#include <irrString.h>
#include <irrTypes.h>
#include <vector2d.h>
#include <vector3d.h>
using
namespace
irr
;
class
CConfigMap
{
public:
core
::
stringc
getConfig
(
const
core
::
stringc
&
name
);
s32
getConfigAsInt
(
const
core
::
stringc
&
name
);
f32
getConfigAsFloat
(
const
core
::
stringc
&
name
);
core
::
vector2df
getConfigAsVector2df
(
const
core
::
stringc
&
name
);
core
::
vector3df
getConfigAsVector3df
(
const
core
::
stringc
&
name
);
bool
hasConfig
(
const
core
::
stringc
&
name
);
void
setConfig
(
const
core
::
stringc
&
name
,
const
core
::
stringc
&
value
);
private:
core
::
map
<
core
::
stringc
,
core
::
stringc
>
Map
;
};
#endif
gframe/CGUISkinSystem/CGUIProgressBar.cpp
0 → 100644
View file @
de84fb70
#include "CGUIProgressBar.h"
#include <IGUIEnvironment.h>
#include "CImageGUISkin.h"
#include <IGUIFont.h>
namespace
irr
{
namespace
gui
{
CGUIProgressBar
::
CGUIProgressBar
(
IGUIElement
*
parent
,
IGUIEnvironment
*
environment
,
const
core
::
rect
<
s32
>&
rectangle
,
s32
id
,
bool
bind
)
:
IGUIElement
(
EGUIET_ELEMENT
,
environment
,
parent
,
id
,
rectangle
)
{
FilledRatio
=
0.0
f
;
FillColor
=
video
::
SColor
(
255
,
255
,
0
,
0
);
EmptyColor
=
video
::
SColor
();
AutomaticTextFormat
=
L"%2.0f %%"
;
bindColorsToSkin
=
bind
;
}
void
CGUIProgressBar
::
setAutomaticText
(
const
wchar_t
*
text
)
{
AutomaticTextFormat
=
text
?
text
:
L""
;
if
(
AutomaticTextFormat
!=
L""
)
{
wchar_t
*
buffer
=
new
wchar_t
[
AutomaticTextFormat
.
size
()
+
10
];
swprintf
(
buffer
,
AutomaticTextFormat
.
size
()
+
10
,
AutomaticTextFormat
.
c_str
(),
100
*
FilledRatio
);
Text
=
buffer
;
delete
buffer
;
}
}
void
CGUIProgressBar
::
setFillColor
(
video
::
SColor
fill
)
{
FillColor
=
fill
;
}
video
::
SColor
CGUIProgressBar
::
getFillColor
()
const
{
return
FillColor
;
}
void
CGUIProgressBar
::
setEmptyColor
(
video
::
SColor
empty
)
{
EmptyColor
=
empty
;
}
video
::
SColor
CGUIProgressBar
::
getEmptyColor
()
const
{
return
EmptyColor
;
}
void
CGUIProgressBar
::
setProgress
(
f32
progress
)
{
FilledRatio
=
progress
;
if
(
AutomaticTextFormat
!=
L""
)
{
wchar_t
*
buffer
=
new
wchar_t
[
AutomaticTextFormat
.
size
()
+
10
];
swprintf
(
buffer
,
AutomaticTextFormat
.
size
()
+
10
,
AutomaticTextFormat
.
c_str
(),
100
*
FilledRatio
);
Text
=
buffer
;
delete
buffer
;
}
}
f32
CGUIProgressBar
::
getProgress
()
const
{
return
FilledRatio
;
}
void
CGUIProgressBar
::
draw
()
{
CImageGUISkin
*
skin
=
static_cast
<
CImageGUISkin
*>
(
Environment
->
getSkin
()
);
// Madoc added these changes to let the progress bar get its fill colors from the skin
if
(
bindColorsToSkin
)
{
EmptyColor
=
((
gui
::
SImageGUISkinConfig
)
skin
->
getConfig
()).
ProgressBar
.
Color
;
FillColor
=
((
gui
::
SImageGUISkinConfig
)
skin
->
getConfig
()).
ProgressBarFilled
.
Color
;
}
// End Madoc changes
skin
->
drawHorizontalProgressBar
(
this
,
AbsoluteRect
,
&
AbsoluteClippingRect
,
FilledRatio
,
FillColor
,
EmptyColor
);
// Draw text in center
skin
->
getFont
(
EGDF_DEFAULT
)
->
draw
(
Text
.
c_str
(),
AbsoluteRect
,
skin
->
getColor
(
EGDC_BUTTON_TEXT
),
true
,
true
,
&
AbsoluteClippingRect
);
}
}
}
gframe/CGUISkinSystem/CGUIProgressBar.h
0 → 100644
View file @
de84fb70
#ifndef CGUIPROGRESSBAR_H_
#define CGUIPROGRESSBAR_H_
#include <IGUIElement.h>
#include <SColor.h>
namespace
irr
{
namespace
gui
{
/*!
* A horizontal progess bar. ONLY works with CImageGUISkin applied - will fail
* if another skin is used.
*/
class
CGUIProgressBar
:
public
IGUIElement
{
public:
// If you want your progress bar colors to be independent of the skin set bind to false -- Madoc
CGUIProgressBar
(
IGUIElement
*
parent
,
IGUIEnvironment
*
environment
,
const
core
::
rect
<
s32
>&
rectangle
,
s32
id
=-
1
,
bool
bind
=
true
);
//! Automatically updates the progress bar's text every time the progress changes.
//! Set format to NULL or an empty string to disable automatic text.
void
setAutomaticText
(
const
wchar_t
*
format
);
void
setFillColor
(
video
::
SColor
fill
);
video
::
SColor
getFillColor
()
const
;
void
setEmptyColor
(
video
::
SColor
empty
);
video
::
SColor
getEmptyColor
()
const
;
void
setProgress
(
f32
progress
);
f32
getProgress
()
const
;
virtual
void
draw
();
private:
video
::
SColor
FillColor
;
video
::
SColor
EmptyColor
;
bool
bindColorsToSkin
;
f32
FilledRatio
;
core
::
stringw
AutomaticTextFormat
;
};
}
// namespace gui
}
// namespace irr
#endif
gframe/CGUISkinSystem/CGUISkinSystem.cpp
0 → 100644
View file @
de84fb70
This diff is collapsed.
Click to expand it.
gframe/CGUISkinSystem/CGUISkinSystem.h
0 → 100644
View file @
de84fb70
#ifndef __C_GUISKIN_SYSTEM_H_INCLUDED__
#define __C_GUISKIN_SYSTEM_H_INCLUDED__
#ifdef _WIN32
#include <irrlicht.h>
#endif
#include "CImageGUISkin.h"
#include "CGUIProgressBar.h"
//#include "SkinLoader.h"
#include "../CXMLRegistry/CXMLRegistry.h"
#ifndef _WIN32
// gcc dosnt do 'debug'
#ifndef _DEBUG
#define _DEBUG
#endif
#endif
#define SKINSYSTEM_SKINFILE "/skin.xml"
using
namespace
irr
;
class
CGUISkinSystem
{
private
:
IrrlichtDevice
*
device
;
io
::
IFileSystem
*
fs
;
io
::
path
skinsPath
;
core
::
array
<
core
::
stringw
>
skinsList
;
CXMLRegistry
*
registry
;
gui
::
CImageGUISkin
*
loadSkinFromFile
(
const
c8
*
skinfile
);
void
ParseGUIElementStyle
(
gui
::
SImageGUIElementStyle
&
elem
,
const
core
::
stringc
&
name
,
bool
nullcolors
=
false
);
bool
checkSkinColor
(
gui
::
EGUI_DEFAULT_COLOR
colToSet
,
const
wchar_t
*
context
,
gui
::
CImageGUISkin
*
skin
);
bool
checkSkinSize
(
gui
::
EGUI_DEFAULT_SIZE
sizeToSet
,
const
wchar_t
*
context
,
const
wchar_t
*
key
,
gui
::
CImageGUISkin
*
skin
);
bool
loadProperty
(
core
::
stringw
key
,
gui
::
CImageGUISkin
*
skin
);
public:
// Constructor
// path = Path to skins
// dev = Irrlicht device
CGUISkinSystem
(
core
::
string
<
char
*>
path
,
IrrlichtDevice
*
dev
);
~
CGUISkinSystem
();
core
::
array
<
core
::
stringw
>
listSkins
();
bool
loadSkinList
();
bool
applySkin
(
const
wchar_t
*
skinname
);
gui
::
CGUIProgressBar
*
addProgressBar
(
gui
::
IGUIElement
*
parent
,
core
::
rect
<
s32
>
rect
,
bool
bindColorsToSkin
=
true
);
// Gets property from current skin
core
::
stringw
getProperty
(
core
::
stringw
key
);
bool
populateTreeView
(
gui
::
IGUITreeView
*
control
,
const
core
::
stringc
&
skinname
);
};
#endif
gframe/CGUISkinSystem/CImageGUISkin.cpp
0 → 100644
View file @
de84fb70
This diff is collapsed.
Click to expand it.
gframe/CGUISkinSystem/CImageGUISkin.h
0 → 100644
View file @
de84fb70
#ifndef CIMAGEGUISKIN_H_
#define CIMAGEGUISKIN_H_
#include <IGUISkin.h>
#include <irrString.h>
#include <irrMap.h>
#include <IGUISpriteBank.h>
namespace
irr
{
namespace
video
{
class
IVideoDriver
;
class
ITexture
;
}
namespace
gui
{
struct
SImageGUIElementStyle
{
struct
SBorder
{
s32
Top
,
Left
,
Bottom
,
Right
;
SBorder
()
:
Top
(
0
),
Left
(
0
),
Bottom
(
0
),
Right
(
0
)
{}
};
SBorder
SrcBorder
;
SBorder
DstBorder
;
video
::
ITexture
*
Texture
;
video
::
SColor
Color
;
SImageGUIElementStyle
()
:
Texture
(
0
),
Color
(
255
,
255
,
255
,
255
)
{}
};
struct
SImageGUISkinConfig
{
SImageGUIElementStyle
SunkenPane
,
Window
,
Button
,
ButtonPressed
,
ButtonDisabled
,
ProgressBar
,
ProgressBarFilled
,
TabButton
,
TabButtonPressed
,
TabBody
,
MenuBar
,
MenuPane
,
MenuPressed
,
CheckBox
,
CheckBoxDisabled
,
ComboBox
,
ComboBoxDisabled
;
video
::
SColor
CheckBoxColor
;
};
class
CImageGUISkin
:
public
IGUISkin
{
public:
CImageGUISkin
(
video
::
IVideoDriver
*
videoDriver
,
IGUISkin
*
fallbackSkin
);
virtual
~
CImageGUISkin
();
void
loadConfig
(
const
SImageGUISkinConfig
&
config
);
//! returns default color
virtual
video
::
SColor
getColor
(
EGUI_DEFAULT_COLOR
color
)
const
;
//! sets a default color
virtual
void
setColor
(
EGUI_DEFAULT_COLOR
which
,
video
::
SColor
newColor
);
//! returns default color
virtual
s32
getSize
(
EGUI_DEFAULT_SIZE
size
)
const
;
//! Returns a default text.
virtual
const
wchar_t
*
getDefaultText
(
EGUI_DEFAULT_TEXT
text
)
const
;
//! Sets a default text.
virtual
void
setDefaultText
(
EGUI_DEFAULT_TEXT
which
,
const
wchar_t
*
newText
);
//! sets a default size
virtual
void
setSize
(
EGUI_DEFAULT_SIZE
which
,
s32
size
);
//! returns the default font
virtual
IGUIFont
*
getFont
(
EGUI_DEFAULT_FONT
defaultFont
)
const
;
//! sets a default font
virtual
void
setFont
(
IGUIFont
*
font
,
EGUI_DEFAULT_FONT
defaultFont
);
//! returns the sprite bank
virtual
IGUISpriteBank
*
getSpriteBank
()
const
;
//! sets the sprite bank
virtual
void
setSpriteBank
(
IGUISpriteBank
*
bank
);
virtual
u32
getIcon
(
EGUI_DEFAULT_ICON
icon
)
const
;
virtual
void
setIcon
(
EGUI_DEFAULT_ICON
icon
,
u32
index
);
virtual
void
draw3DButtonPaneStandard
(
IGUIElement
*
element
,
const
core
::
rect
<
s32
>&
rect
,
const
core
::
rect
<
s32
>*
clip
=
0
);
virtual
void
draw3DButtonPanePressed
(
IGUIElement
*
element
,
const
core
::
rect
<
s32
>&
rect
,
const
core
::
rect
<
s32
>*
clip
=
0
);
virtual
void
draw3DSunkenPane
(
IGUIElement
*
element
,
video
::
SColor
bgcolor
,
bool
flat
,
bool
fillBackGround
,
const
core
::
rect
<
s32
>&
rect
,
const
core
::
rect
<
s32
>*
clip
=
0
);
/* Updates for irrlicht 1.7 by Mamnarock
virtual core::rect<s32> draw3DWindowBackground(IGUIElement* element,
bool drawTitleBar, video::SColor titleBarColor,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0);
*/
virtual
core
::
rect
<
s32
>
draw3DWindowBackground
(
IGUIElement
*
element
,
bool
drawTitleBar
,
video
::
SColor
titleBarColor
,
const
core
::
rect
<
s32
>&
rect
,
const
core
::
rect
<
s32
>*
clip
=
0
,
core
::
rect
<
s32
>*
checkClientArea
=
0
);
virtual
void
draw3DMenuPane
(
IGUIElement
*
element
,
const
core
::
rect
<
s32
>&
rect
,
const
core
::
rect
<
s32
>*
clip
=
0
);
virtual
void
draw3DToolBar
(
IGUIElement
*
element
,
const
core
::
rect
<
s32
>&
rect
,
const
core
::
rect
<
s32
>*
clip
=
0
);
virtual
void
draw3DTabButton
(
IGUIElement
*
element
,
bool
active
,
const
core
::
rect
<
s32
>&
rect
,
const
core
::
rect
<
s32
>*
clip
=
0
,
EGUI_ALIGNMENT
alignment
=
EGUIA_UPPERLEFT
);
virtual
void
draw3DTabBody
(
IGUIElement
*
element
,
bool
border
,
bool
background
,
const
core
::
rect
<
s32
>&
rect
,
const
core
::
rect
<
s32
>*
clip
=
0
,
s32
tabHeight
=-
1
,
gui
::
EGUI_ALIGNMENT
alignment
=
EGUIA_UPPERLEFT
);
virtual
void
drawIcon
(
IGUIElement
*
element
,
EGUI_DEFAULT_ICON
icon
,
const
core
::
position2di
position
,
u32
starttime
=
0
,
u32
currenttime
=
0
,
bool
loop
=
false
,
const
core
::
rect
<
s32
>*
clip
=
0
);
// Madoc - I had to add some things
// Exposes config so we can get the progress bar colors
virtual
SImageGUISkinConfig
getConfig
()
{
return
Config
;
}
// End Madoc adds
virtual
void
drawHorizontalProgressBar
(
IGUIElement
*
element
,
const
core
::
rect
<
s32
>&
rectangle
,
const
core
::
rect
<
s32
>*
clip
,
f32
filledRatio
,
video
::
SColor
fillColor
,
video
::
SColor
emptyColor
);
virtual
void
draw2DRectangle
(
IGUIElement
*
element
,
const
video
::
SColor
&
color
,
const
core
::
rect
<
s32
>&
pos
,
const
core
::
rect
<
s32
>*
clip
=
0
);
virtual
void
setProperty
(
core
::
stringw
key
,
core
::
stringw
value
);
virtual
core
::
stringw
getProperty
(
core
::
stringw
key
);
private:
void
drawElementStyle
(
const
SImageGUIElementStyle
&
elem
,
const
core
::
rect
<
s32
>&
rect
,
const
core
::
rect
<
s32
>*
clip
,
video
::
SColor
*
color
=
0
);
video
::
IVideoDriver
*
VideoDriver
;
IGUISkin
*
FallbackSkin
;
SImageGUISkinConfig
Config
;
core
::
map
<
core
::
stringw
,
core
::
stringw
>
properties
;
};
}
}
#endif
gframe/CGUISkinSystem/clipRects.h
0 → 100644
View file @
de84fb70
#ifndef _CLIP_RECTS_H_
#define _CLIP_RECTS_H_
#include <rect.h>
namespace
irr
{
//! Workaround for a bug in IVideoDriver::draw2DImage( ITexture* tex, rect<s32> dstRect, rect<s32> srcRect, rect<s32>* clip, SColor* colors, bool alpha )
//! It modifies dstRect and srcRect so the resulting dstRect is entirely inside the clipping rect.
//! srcRect is scaled so the same part of the image is displayed.
//! Returns false if dstRect is entirely outside clip, or true if at least some of it is inside.
inline
bool
clipRects
(
core
::
rect
<
s32
>&
dstRect
,
core
::
rect
<
s32
>&
srcRect
,
const
core
::
rect
<
s32
>&
clip
)
{
// Clip left side
if
(
dstRect
.
UpperLeftCorner
.
X
<
clip
.
UpperLeftCorner
.
X
)
{
s32
w
=
clip
.
UpperLeftCorner
.
X
-
dstRect
.
UpperLeftCorner
.
X
;
f32
percentRemoved
=
(
f32
)
w
/
(
f32
)
dstRect
.
getWidth
();
dstRect
.
UpperLeftCorner
.
X
=
clip
.
UpperLeftCorner
.
X
;
srcRect
.
UpperLeftCorner
.
X
+=
(
s32
)(
percentRemoved
*
srcRect
.
getWidth
());
}
// Clip top side
if
(
dstRect
.
UpperLeftCorner
.
Y
<
clip
.
UpperLeftCorner
.
Y
)
{
s32
w
=
clip
.
UpperLeftCorner
.
Y
-
dstRect
.
UpperLeftCorner
.
Y
;
f32
percentRemoved
=
(
f32
)
w
/
(
f32
)
dstRect
.
getHeight
();
dstRect
.
UpperLeftCorner
.
Y
=
clip
.
UpperLeftCorner
.
Y
;
srcRect
.
UpperLeftCorner
.
Y
+=
(
s32
)(
percentRemoved
*
srcRect
.
getHeight
());
}
// Clip right side
if
(
dstRect
.
LowerRightCorner
.
X
>
clip
.
LowerRightCorner
.
X
)
{
s32
w
=
dstRect
.
LowerRightCorner
.
X
-
clip
.
LowerRightCorner
.
X
;
f32
percentRemoved
=
(
f32
)
w
/
(
f32
)
dstRect
.
getWidth
();
dstRect
.
LowerRightCorner
.
X
=
clip
.
LowerRightCorner
.
X
;
srcRect
.
LowerRightCorner
.
X
-=
(
s32
)(
percentRemoved
*
srcRect
.
getWidth
());
}
// Clip bottom side
if
(
dstRect
.
LowerRightCorner
.
Y
>
clip
.
LowerRightCorner
.
Y
)
{
s32
w
=
dstRect
.
LowerRightCorner
.
Y
-
clip
.
LowerRightCorner
.
Y
;
f32
percentRemoved
=
(
f32
)
w
/
(
f32
)
dstRect
.
getHeight
();
dstRect
.
LowerRightCorner
.
Y
=
clip
.
LowerRightCorner
.
Y
;
srcRect
.
LowerRightCorner
.
Y
-=
(
s32
)(
percentRemoved
*
srcRect
.
getHeight
());
}
return
(
dstRect
.
getWidth
()
>
0
&&
dstRect
.
getHeight
()
>
0
);
}
}
// namespace irr
#endif
gframe/game.cpp
View file @
de84fb70
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#include "duelclient.h"
#include "duelclient.h"
#include "netserver.h"
#include "netserver.h"
#include "single_mode.h"
#include "single_mode.h"
#include <sstream>
#ifndef _WIN32
#ifndef _WIN32
#include <sys/types.h>
#include <sys/types.h>
...
@@ -34,6 +35,15 @@ bool Game::Initialize() {
...
@@ -34,6 +35,15 @@ bool Game::Initialize() {
device
=
irr
::
createDeviceEx
(
params
);
device
=
irr
::
createDeviceEx
(
params
);
if
(
!
device
)
if
(
!
device
)
return
false
;
return
false
;
// Apply skin
if
(
gameConf
.
skin_index
>=
0
)
{
skinSystem
=
new
CGUISkinSystem
(
"skin"
,
device
);
core
::
array
<
core
::
stringw
>
skins
=
skinSystem
->
listSkins
();
if
((
size_t
)
gameConf
.
skin_index
<
skins
.
size
())
{
int
index
=
skins
.
size
()
-
gameConf
.
skin_index
-
1
;
// reverse index
skinSystem
->
applySkin
(
skins
[
index
].
c_str
());
}
}
linePatternD3D
=
0
;
linePatternD3D
=
0
;
linePatternGL
=
0x0f0f
;
linePatternGL
=
0x0f0f
;
waitFrame
=
0
;
waitFrame
=
0
;
...
@@ -1054,6 +1064,7 @@ void Game::LoadConfig() {
...
@@ -1054,6 +1064,7 @@ void Game::LoadConfig() {
gameConf
.
enable_music
=
true
;
gameConf
.
enable_music
=
true
;
gameConf
.
music_volume
=
0.5
;
gameConf
.
music_volume
=
0.5
;
gameConf
.
music_mode
=
1
;
gameConf
.
music_mode
=
1
;
gameConf
.
skin_index
=
-
1
;
while
(
fgets
(
linebuf
,
256
,
fp
))
{
while
(
fgets
(
linebuf
,
256
,
fp
))
{
sscanf
(
linebuf
,
"%s = %s"
,
strbuf
,
valbuf
);
sscanf
(
linebuf
,
"%s = %s"
,
strbuf
,
valbuf
);
if
(
!
strcmp
(
strbuf
,
"antialias"
))
{
if
(
!
strcmp
(
strbuf
,
"antialias"
))
{
...
@@ -1126,6 +1137,8 @@ void Game::LoadConfig() {
...
@@ -1126,6 +1137,8 @@ void Game::LoadConfig() {
gameConf
.
music_volume
=
atof
(
valbuf
)
/
100
;
gameConf
.
music_volume
=
atof
(
valbuf
)
/
100
;
}
else
if
(
!
strcmp
(
strbuf
,
"music_mode"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"music_mode"
))
{
gameConf
.
music_mode
=
atoi
(
valbuf
);
gameConf
.
music_mode
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"skin_index"
))
{
gameConf
.
skin_index
=
atoi
(
valbuf
);
}
else
{
}
else
{
// options allowing multiple words
// options allowing multiple words
sscanf
(
linebuf
,
"%s = %240[^
\n
]"
,
strbuf
,
valbuf
);
sscanf
(
linebuf
,
"%s = %240[^
\n
]"
,
strbuf
,
valbuf
);
...
@@ -1196,6 +1209,7 @@ void Game::SaveConfig() {
...
@@ -1196,6 +1209,7 @@ void Game::SaveConfig() {
if
(
vol
<
0
)
vol
=
0
;
else
if
(
vol
>
100
)
vol
=
100
;
if
(
vol
<
0
)
vol
=
0
;
else
if
(
vol
>
100
)
vol
=
100
;
fprintf
(
fp
,
"music_volume = %d
\n
"
,
vol
);
fprintf
(
fp
,
"music_volume = %d
\n
"
,
vol
);
fprintf
(
fp
,
"music_mode = %d
\n
"
,
(
chkMusicMode
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"music_mode = %d
\n
"
,
(
chkMusicMode
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"skin_index = %d
\n
"
,
gameConf
.
skin_index
);
fclose
(
fp
);
fclose
(
fp
);
}
}
void
Game
::
ShowCardInfo
(
int
code
)
{
void
Game
::
ShowCardInfo
(
int
code
)
{
...
...
gframe/game.h
View file @
de84fb70
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#include <unordered_map>
#include <unordered_map>
#include <vector>
#include <vector>
#include <list>
#include <list>
#include "CGUISkinSystem/CGUISkinSystem.h"
namespace
ygo
{
namespace
ygo
{
...
@@ -47,6 +48,7 @@ struct Config {
...
@@ -47,6 +48,7 @@ struct Config {
double
sound_volume
;
double
sound_volume
;
double
music_volume
;
double
music_volume
;
int
music_mode
;
int
music_mode
;
int
skin_index
;
};
};
struct
DuelInfo
{
struct
DuelInfo
{
...
@@ -193,6 +195,8 @@ public:
...
@@ -193,6 +195,8 @@ public:
bool
is_building
;
bool
is_building
;
bool
is_siding
;
bool
is_siding
;
CGUISkinSystem
*
skinSystem
;
ClientField
dField
;
ClientField
dField
;
DeckBuilder
deckBuilder
;
DeckBuilder
deckBuilder
;
...
...
system.conf
View file @
de84fb70
...
@@ -36,3 +36,4 @@ enable_music = 1
...
@@ -36,3 +36,4 @@ enable_music = 1
sound_volume
=
50
sound_volume
=
50
music_volume
=
50
music_volume
=
50
music_mode
=
1
music_mode
=
1
skin_index
= -
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