Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
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
Commits
5180c001
Commit
5180c001
authored
May 12, 2019
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
移除AndroidGUIListbox并放大GUIListBox的scrollbar大小
parent
9041b4d8
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
7 additions
and
1325 deletions
+7
-1325
Classes/gframe/CGUIListBox.h
Classes/gframe/CGUIListBox.h
+0
-192
Classes/gframe/game.cpp
Classes/gframe/game.cpp
+6
-11
libcore/android/CAndroidGUIListBox.cpp
libcore/android/CAndroidGUIListBox.cpp
+0
-921
libcore/android/CAndroidGUIListBox.h
libcore/android/CAndroidGUIListBox.h
+0
-199
libcore/android/CAndroidGUISkin.cpp
libcore/android/CAndroidGUISkin.cpp
+1
-1
libcore/jni/Android.mk
libcore/jni/Android.mk
+0
-1
No files found.
Classes/gframe/CGUIListBox.h
deleted
100644 → 0
View file @
9041b4d8
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_GUI_LIST_BOX_H_INCLUDED__
#define __C_GUI_LIST_BOX_H_INCLUDED__
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_GUI_
#include "IGUIListBox.h"
#include "irrArray.h"
namespace
irr
{
namespace
gui
{
class
IGUIFont
;
class
IGUIScrollBar
;
class
CGUIListBox
:
public
IGUIListBox
{
public:
//! constructor
CGUIListBox
(
IGUIEnvironment
*
environment
,
IGUIElement
*
parent
,
s32
id
,
core
::
rect
<
s32
>
rectangle
,
bool
clip
=
true
,
bool
drawBack
=
false
,
bool
moveOverSelect
=
false
);
//! destructor
virtual
~
CGUIListBox
();
//! returns amount of list items
virtual
u32
getItemCount
()
const
_IRR_OVERRIDE_
;
//! returns string of a list item. the id may be a value from 0 to itemCount-1
virtual
const
wchar_t
*
getListItem
(
u32
id
)
const
_IRR_OVERRIDE_
;
//! adds an list item, returns id of item
virtual
u32
addItem
(
const
wchar_t
*
text
)
_IRR_OVERRIDE_
;
//! clears the list
virtual
void
clear
()
_IRR_OVERRIDE_
;
//! returns id of selected item. returns -1 if no item is selected.
virtual
s32
getSelected
()
const
_IRR_OVERRIDE_
;
//! sets the selected item. Set this to -1 if no item should be selected
virtual
void
setSelected
(
s32
id
)
_IRR_OVERRIDE_
;
//! sets the selected item. Set this to -1 if no item should be selected
virtual
void
setSelected
(
const
wchar_t
*
item
)
_IRR_OVERRIDE_
;
//! called if an event happened.
virtual
bool
OnEvent
(
const
SEvent
&
event
)
_IRR_OVERRIDE_
;
//! draws the element and its children
virtual
void
draw
()
_IRR_OVERRIDE_
;
//! adds an list item with an icon
//! \param text Text of list entry
//! \param icon Sprite index of the Icon within the current sprite bank. Set it to -1 if you want no icon
//! \return
//! returns the id of the new created item
virtual
u32
addItem
(
const
wchar_t
*
text
,
s32
icon
)
_IRR_OVERRIDE_
;
//! Returns the icon of an item
virtual
s32
getIcon
(
u32
id
)
const
_IRR_OVERRIDE_
;
//! removes an item from the list
virtual
void
removeItem
(
u32
id
)
_IRR_OVERRIDE_
;
//! get the the id of the item at the given absolute coordinates
virtual
s32
getItemAt
(
s32
xpos
,
s32
ypos
)
const
_IRR_OVERRIDE_
;
//! Sets the sprite bank which should be used to draw list icons. This font is set to the sprite bank of
//! the built-in-font by default. A sprite can be displayed in front of every list item.
//! An icon is an index within the icon sprite bank. Several default icons are available in the
//! skin through getIcon
virtual
void
setSpriteBank
(
IGUISpriteBank
*
bank
)
_IRR_OVERRIDE_
;
//! set whether the listbox should scroll to newly selected items
virtual
void
setAutoScrollEnabled
(
bool
scroll
)
_IRR_OVERRIDE_
;
//! returns true if automatic scrolling is enabled, false if not.
virtual
bool
isAutoScrollEnabled
()
const
_IRR_OVERRIDE_
;
//! Update the position and size of the listbox, and update the scrollbar
virtual
void
updateAbsolutePosition
()
_IRR_OVERRIDE_
;
//! Writes attributes of the element.
virtual
void
serializeAttributes
(
io
::
IAttributes
*
out
,
io
::
SAttributeReadWriteOptions
*
options
)
const
_IRR_OVERRIDE_
;
//! Reads attributes of the element
virtual
void
deserializeAttributes
(
io
::
IAttributes
*
in
,
io
::
SAttributeReadWriteOptions
*
options
)
_IRR_OVERRIDE_
;
//! set all item colors at given index to color
virtual
void
setItemOverrideColor
(
u32
index
,
video
::
SColor
color
)
_IRR_OVERRIDE_
;
//! set all item colors of specified type at given index to color
virtual
void
setItemOverrideColor
(
u32
index
,
EGUI_LISTBOX_COLOR
colorType
,
video
::
SColor
color
)
_IRR_OVERRIDE_
;
//! clear all item colors at index
virtual
void
clearItemOverrideColor
(
u32
index
)
_IRR_OVERRIDE_
;
//! clear item color at index for given colortype
virtual
void
clearItemOverrideColor
(
u32
index
,
EGUI_LISTBOX_COLOR
colorType
)
_IRR_OVERRIDE_
;
//! has the item at index its color overwritten?
virtual
bool
hasItemOverrideColor
(
u32
index
,
EGUI_LISTBOX_COLOR
colorType
)
const
_IRR_OVERRIDE_
;
//! return the overwrite color at given item index.
virtual
video
::
SColor
getItemOverrideColor
(
u32
index
,
EGUI_LISTBOX_COLOR
colorType
)
const
_IRR_OVERRIDE_
;
//! return the default color which is used for the given colorType
virtual
video
::
SColor
getItemDefaultColor
(
EGUI_LISTBOX_COLOR
colorType
)
const
_IRR_OVERRIDE_
;
//! set the item at the given index
virtual
void
setItem
(
u32
index
,
const
wchar_t
*
text
,
s32
icon
)
_IRR_OVERRIDE_
;
//! Insert the item at the given index
//! Return the index on success or -1 on failure.
virtual
s32
insertItem
(
u32
index
,
const
wchar_t
*
text
,
s32
icon
)
_IRR_OVERRIDE_
;
//! Swap the items at the given indices
virtual
void
swapItems
(
u32
index1
,
u32
index2
)
_IRR_OVERRIDE_
;
//! set global itemHeight
virtual
void
setItemHeight
(
s32
height
)
_IRR_OVERRIDE_
;
//! Sets whether to draw the background
virtual
void
setDrawBackground
(
bool
draw
)
_IRR_OVERRIDE_
;
//! Access the vertical scrollbar
virtual
IGUIScrollBar
*
getVerticalScrollBar
()
const
_IRR_OVERRIDE_
;
private:
struct
ListItem
{
ListItem
()
:
Icon
(
-
1
)
{}
core
::
stringw
Text
;
s32
Icon
;
// A multicolor extension
struct
ListItemOverrideColor
{
ListItemOverrideColor
()
:
Use
(
false
)
{}
bool
Use
;
video
::
SColor
Color
;
};
ListItemOverrideColor
OverrideColors
[
EGUI_LBC_COUNT
];
};
void
recalculateItemHeight
();
void
selectNew
(
s32
ypos
,
bool
onlyHover
=
false
);
void
recalculateScrollPos
();
// extracted that function to avoid copy&paste code
void
recalculateItemWidth
(
s32
icon
);
// get labels used for serialization
bool
getSerializationLabels
(
EGUI_LISTBOX_COLOR
colorType
,
core
::
stringc
&
useColorLabel
,
core
::
stringc
&
colorLabel
)
const
;
core
::
array
<
ListItem
>
Items
;
s32
Selected
;
s32
ItemHeight
;
s32
ItemHeightOverride
;
s32
TotalItemHeight
;
s32
ItemsIconWidth
;
gui
::
IGUIFont
*
Font
;
gui
::
IGUISpriteBank
*
IconBank
;
gui
::
IGUIScrollBar
*
ScrollBar
;
u32
selectTime
;
u32
LastKeyTime
;
core
::
stringw
KeyBuffer
;
bool
Selecting
;
bool
DrawBack
;
bool
MoveOverSelect
;
bool
AutoScroll
;
bool
HighlightWhenNotFocused
;
};
}
// end namespace gui
}
// end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_
#endif
Classes/gframe/game.cpp
View file @
5180c001
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
#include <android/AndroidSoundEffectPlayer.h>
#include <android/AndroidSoundEffectPlayer.h>
#include <android/CAndroidGUIEditBox.h>
#include <android/CAndroidGUIEditBox.h>
#include <android/CAndroidGUIComboBox.h>
#include <android/CAndroidGUIComboBox.h>
#include <android/CAndroidGUIListBox.h>
#include <android/CAndroidGUISkin.h>
#include <android/CAndroidGUISkin.h>
#include <COGLES2ExtensionHandler.h>
#include <COGLES2ExtensionHandler.h>
#include <COGLESExtensionHandler.h>
#include <COGLESExtensionHandler.h>
...
@@ -428,9 +427,7 @@ bool Game::Initialize() {
...
@@ -428,9 +427,7 @@ bool Game::Initialize() {
scrCardText
->
setVisible
(
false
);
scrCardText
->
setVisible
(
false
);
//log
//log
irr
::
gui
::
IGUITab
*
tabLog
=
wInfos
->
addTab
(
dataManager
.
GetSysString
(
1271
));
irr
::
gui
::
IGUITab
*
tabLog
=
wInfos
->
addTab
(
dataManager
.
GetSysString
(
1271
));
#ifdef _IRR_ANDROID_PLATFORM_
lstLog
=
env
->
addListBox
(
rect
<
s32
>
(
10
*
xScale
,
10
*
yScale
,
290
*
xScale
,
290
*
yScale
),
tabLog
,
LISTBOX_LOG
,
false
);
lstLog
=
CAndroidGUIListBox
::
addAndroidGUIListBox
(
env
,
rect
<
s32
>
(
10
*
xScale
,
10
*
yScale
,
290
*
xScale
,
290
*
yScale
),
tabLog
,
LISTBOX_LOG
,
false
,
40
*
xScale
);
#endif
lstLog
->
setItemHeight
(
22
*
yScale
);
lstLog
->
setItemHeight
(
22
*
yScale
);
btnClearLog
=
env
->
addButton
(
rect
<
s32
>
(
160
*
xScale
,
300
*
yScale
,
260
*
xScale
,
325
*
yScale
),
tabLog
,
BUTTON_CLEAR_LOG
,
dataManager
.
GetSysString
(
1272
));
btnClearLog
=
env
->
addButton
(
rect
<
s32
>
(
160
*
xScale
,
300
*
yScale
,
260
*
xScale
,
325
*
yScale
),
tabLog
,
BUTTON_CLEAR_LOG
,
dataManager
.
GetSysString
(
1272
));
//helper
//helper
...
@@ -640,12 +637,9 @@ bool Game::Initialize() {
...
@@ -640,12 +637,9 @@ bool Game::Initialize() {
wANCard
=
env
->
addWindow
(
rect
<
s32
>
(
400
*
xScale
,
100
*
yScale
,
800
*
xScale
,
400
*
yScale
),
false
,
L""
);
wANCard
=
env
->
addWindow
(
rect
<
s32
>
(
400
*
xScale
,
100
*
yScale
,
800
*
xScale
,
400
*
yScale
),
false
,
L""
);
wANCard
->
getCloseButton
()
->
setVisible
(
false
);
wANCard
->
getCloseButton
()
->
setVisible
(
false
);
wANCard
->
setVisible
(
false
);
wANCard
->
setVisible
(
false
);
#ifdef _IRR_ANDROID_PLATFORM_
ebANCard
=
CAndroidGUIEditBox
::
addAndroidEditBox
(
L""
,
true
,
env
,
rect
<
s32
>
(
20
*
xScale
,
25
*
yScale
,
380
*
xScale
,
55
*
yScale
),
wANCard
,
EDITBOX_ANCARD
);
ebANCard
=
CAndroidGUIEditBox
::
addAndroidEditBox
(
L""
,
true
,
env
,
rect
<
s32
>
(
20
*
xScale
,
25
*
yScale
,
380
*
xScale
,
55
*
yScale
),
wANCard
,
EDITBOX_ANCARD
);
lstANCard
=
CAndroidGUIListBox
::
addAndroidGUIListBox
(
env
,
rect
<
s32
>
(
20
*
xScale
,
55
*
yScale
,
380
*
xScale
,
260
*
yScale
),
wANCard
,
LISTBOX_ANCARD
,
true
,
40
*
xScale
);
#endif
ebANCard
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
ebANCard
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
//dont merge
lstANCard
=
env
->
addListBox
(
rect
<
s32
>
(
20
*
xScale
,
55
*
yScale
,
380
*
xScale
,
260
*
yScale
),
wANCard
,
LISTBOX_ANCARD
,
true
);
btnANCardOK
=
env
->
addButton
(
rect
<
s32
>
(
140
*
xScale
,
260
*
yScale
,
270
*
xScale
,
295
*
yScale
),
wANCard
,
BUTTON_ANCARD_OK
,
dataManager
.
GetSysString
(
1211
));
btnANCardOK
=
env
->
addButton
(
rect
<
s32
>
(
140
*
xScale
,
260
*
yScale
,
270
*
xScale
,
295
*
yScale
),
wANCard
,
BUTTON_ANCARD_OK
,
dataManager
.
GetSysString
(
1211
));
//announce attribute
//announce attribute
wANAttribute
=
env
->
addWindow
(
rect
<
s32
>
(
450
*
xScale
,
200
*
yScale
,
800
*
xScale
,
370
*
yScale
),
false
,
dataManager
.
GetSysString
(
562
));
wANAttribute
=
env
->
addWindow
(
rect
<
s32
>
(
450
*
xScale
,
200
*
yScale
,
800
*
xScale
,
370
*
yScale
),
false
,
dataManager
.
GetSysString
(
562
));
...
@@ -864,7 +858,7 @@ bool Game::Initialize() {
...
@@ -864,7 +858,7 @@ bool Game::Initialize() {
wReplay
=
env
->
addWindow
(
rect
<
s32
>
(
220
*
xScale
,
100
*
yScale
,
800
*
xScale
,
520
*
yScale
),
false
,
dataManager
.
GetSysString
(
1202
));
wReplay
=
env
->
addWindow
(
rect
<
s32
>
(
220
*
xScale
,
100
*
yScale
,
800
*
xScale
,
520
*
yScale
),
false
,
dataManager
.
GetSysString
(
1202
));
wReplay
->
getCloseButton
()
->
setVisible
(
false
);
wReplay
->
getCloseButton
()
->
setVisible
(
false
);
wReplay
->
setVisible
(
false
);
wReplay
->
setVisible
(
false
);
lstReplayList
=
CAndroidGUIListBox
::
addAndroidGUIListBox
(
env
,
rect
<
s32
>
(
10
*
xScale
,
30
*
yScale
,
350
*
xScale
,
400
*
yScale
),
wReplay
,
LISTBOX_REPLAY_LIST
,
true
,
40
*
xScal
e
);
lstReplayList
=
env
->
addListBox
(
rect
<
s32
>
(
10
*
xScale
,
30
*
yScale
,
350
*
xScale
,
400
*
yScale
),
wReplay
,
LISTBOX_REPLAY_LIST
,
tru
e
);
lstReplayList
->
setItemHeight
(
22
*
yScale
);
lstReplayList
->
setItemHeight
(
22
*
yScale
);
btnLoadReplay
=
env
->
addButton
(
rect
<
s32
>
(
470
*
xScale
,
320
*
yScale
,
570
*
xScale
,
360
*
yScale
),
wReplay
,
BUTTON_LOAD_REPLAY
,
dataManager
.
GetSysString
(
1348
));
btnLoadReplay
=
env
->
addButton
(
rect
<
s32
>
(
470
*
xScale
,
320
*
yScale
,
570
*
xScale
,
360
*
yScale
),
wReplay
,
BUTTON_LOAD_REPLAY
,
dataManager
.
GetSysString
(
1348
));
btnDeleteReplay
=
env
->
addButton
(
rect
<
s32
>
(
360
*
xScale
,
320
*
yScale
,
460
*
xScale
,
360
*
yScale
),
wReplay
,
BUTTON_DELETE_REPLAY
,
dataManager
.
GetSysString
(
1361
));
btnDeleteReplay
=
env
->
addButton
(
rect
<
s32
>
(
360
*
xScale
,
320
*
yScale
,
460
*
xScale
,
360
*
yScale
),
wReplay
,
BUTTON_DELETE_REPLAY
,
dataManager
.
GetSysString
(
1361
));
...
@@ -885,7 +879,7 @@ bool Game::Initialize() {
...
@@ -885,7 +879,7 @@ bool Game::Initialize() {
//TEST BOT MODE
//TEST BOT MODE
if
(
gameConf
.
enable_bot_mode
)
{
if
(
gameConf
.
enable_bot_mode
)
{
irr
::
gui
::
IGUITab
*
tabBot
=
wSingle
->
addTab
(
dataManager
.
GetSysString
(
1380
));
irr
::
gui
::
IGUITab
*
tabBot
=
wSingle
->
addTab
(
dataManager
.
GetSysString
(
1380
));
lstBotList
=
CAndroidGUIListBox
::
addAndroidGUIListBox
(
env
,
rect
<
s32
>
(
10
*
xScale
,
10
*
yScale
,
350
*
xScale
,
350
*
yScale
),
tabBot
,
LISTBOX_BOT_LIST
,
true
,
40
*
xScal
e
);
lstBotList
=
env
->
addListBox
(
rect
<
s32
>
(
10
*
xScale
,
10
*
yScale
,
350
*
xScale
,
350
*
yScale
),
tabBot
,
LISTBOX_BOT_LIST
,
tru
e
);
lstBotList
->
setItemHeight
(
25
*
yScale
);
lstBotList
->
setItemHeight
(
25
*
yScale
);
btnStartBot
=
env
->
addButton
(
rect
<
s32
>
(
460
*
xScale
,
260
*
yScale
,
570
*
xScale
,
300
*
yScale
),
tabBot
,
BUTTON_BOT_START
,
dataManager
.
GetSysString
(
1211
));
btnStartBot
=
env
->
addButton
(
rect
<
s32
>
(
460
*
xScale
,
260
*
yScale
,
570
*
xScale
,
300
*
yScale
),
tabBot
,
BUTTON_BOT_START
,
dataManager
.
GetSysString
(
1211
));
btnBotCancel
=
env
->
addButton
(
rect
<
s32
>
(
460
*
xScale
,
310
*
yScale
,
570
*
xScale
,
350
*
yScale
),
tabBot
,
BUTTON_CANCEL_SINGLEPLAY
,
dataManager
.
GetSysString
(
1210
));
btnBotCancel
=
env
->
addButton
(
rect
<
s32
>
(
460
*
xScale
,
310
*
yScale
,
570
*
xScale
,
350
*
yScale
),
tabBot
,
BUTTON_CANCEL_SINGLEPLAY
,
dataManager
.
GetSysString
(
1210
));
...
@@ -904,7 +898,8 @@ bool Game::Initialize() {
...
@@ -904,7 +898,8 @@ bool Game::Initialize() {
//SINGLE MODE
//SINGLE MODE
irr
::
gui
::
IGUITab
*
tabSingle
=
wSingle
->
addTab
(
dataManager
.
GetSysString
(
1381
));
irr
::
gui
::
IGUITab
*
tabSingle
=
wSingle
->
addTab
(
dataManager
.
GetSysString
(
1381
));
env
->
addStaticText
(
dataManager
.
GetSysString
(
1352
),
rect
<
s32
>
(
360
*
xScale
,
30
*
yScale
,
570
*
xScale
,
50
*
yScale
),
false
,
true
,
tabSingle
);
env
->
addStaticText
(
dataManager
.
GetSysString
(
1352
),
rect
<
s32
>
(
360
*
xScale
,
30
*
yScale
,
570
*
xScale
,
50
*
yScale
),
false
,
true
,
tabSingle
);
stSinglePlayInfo
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
360
*
xScale
,
60
*
yScale
,
570
*
xScale
,
295
*
yScale
),
false
,
true
,
tabSingle
);
lstSinglePlayList
=
CAndroidGUIListBox
::
addAndroidGUIListBox
(
env
,
rect
<
s32
>
(
10
*
xScale
,
10
*
yScale
,
350
*
xScale
,
350
*
yScale
),
tabSingle
,
LISTBOX_SINGLEPLAY_LIST
,
true
,
40
*
xScale
);
stSinglePlayInfo
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
360
*
xScale
,
60
*
yScale
,
570
*
xScale
,
295
*
yScale
),
false
,
true
,
tabSingle
);
lstSinglePlayList
=
env
->
addListBox
(
rect
<
s32
>
(
10
*
xScale
,
10
*
yScale
,
350
*
xScale
,
350
*
yScale
),
tabSingle
,
LISTBOX_SINGLEPLAY_LIST
,
true
);
lstSinglePlayList
->
setItemHeight
(
25
*
yScale
);
lstSinglePlayList
->
setItemHeight
(
25
*
yScale
);
btnLoadSinglePlay
=
env
->
addButton
(
rect
<
s32
>
(
460
*
xScale
,
260
*
yScale
,
570
*
xScale
,
300
*
yScale
),
tabSingle
,
BUTTON_LOAD_SINGLEPLAY
,
dataManager
.
GetSysString
(
1211
));
btnLoadSinglePlay
=
env
->
addButton
(
rect
<
s32
>
(
460
*
xScale
,
260
*
yScale
,
570
*
xScale
,
300
*
yScale
),
tabSingle
,
BUTTON_LOAD_SINGLEPLAY
,
dataManager
.
GetSysString
(
1211
));
btnSinglePlayCancel
=
env
->
addButton
(
rect
<
s32
>
(
460
*
xScale
,
310
*
yScale
,
570
*
xScale
,
350
*
yScale
),
tabSingle
,
BUTTON_CANCEL_SINGLEPLAY
,
dataManager
.
GetSysString
(
1210
));
btnSinglePlayCancel
=
env
->
addButton
(
rect
<
s32
>
(
460
*
xScale
,
310
*
yScale
,
570
*
xScale
,
350
*
yScale
),
tabSingle
,
BUTTON_CANCEL_SINGLEPLAY
,
dataManager
.
GetSysString
(
1210
));
...
...
libcore/android/CAndroidGUIListBox.cpp
deleted
100644 → 0
View file @
9041b4d8
This diff is collapsed.
Click to expand it.
libcore/android/CAndroidGUIListBox.h
deleted
100644 → 0
View file @
9041b4d8
/*
* CAndroidGUIListBox.h
*
* Created on: 2014年3月24日
* Author: mabin
*/
#ifndef CANDROIDGUILISTBOX_H_
#define CANDROIDGUILISTBOX_H_
#include "irrlicht.h"
namespace
irr
{
namespace
gui
{
class
IGUIFont
;
class
IGUIScrollBar
;
class
CAndroidGUIListBox
:
public
irr
::
gui
::
IGUIListBox
{
public:
//! constructor
CAndroidGUIListBox
(
IGUIEnvironment
*
environment
,
IGUIElement
*
parent
,
s32
id
,
core
::
rect
<
s32
>
rectangle
,
bool
clip
,
bool
drawBack
,
bool
moveOverSelect
,
int
scrollbarSize
);
static
CAndroidGUIListBox
*
addAndroidGUIListBox
(
IGUIEnvironment
*
environment
,
core
::
rect
<
s32
>
rectangle
,
IGUIElement
*
parent
,
s32
id
,
bool
drawBack
,
int
scrollbarSize
);
//! destructor
virtual
~
CAndroidGUIListBox
();
//! returns amount of list items
virtual
u32
getItemCount
()
const
_IRR_OVERRIDE_
;
//! returns string of a list item. the id may be a value from 0 to itemCount-1
virtual
const
wchar_t
*
getListItem
(
u32
id
)
const
_IRR_OVERRIDE_
;
//! adds an list item, returns id of item
virtual
u32
addItem
(
const
wchar_t
*
text
)
_IRR_OVERRIDE_
;
//! clears the list
virtual
void
clear
()
_IRR_OVERRIDE_
;
//! returns id of selected item. returns -1 if no item is selected.
virtual
s32
getSelected
()
const
_IRR_OVERRIDE_
;
//! sets the selected item. Set this to -1 if no item should be selected
virtual
void
setSelected
(
s32
id
)
_IRR_OVERRIDE_
;
//! sets the selected item. Set this to -1 if no item should be selected
virtual
void
setSelected
(
const
wchar_t
*
item
)
_IRR_OVERRIDE_
;
//! called if an event happened.
virtual
bool
OnEvent
(
const
SEvent
&
event
)
_IRR_OVERRIDE_
;
//! draws the element and its children
virtual
void
draw
()
_IRR_OVERRIDE_
;
//! adds an list item with an icon
//! \param text Text of list entry
//! \param icon Sprite index of the Icon within the current sprite bank. Set it to -1 if you want no icon
//! \return
//! returns the id of the new created item
virtual
u32
addItem
(
const
wchar_t
*
text
,
s32
icon
)
_IRR_OVERRIDE_
;
//! Returns the icon of an item
virtual
s32
getIcon
(
u32
id
)
const
_IRR_OVERRIDE_
;
//! removes an item from the list
virtual
void
removeItem
(
u32
id
)
_IRR_OVERRIDE_
;
//! get the the id of the item at the given absolute coordinates
virtual
s32
getItemAt
(
s32
xpos
,
s32
ypos
)
const
_IRR_OVERRIDE_
;
//! Sets the sprite bank which should be used to draw list icons. This font is set to the sprite bank of
//! the built-in-font by default. A sprite can be displayed in front of every list item.
//! An icon is an index within the icon sprite bank. Several default icons are available in the
//! skin through getIcon
virtual
void
setSpriteBank
(
IGUISpriteBank
*
bank
)
_IRR_OVERRIDE_
;
//! set whether the listbox should scroll to newly selected items
virtual
void
setAutoScrollEnabled
(
bool
scroll
)
_IRR_OVERRIDE_
;
//! returns true if automatic scrolling is enabled, false if not.
virtual
bool
isAutoScrollEnabled
()
const
_IRR_OVERRIDE_
;
//! Update the position and size of the listbox, and update the scrollbar
virtual
void
updateAbsolutePosition
()
_IRR_OVERRIDE_
;
//! Writes attributes of the element.
virtual
void
serializeAttributes
(
io
::
IAttributes
*
out
,
io
::
SAttributeReadWriteOptions
*
options
)
const
_IRR_OVERRIDE_
;
//! Reads attributes of the element
virtual
void
deserializeAttributes
(
io
::
IAttributes
*
in
,
io
::
SAttributeReadWriteOptions
*
options
)
_IRR_OVERRIDE_
;
//! set all item colors at given index to color
virtual
void
setItemOverrideColor
(
u32
index
,
video
::
SColor
color
)
_IRR_OVERRIDE_
;
//! set all item colors of specified type at given index to color
virtual
void
setItemOverrideColor
(
u32
index
,
EGUI_LISTBOX_COLOR
colorType
,
video
::
SColor
color
)
_IRR_OVERRIDE_
;
//! clear all item colors at index
virtual
void
clearItemOverrideColor
(
u32
index
)
_IRR_OVERRIDE_
;
//! clear item color at index for given colortype
virtual
void
clearItemOverrideColor
(
u32
index
,
EGUI_LISTBOX_COLOR
colorType
)
_IRR_OVERRIDE_
;
//! has the item at index its color overwritten?
virtual
bool
hasItemOverrideColor
(
u32
index
,
EGUI_LISTBOX_COLOR
colorType
)
const
_IRR_OVERRIDE_
;
//! return the overwrite color at given item index.
virtual
video
::
SColor
getItemOverrideColor
(
u32
index
,
EGUI_LISTBOX_COLOR
colorType
)
const
_IRR_OVERRIDE_
;
//! return the default color which is used for the given colorType
virtual
video
::
SColor
getItemDefaultColor
(
EGUI_LISTBOX_COLOR
colorType
)
const
_IRR_OVERRIDE_
;
//! set the item at the given index
virtual
void
setItem
(
u32
index
,
const
wchar_t
*
text
,
s32
icon
)
_IRR_OVERRIDE_
;
//! Insert the item at the given index
//! Return the index on success or -1 on failure.
virtual
s32
insertItem
(
u32
index
,
const
wchar_t
*
text
,
s32
icon
)
_IRR_OVERRIDE_
;
//! Swap the items at the given indices
virtual
void
swapItems
(
u32
index1
,
u32
index2
)
_IRR_OVERRIDE_
;
//! set global itemHeight
virtual
void
setItemHeight
(
s32
height
)
_IRR_OVERRIDE_
;
//! Sets whether to draw the background
virtual
void
setDrawBackground
(
bool
draw
)
_IRR_OVERRIDE_
;
//! Access the vertical scrollbar
virtual
IGUIScrollBar
*
getVerticalScrollBar
()
const
_IRR_OVERRIDE_
;
private:
struct
ListItem
{
ListItem
()
:
icon
(
-
1
)
{
}
core
::
stringw
text
;
s32
icon
;
// A multicolor extension
struct
ListItemOverrideColor
{
ListItemOverrideColor
()
:
Use
(
false
)
{
}
bool
Use
;
video
::
SColor
Color
;
};
ListItemOverrideColor
OverrideColors
[
EGUI_LBC_COUNT
];
};
void
recalculateItemHeight
();
void
selectNew
(
s32
ypos
,
bool
onlyHover
=
false
);
void
recalculateScrollPos
();
// extracted that function to avoid copy&paste code
void
recalculateItemWidth
(
s32
icon
);
// get labels used for serialization
bool
getSerializationLabels
(
EGUI_LISTBOX_COLOR
colorType
,
core
::
stringc
&
useColorLabel
,
core
::
stringc
&
colorLabel
)
const
;
core
::
array
<
ListItem
>
Items
;
s32
Selected
;
s32
ItemHeight
;
s32
ItemHeightOverride
;
s32
TotalItemHeight
;
s32
ItemsIconWidth
;
gui
::
IGUIFont
*
Font
;
gui
::
IGUISpriteBank
*
IconBank
;
gui
::
IGUIScrollBar
*
ScrollBar
;
u32
selectTime
;
u32
LastKeyTime
;
core
::
stringw
KeyBuffer
;
bool
Selecting
;
bool
DrawBack
;
bool
MoveOverSelect
;
bool
AutoScroll
;
bool
HighlightWhenNotFocused
;
};
}
/* namespace gui */
}
/* namespace irr */
#endif
/* CANDROIDGUILISTBOX_H_ */
libcore/android/CAndroidGUISkin.cpp
View file @
5180c001
...
@@ -113,7 +113,7 @@ CAndroidGUISkin::CAndroidGUISkin(EGUI_SKIN_TYPE type,
...
@@ -113,7 +113,7 @@ CAndroidGUISkin::CAndroidGUISkin(EGUI_SKIN_TYPE type,
Colors
[
EGDC_GRAY_EDITABLE
]
=
0xff5a5a5a
;
//输入框不可用时的颜色
Colors
[
EGDC_GRAY_EDITABLE
]
=
0xff5a5a5a
;
//输入框不可用时的颜色
Colors
[
EGDC_FOCUSED_EDITABLE
]
=
0xffffffff
;
//输入状态的框色
Colors
[
EGDC_FOCUSED_EDITABLE
]
=
0xffffffff
;
//输入状态的框色
Sizes
[
EGDS_SCROLLBAR_SIZE
]
=
14
;
Sizes
[
EGDS_SCROLLBAR_SIZE
]
=
50
;
//实际控制scrollbar的大小
Sizes
[
EGDS_MENU_HEIGHT
]
=
48
;
Sizes
[
EGDS_MENU_HEIGHT
]
=
48
;
Sizes
[
EGDS_WINDOW_BUTTON_WIDTH
]
=
15
;
Sizes
[
EGDS_WINDOW_BUTTON_WIDTH
]
=
15
;
Sizes
[
EGDS_CHECK_BOX_WIDTH
]
=
18
;
Sizes
[
EGDS_CHECK_BOX_WIDTH
]
=
18
;
...
...
libcore/jni/Android.mk
View file @
5180c001
...
@@ -42,7 +42,6 @@ LOCAL_SRC_FILES := $(LOCAL_PATH)/android/android_tools.cpp \
...
@@ -42,7 +42,6 @@ LOCAL_SRC_FILES := $(LOCAL_PATH)/android/android_tools.cpp \
$(LOCAL_PATH)
/android/TouchEventTransferAndroid.cpp
\
$(LOCAL_PATH)
/android/TouchEventTransferAndroid.cpp
\
$(LOCAL_PATH)
/android/CAndroidGUIEditBox.cpp
\
$(LOCAL_PATH)
/android/CAndroidGUIEditBox.cpp
\
$(LOCAL_PATH)
/android/CAndroidGUIComboBox.cpp
\
$(LOCAL_PATH)
/android/CAndroidGUIComboBox.cpp
\
$(LOCAL_PATH)
/android/CAndroidGUIListBox.cpp
\
$(LOCAL_PATH)
/android/CAndroidGUISkin.cpp
\
$(LOCAL_PATH)
/android/CAndroidGUISkin.cpp
\
$(LOCAL_PATH)
/android/CustomShaderConstantSetCallBack.cpp
\
$(LOCAL_PATH)
/android/CustomShaderConstantSetCallBack.cpp
\
$(LOCAL_PATH)
/android/YGOGameOptions.cpp
\
$(LOCAL_PATH)
/android/YGOGameOptions.cpp
\
...
...
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