mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into v3
This commit is contained in:
commit
d69050399b
|
@ -133,6 +133,11 @@ bool LabelAtlas::initWithString(const std::string& theString, const std::string&
|
|||
//CCLabelAtlas - Atlas generation
|
||||
void LabelAtlas::updateAtlasValues()
|
||||
{
|
||||
if(_itemsPerRow == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ssize_t n = _string.length();
|
||||
|
||||
const unsigned char *s = (unsigned char*)_string.c_str();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<PropertyGroup />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot)cocos\platform\wp8;$(EngineRoot)cocos\platform\winrt;$(EngineRoot)\external\winrt-specific\angle\include;$(EngineRoot)\external\curl\include\wp8;$(EngineRoot)\external\winrt-specific;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external;$(EngineRoot)cocos\editor-support;$(EngineRoot);$(EngineRoot)external\ConvertUTF;$(GeneratedFilesDir)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot)cocos\platform\wp8;$(EngineRoot)cocos\platform\winrt;$(EngineRoot)\external\winrt-specific\angle\include;$(EngineRoot)\external\curl\include\wp8;$(EngineRoot)\external\winrt-specific;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external;$(EngineRoot)cocos\editor-support;$(EngineRoot);$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\wp8-specific\zlib\include;$(GeneratedFilesDir)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_VARIADIC_MAX=10;NOMINMAX;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<CompileAsWinRT>true</CompileAsWinRT>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
|
|
|
@ -47,18 +47,19 @@ public:
|
|||
auto iter = std::find_if(Controller::s_allController.begin(), Controller::s_allController.end(), [&](Controller* controller){
|
||||
return (deviceName == controller->_deviceName) && (deviceId == controller->_deviceId);
|
||||
});
|
||||
|
||||
return iter;
|
||||
}
|
||||
|
||||
static void onConnected(const std::string& deviceName, int deviceId)
|
||||
{
|
||||
// Check whether the controller is already connected.
|
||||
log("onConnected %s,%d", deviceName.c_str(),deviceId);
|
||||
CCLOG("onConnected %s,%d", deviceName.c_str(),deviceId);
|
||||
|
||||
auto iter = findController(deviceName, deviceId);
|
||||
if (iter != Controller::s_allController.end())
|
||||
return;
|
||||
|
||||
log("onConnected new device");
|
||||
// It's a new controller being connected.
|
||||
auto controller = new cocos2d::Controller();
|
||||
controller->_deviceId = deviceId;
|
||||
|
@ -70,11 +71,11 @@ public:
|
|||
|
||||
static void onDisconnected(const std::string& deviceName, int deviceId)
|
||||
{
|
||||
log("onDisconnected %s,%d", deviceName.c_str(),deviceId);
|
||||
CCLOG("onDisconnected %s,%d", deviceName.c_str(),deviceId);
|
||||
|
||||
auto iter = findController(deviceName, deviceId);
|
||||
if (iter == Controller::s_allController.end())
|
||||
{
|
||||
log("Could not find the controller!");
|
||||
CCLOGERROR("Could not find the controller!");
|
||||
return;
|
||||
}
|
||||
|
@ -85,11 +86,10 @@ public:
|
|||
|
||||
static void onButtonEvent(const std::string& deviceName, int deviceId, int keyCode, bool isPressed, float value, bool isAnalog)
|
||||
{
|
||||
log("onButtonEvent %s,%d", deviceName.c_str(),deviceId);
|
||||
auto iter = findController(deviceName, deviceId);
|
||||
if (iter == Controller::s_allController.end())
|
||||
{
|
||||
log("onButtonEvent new connect");
|
||||
CCLOG("onButtonEvent:connect new controller.");
|
||||
onConnected(deviceName, deviceId);
|
||||
iter = findController(deviceName, deviceId);
|
||||
}
|
||||
|
@ -102,10 +102,11 @@ public:
|
|||
auto iter = findController(deviceName, deviceId);
|
||||
if (iter == Controller::s_allController.end())
|
||||
{
|
||||
CCLOG("onAxisEvent:connect new controller.");
|
||||
onConnected(deviceName, deviceId);
|
||||
iter = findController(deviceName, deviceId);
|
||||
}
|
||||
|
||||
|
||||
(*iter)->onAxisEvent(axisCode, value, isAnalog);
|
||||
}
|
||||
|
||||
|
@ -154,6 +155,16 @@ Controller::Controller()
|
|||
init();
|
||||
}
|
||||
|
||||
void Controller::receiveExternalKeyEvent(int externalKeyCode,bool receive)
|
||||
{
|
||||
JniMethodInfo t;
|
||||
if (JniHelper::getStaticMethodInfo(t, "org/cocos2dx/lib/GameControllerHelper", "receiveExternalKeyEvent", "(IIZ)V")) {
|
||||
|
||||
t.env->CallStaticVoidMethod(t.classID, t.methodID, _deviceId, externalKeyCode, receive);
|
||||
t.env->DeleteLocalRef(t.classID);
|
||||
}
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
extern "C" {
|
||||
|
|
|
@ -311,6 +311,10 @@ bool Controller::isConnected() const
|
|||
return _impl->_gcController.isAttachedToDevice == YES;
|
||||
}
|
||||
|
||||
void Controller::receiveExternalKeyEvent(int externalKeyCode,bool receive)
|
||||
{
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
|
|
|
@ -99,6 +99,15 @@ public:
|
|||
|
||||
const KeyStatus& getKeyStatus(int keyCode);
|
||||
|
||||
/** Activate receives key event from external key. e.g. back,menu.
|
||||
* Controller receives only standard key which contained within enum Key by default.
|
||||
* @warning The API only work on the android platform for support diversified game controller.
|
||||
*
|
||||
* @param externalKeyCode external key code
|
||||
* @param receive true if external key event on this controller should be receive, false otherwise.
|
||||
*/
|
||||
void receiveExternalKeyEvent(int externalKeyCode,bool receive);
|
||||
|
||||
void setTag(int tag) { _controllerTag = tag;}
|
||||
int getTag() const { return _controllerTag;}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ NS_CC_BEGIN
|
|||
|
||||
const char* cocos2dVersion()
|
||||
{
|
||||
return "cocos2d-x 3.2alpha0";
|
||||
return "cocos2d-x 3.2beta0";
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace cocostudio
|
|||
|
||||
Text* label = static_cast<Text*>(widget);
|
||||
|
||||
std::string jsonPath = GUIReader::getInstance()->getFilePath();
|
||||
std::string binaryFilePath = GUIReader::getInstance()->getFilePath();
|
||||
|
||||
|
||||
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||
|
@ -70,11 +70,7 @@ namespace cocostudio
|
|||
label->setFontSize(valueToInt(value));
|
||||
}else if(key == P_FontName){
|
||||
std::string fontFilePath;
|
||||
if(FileUtils::getInstance()->isFileExist(value)){
|
||||
fontFilePath = jsonPath.append(value);
|
||||
}else{
|
||||
fontFilePath = value;
|
||||
}
|
||||
fontFilePath = binaryFilePath.append(value);
|
||||
label->setFontName(fontFilePath);
|
||||
}else if(key == P_AreaWidth){
|
||||
label->setTextAreaSize(Size(valueToFloat(value), label->getTextAreaSize().height));
|
||||
|
|
|
@ -114,8 +114,10 @@ namespace cocostudio
|
|||
void WidgetReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
||||
{
|
||||
|
||||
widget->ignoreContentAdaptWithSize(DICTOOL->getBooleanValue_json(options, P_IgnoreSize,false));
|
||||
|
||||
bool ignoreSizeExsit = DICTOOL->checkObjectExist_json(options, P_IgnoreSize);
|
||||
if (ignoreSizeExsit) {
|
||||
widget->ignoreContentAdaptWithSize(DICTOOL->getBooleanValue_json(options, P_IgnoreSize));
|
||||
}
|
||||
|
||||
widget->setSizeType((Widget::SizeType)DICTOOL->getIntValue_json(options, P_SizeType));
|
||||
widget->setPositionType((Widget::PositionType)DICTOOL->getIntValue_json(options, P_PositionType));
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support;$(EngineRoot)external;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support;$(EngineRoot)external;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WP8;_DEBUG;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
|
||||
|
|
|
@ -31,11 +31,9 @@ import org.cocos2dx.lib.inputmanagercompat.InputManagerCompat.InputDeviceListene
|
|||
import org.cocos2dx.lib.Cocos2dxActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.InputDevice;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
|
||||
public abstract class GameControllerActivity extends Cocos2dxActivity implements InputDeviceListener {
|
||||
// ===========================================================
|
||||
|
@ -224,30 +222,11 @@ public abstract class GameControllerActivity extends Cocos2dxActivity implements
|
|||
return handled || super.dispatchGenericMotionEvent(event);
|
||||
}
|
||||
|
||||
protected SparseArray<String> mGameController = null;
|
||||
|
||||
@Override
|
||||
public void onInputDeviceAdded(int deviceId) {
|
||||
Log.d(TAG,"onInputDeviceAdded:" + deviceId);
|
||||
|
||||
try {
|
||||
InputDevice device = InputDevice.getDevice(deviceId);
|
||||
int deviceSource = device.getSources();
|
||||
|
||||
if ( ((deviceSource & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD)
|
||||
|| ((deviceSource & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK) )
|
||||
{
|
||||
if (mGameController == null) {
|
||||
mGameController = new SparseArray<String>();
|
||||
}
|
||||
String deviceName = device.getName();
|
||||
mGameController.append(deviceId, deviceName);
|
||||
GameControllerAdapter.onConnected(deviceName, deviceId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
mControllerHelper.onInputDeviceAdded(deviceId);
|
||||
}
|
||||
/*
|
||||
* This is an unusual case. Input devices don't typically change, but they
|
||||
|
@ -274,10 +253,7 @@ public abstract class GameControllerActivity extends Cocos2dxActivity implements
|
|||
public void onInputDeviceRemoved(int deviceId) {
|
||||
Log.d(TAG,"onInputDeviceRemoved:" + deviceId);
|
||||
|
||||
if (mGameController != null && mGameController.get(deviceId) != null) {
|
||||
GameControllerAdapter.onDisconnected(mGameController.get(deviceId), deviceId);
|
||||
mGameController.delete(deviceId);
|
||||
}
|
||||
mControllerHelper.onInputDeviceRemoved(deviceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -293,8 +269,10 @@ public abstract class GameControllerActivity extends Cocos2dxActivity implements
|
|||
if (mControllerOuya != null) {
|
||||
mControllerOuya.onResume();
|
||||
}
|
||||
|
||||
mControllerHelper.gatherControllers();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
if (mControllerNibiru != null) {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.cocos2dx.lib;
|
||||
|
||||
import android.util.Log;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.util.SparseArray;
|
||||
import android.util.SparseIntArray;
|
||||
import android.view.InputDevice;
|
||||
import android.view.KeyEvent;
|
||||
|
@ -53,7 +55,6 @@ public class GameControllerHelper {
|
|||
|
||||
ControllerKeyMap.put(KeyEvent.KEYCODE_BUTTON_START, GameControllerDelegate.BUTTON_START);
|
||||
ControllerKeyMap.put(KeyEvent.KEYCODE_BUTTON_SELECT, GameControllerDelegate.BUTTON_SELECT);
|
||||
//KEYCODE_BUTTON_MODE
|
||||
}
|
||||
|
||||
private float mOldLeftThumbstickX = 0.0f;
|
||||
|
@ -76,68 +77,71 @@ public class GameControllerHelper {
|
|||
|| ((eventSource & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK) )
|
||||
{
|
||||
if (event.getAction() == MotionEvent.ACTION_MOVE) {
|
||||
int devicedId = event.getDeviceId();
|
||||
int deviceId = event.getDeviceId();
|
||||
String deviceName = event.getDevice().getName();
|
||||
if(mGameController.get(deviceId) == null){
|
||||
mGameController.append(deviceId, deviceName);
|
||||
}
|
||||
|
||||
float newAXIS_LX = event.getAxisValue(AXIS_X);
|
||||
if (Float.compare(newAXIS_LX , mOldLeftThumbstickX) != 0) {
|
||||
GameControllerAdapter.onAxisEvent(deviceName, devicedId, GameControllerDelegate.THUMBSTICK_LEFT_X, newAXIS_LX, true);
|
||||
GameControllerAdapter.onAxisEvent(deviceName, deviceId, GameControllerDelegate.THUMBSTICK_LEFT_X, newAXIS_LX, true);
|
||||
mOldLeftThumbstickX = newAXIS_LX;
|
||||
handled = true;
|
||||
}
|
||||
|
||||
float newAXIS_LY = event.getAxisValue(AXIS_Y);
|
||||
if (Float.compare(newAXIS_LY , mOldLeftThumbstickY) != 0) {
|
||||
GameControllerAdapter.onAxisEvent(deviceName, devicedId, GameControllerDelegate.THUMBSTICK_LEFT_Y, newAXIS_LY, true);
|
||||
GameControllerAdapter.onAxisEvent(deviceName, deviceId, GameControllerDelegate.THUMBSTICK_LEFT_Y, newAXIS_LY, true);
|
||||
mOldLeftThumbstickY = newAXIS_LY;
|
||||
handled = true;
|
||||
}
|
||||
|
||||
float newAXIS_RX = event.getAxisValue(AXIS_Z);
|
||||
if (Float.compare(newAXIS_RX , mOldRightThumbstickX) != 0) {
|
||||
GameControllerAdapter.onAxisEvent(deviceName, devicedId, GameControllerDelegate.THUMBSTICK_RIGHT_X, newAXIS_RX, true);
|
||||
GameControllerAdapter.onAxisEvent(deviceName, deviceId, GameControllerDelegate.THUMBSTICK_RIGHT_X, newAXIS_RX, true);
|
||||
mOldRightThumbstickX = newAXIS_RX;
|
||||
handled = true;
|
||||
}
|
||||
|
||||
float newAXIS_RY = event.getAxisValue(AXIS_RZ);
|
||||
if (Float.compare(newAXIS_RY , mOldRightThumbstickY) != 0) {
|
||||
GameControllerAdapter.onAxisEvent(deviceName, devicedId, GameControllerDelegate.THUMBSTICK_RIGHT_Y, newAXIS_RY, true);
|
||||
GameControllerAdapter.onAxisEvent(deviceName, deviceId, GameControllerDelegate.THUMBSTICK_RIGHT_Y, newAXIS_RY, true);
|
||||
mOldRightThumbstickY = newAXIS_RY;
|
||||
handled = true;
|
||||
}
|
||||
|
||||
float newAXIS_LTRIGGER = event.getAxisValue(AXIS_LTRIGGER);
|
||||
if (Float.compare(newAXIS_LTRIGGER , mOldLeftTrigger) != 0) {
|
||||
GameControllerAdapter.onAxisEvent(deviceName, devicedId, GameControllerDelegate.BUTTON_LEFT_TRIGGER, newAXIS_LTRIGGER, true);
|
||||
GameControllerAdapter.onAxisEvent(deviceName, deviceId, GameControllerDelegate.BUTTON_LEFT_TRIGGER, newAXIS_LTRIGGER, true);
|
||||
mOldLeftTrigger = newAXIS_LTRIGGER;
|
||||
handled = true;
|
||||
}
|
||||
|
||||
float newAXIS_RTRIGGER = event.getAxisValue(AXIS_RTRIGGER);
|
||||
if (Float.compare(newAXIS_RTRIGGER , mOldRightTrigger) != 0) {
|
||||
GameControllerAdapter.onAxisEvent(deviceName, devicedId, GameControllerDelegate.BUTTON_RIGHT_TRIGGER, newAXIS_RTRIGGER, true);
|
||||
GameControllerAdapter.onAxisEvent(deviceName, deviceId, GameControllerDelegate.BUTTON_RIGHT_TRIGGER, newAXIS_RTRIGGER, true);
|
||||
mOldRightTrigger = newAXIS_RTRIGGER;
|
||||
handled = true;
|
||||
}
|
||||
|
||||
float newAXIS_BRAKE = event.getAxisValue(AXIS_BRAKE);
|
||||
if (Float.compare(newAXIS_BRAKE , mOldBrake) != 0) {
|
||||
GameControllerAdapter.onAxisEvent(deviceName, devicedId, GameControllerDelegate.BUTTON_LEFT_TRIGGER, newAXIS_BRAKE, true);
|
||||
GameControllerAdapter.onAxisEvent(deviceName, deviceId, GameControllerDelegate.BUTTON_LEFT_TRIGGER, newAXIS_BRAKE, true);
|
||||
mOldBrake = newAXIS_BRAKE;
|
||||
handled = true;
|
||||
}
|
||||
|
||||
float newAXIS_THROTTLE = event.getAxisValue(AXIS_THROTTLE);
|
||||
if (Float.compare(newAXIS_THROTTLE , mOldThrottle) != 0) {
|
||||
GameControllerAdapter.onAxisEvent(deviceName, devicedId, GameControllerDelegate.BUTTON_RIGHT_TRIGGER, newAXIS_THROTTLE, true);
|
||||
GameControllerAdapter.onAxisEvent(deviceName, deviceId, GameControllerDelegate.BUTTON_RIGHT_TRIGGER, newAXIS_THROTTLE, true);
|
||||
mOldThrottle = newAXIS_THROTTLE;
|
||||
handled = true;
|
||||
}
|
||||
|
||||
float newAXIS_GAS = event.getAxisValue(AXIS_GAS);
|
||||
if (Float.compare(newAXIS_GAS , mOldGas) != 0) {
|
||||
GameControllerAdapter.onAxisEvent(deviceName, devicedId, GameControllerDelegate.BUTTON_RIGHT_TRIGGER, newAXIS_GAS, true);
|
||||
GameControllerAdapter.onAxisEvent(deviceName, deviceId, GameControllerDelegate.BUTTON_RIGHT_TRIGGER, newAXIS_GAS, true);
|
||||
mOldGas = newAXIS_GAS;
|
||||
handled = true;
|
||||
}
|
||||
|
@ -147,6 +151,8 @@ public class GameControllerHelper {
|
|||
return handled;
|
||||
}
|
||||
|
||||
private static SparseArray<ArrayList<Integer>> mControllerExtendKey = new SparseArray<ArrayList<Integer>>();
|
||||
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
boolean handled = false;
|
||||
|
||||
|
@ -154,19 +160,96 @@ public class GameControllerHelper {
|
|||
int keyCode = event.getKeyCode();
|
||||
int controllerKey = ControllerKeyMap.get(keyCode);
|
||||
|
||||
if (controllerKey != 0 && (((eventSource & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD)
|
||||
|| ((eventSource & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK) ))
|
||||
if (((eventSource & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD)
|
||||
|| ((eventSource & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK) )
|
||||
{
|
||||
int deviceId = event.getDeviceId();
|
||||
String deviceName = event.getDevice().getName();
|
||||
|
||||
if(mGameController.get(deviceId) == null){
|
||||
mGameController.append(deviceId, deviceName);
|
||||
}
|
||||
|
||||
if (controllerKey == 0) {
|
||||
if (mControllerExtendKey.get(deviceId) != null && mControllerExtendKey.get(deviceId).contains(keyCode)) {
|
||||
controllerKey = keyCode;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int action = event.getAction();
|
||||
if (action == KeyEvent.ACTION_DOWN) {
|
||||
handled = true;
|
||||
GameControllerAdapter.onButtonEvent(event.getDevice().getName(),event.getDeviceId(), controllerKey,true, 1.0f, false);
|
||||
GameControllerAdapter.onButtonEvent(deviceName, deviceId, controllerKey,true, 1.0f, false);
|
||||
}else if (action == KeyEvent.ACTION_UP) {
|
||||
handled = true;
|
||||
GameControllerAdapter.onButtonEvent(event.getDevice().getName(),event.getDeviceId(), controllerKey,false, 0.0f, false);
|
||||
GameControllerAdapter.onButtonEvent(deviceName, deviceId, controllerKey,false, 0.0f, false);
|
||||
}
|
||||
}
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
public static void receiveExternalKeyEvent(int deviceId,int externalKeyCode,boolean receive) {
|
||||
if (receive) {
|
||||
if (mControllerExtendKey.get(deviceId) == null) {
|
||||
mControllerExtendKey.put(deviceId, new ArrayList<Integer>());
|
||||
}
|
||||
mControllerExtendKey.get(deviceId).add(externalKeyCode);
|
||||
} else {
|
||||
if (mControllerExtendKey.get(deviceId) != null) {
|
||||
mControllerExtendKey.get(deviceId).remove(Integer.valueOf(externalKeyCode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SparseArray<String> mGameController = new SparseArray<String>();
|
||||
|
||||
void onInputDeviceAdded(int deviceId){
|
||||
try {
|
||||
InputDevice device = InputDevice.getDevice(deviceId);
|
||||
int deviceSource = device.getSources();
|
||||
|
||||
if ( ((deviceSource & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD)
|
||||
|| ((deviceSource & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK) )
|
||||
{
|
||||
String deviceName = device.getName();
|
||||
mGameController.append(deviceId, deviceName);
|
||||
GameControllerAdapter.onConnected(deviceName, deviceId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
void onInputDeviceChanged(int deviceId){
|
||||
gatherControllers();
|
||||
}
|
||||
|
||||
void onInputDeviceRemoved(int deviceId) {
|
||||
if (mGameController.get(deviceId) != null) {
|
||||
GameControllerAdapter.onDisconnected(mGameController.get(deviceId), deviceId);
|
||||
mGameController.delete(deviceId);
|
||||
}
|
||||
}
|
||||
|
||||
void gatherControllers(){
|
||||
int controllerCount = mGameController.size();
|
||||
for (int i = 0; i < controllerCount; i++) {
|
||||
try {
|
||||
int controllerDeveceId = mGameController.keyAt(i);
|
||||
InputDevice device = InputDevice.getDevice(controllerDeveceId);
|
||||
if (device == null) {
|
||||
GameControllerAdapter.onDisconnected(mGameController.get(controllerDeveceId), controllerDeveceId);
|
||||
mGameController.delete(controllerDeveceId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
int controllerDeveceId = mGameController.keyAt(i);
|
||||
GameControllerAdapter.onDisconnected(mGameController.get(controllerDeveceId), controllerDeveceId);
|
||||
mGameController.delete(controllerDeveceId);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ public class GameControllerNibiru implements OnControllerSeviceListener, OnKeyLi
|
|||
OnSimpleStickListener, OnAccListener, OnGyroListener, OnStateListener, GameControllerDelegate {
|
||||
|
||||
private static final String TAG = "NibiruTag";
|
||||
private static final String mVendorName = "Nibiru";
|
||||
|
||||
private Context mContext;
|
||||
private SparseIntArray mKeyMap;
|
||||
|
@ -132,7 +131,14 @@ OnSimpleStickListener, OnAccListener, OnGyroListener, OnStateListener, GameContr
|
|||
}
|
||||
|
||||
if (mControllerEventListener != null) {
|
||||
mControllerEventListener.onButtonEvent(mVendorName, playerOrder, mKeyMap.get(keyCode), true, 1.0f, false);
|
||||
try {
|
||||
ControllerDevice controllerDevice = mControllerService.getDeviceByPlayerOrder(playerOrder);
|
||||
|
||||
mControllerEventListener.onButtonEvent(controllerDevice.getDeviceName(), controllerDevice.getDeviceId(),
|
||||
mKeyMap.get(keyCode), true, 1.0f, false);
|
||||
} catch (ControllerServiceException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,28 +150,52 @@ OnSimpleStickListener, OnAccListener, OnGyroListener, OnStateListener, GameContr
|
|||
}
|
||||
|
||||
if (mControllerEventListener != null) {
|
||||
mControllerEventListener.onButtonEvent(mVendorName, playerOrder,
|
||||
mKeyMap.get(keyCode), false, 0.0f, false);
|
||||
try {
|
||||
ControllerDevice controllerDevice = mControllerService.getDeviceByPlayerOrder(playerOrder);
|
||||
|
||||
mControllerEventListener.onButtonEvent(controllerDevice.getDeviceName(), controllerDevice.getDeviceId(),
|
||||
mKeyMap.get(keyCode), false, 0.0f, false);
|
||||
} catch (ControllerServiceException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLeftStickChanged(int playerOrder, float x, float y) {
|
||||
if (mControllerEventListener != null) {
|
||||
mControllerEventListener.onAxisEvent(mVendorName, playerOrder,
|
||||
GameControllerDelegate.THUMBSTICK_LEFT_X, x, true);
|
||||
mControllerEventListener.onAxisEvent(mVendorName, playerOrder,
|
||||
GameControllerDelegate.THUMBSTICK_LEFT_Y, y, true);
|
||||
try {
|
||||
ControllerDevice controllerDevice = mControllerService.getDeviceByPlayerOrder(playerOrder);
|
||||
|
||||
String deviceName = controllerDevice.getDeviceName();
|
||||
int deviceId = controllerDevice.getDeviceId();
|
||||
|
||||
mControllerEventListener.onAxisEvent(deviceName, deviceId,
|
||||
GameControllerDelegate.THUMBSTICK_LEFT_X, x, true);
|
||||
mControllerEventListener.onAxisEvent(deviceName, deviceId,
|
||||
GameControllerDelegate.THUMBSTICK_LEFT_Y, y, true);
|
||||
} catch (ControllerServiceException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRightStickChanged(int playerOrder, float x, float y) {
|
||||
if (mControllerEventListener != null) {
|
||||
mControllerEventListener.onAxisEvent(mVendorName, playerOrder,
|
||||
GameControllerDelegate.THUMBSTICK_RIGHT_X, x, true);
|
||||
mControllerEventListener.onAxisEvent(mVendorName, playerOrder,
|
||||
GameControllerDelegate.THUMBSTICK_RIGHT_Y, y, true);
|
||||
try {
|
||||
ControllerDevice controllerDevice = mControllerService.getDeviceByPlayerOrder(playerOrder);
|
||||
|
||||
String deviceName = controllerDevice.getDeviceName();
|
||||
int deviceId = controllerDevice.getDeviceId();
|
||||
|
||||
mControllerEventListener.onAxisEvent(deviceName, deviceId,
|
||||
GameControllerDelegate.THUMBSTICK_RIGHT_X, x, true);
|
||||
mControllerEventListener.onAxisEvent(deviceName, deviceId,
|
||||
GameControllerDelegate.THUMBSTICK_RIGHT_Y, y, true);
|
||||
} catch (ControllerServiceException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,11 +204,11 @@ OnSimpleStickListener, OnAccListener, OnGyroListener, OnStateListener, GameContr
|
|||
if (mControllerEventListener != null) {
|
||||
if (state == ControllerDevice.STATE_CONN)
|
||||
{
|
||||
mControllerEventListener.onConnected(mVendorName, playerOrder);
|
||||
mControllerEventListener.onConnected(device.getDeviceName(), device.getDeviceId());
|
||||
}
|
||||
else if (state == ControllerDevice.STATE_DISCONN)
|
||||
{
|
||||
mControllerEventListener.onDisconnected(mVendorName, playerOrder);
|
||||
mControllerEventListener.onDisconnected(device.getDeviceName(), device.getDeviceId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,6 @@ import android.view.KeyEvent;
|
|||
import android.view.MotionEvent;
|
||||
|
||||
public class GameControllerOuya implements GameControllerDelegate{
|
||||
|
||||
public static final String sVendorName = "Ouya";
|
||||
|
||||
private SparseIntArray mKeyMap;
|
||||
|
||||
|
@ -61,27 +59,28 @@ public class GameControllerOuya implements GameControllerDelegate{
|
|||
|
||||
if (handled && mControllerEventListener != null)
|
||||
{
|
||||
OuyaController c = OuyaController.getControllerByDeviceId(event.getDeviceId());
|
||||
int controllerID = OuyaController.getPlayerNumByDeviceId(event.getDeviceId());
|
||||
int deviceId = event.getDeviceId();
|
||||
String deviceName = event.getDevice().getName();
|
||||
OuyaController c = OuyaController.getControllerByDeviceId(deviceId);
|
||||
|
||||
float newLeftTrigger = c.getAxisValue(OuyaController.AXIS_L2);
|
||||
if (Float.compare(newLeftTrigger, mOldLeftTrigger) != 0) {
|
||||
mControllerEventListener.onAxisEvent(sVendorName, controllerID, GameControllerDelegate.BUTTON_LEFT_TRIGGER, newLeftTrigger, true);
|
||||
mControllerEventListener.onAxisEvent(deviceName, deviceId, GameControllerDelegate.BUTTON_LEFT_TRIGGER, newLeftTrigger, true);
|
||||
mOldLeftTrigger = newLeftTrigger;
|
||||
}
|
||||
|
||||
float newRightTrigger = c.getAxisValue(OuyaController.AXIS_R2);
|
||||
if (Float.compare(newRightTrigger, mOldRightTrigger) != 0) {
|
||||
mControllerEventListener.onAxisEvent(sVendorName, controllerID, GameControllerDelegate.BUTTON_RIGHT_TRIGGER, newRightTrigger, true);
|
||||
mControllerEventListener.onAxisEvent(deviceName, deviceId, GameControllerDelegate.BUTTON_RIGHT_TRIGGER, newRightTrigger, true);
|
||||
mOldRightTrigger = newRightTrigger;
|
||||
}
|
||||
|
||||
float newLeftThumbstickX = c.getAxisValue(OuyaController.AXIS_LS_X);
|
||||
if (Float.compare(newLeftThumbstickX, mOldLeftThumbstickX) != 0) {
|
||||
if (Float.compare(newLeftThumbstickX, 0.0f) == 0) {
|
||||
mControllerEventListener.onAxisEvent(sVendorName, controllerID, GameControllerDelegate.THUMBSTICK_LEFT_X, 0.0f, true);
|
||||
mControllerEventListener.onAxisEvent(deviceName, deviceId, GameControllerDelegate.THUMBSTICK_LEFT_X, 0.0f, true);
|
||||
}else {
|
||||
mControllerEventListener.onAxisEvent(sVendorName, controllerID, GameControllerDelegate.THUMBSTICK_LEFT_X, newLeftThumbstickX, true);
|
||||
mControllerEventListener.onAxisEvent(deviceName, deviceId, GameControllerDelegate.THUMBSTICK_LEFT_X, newLeftThumbstickX, true);
|
||||
}
|
||||
mOldLeftThumbstickX = newLeftThumbstickX;
|
||||
}
|
||||
|
@ -89,9 +88,9 @@ public class GameControllerOuya implements GameControllerDelegate{
|
|||
float newLeftThumbstickY = c.getAxisValue(OuyaController.AXIS_LS_Y);
|
||||
if (Float.compare(newLeftThumbstickY, mOldLeftThumbstickY) != 0) {
|
||||
if (Float.compare(newLeftThumbstickY, 0.0f) == 0) {
|
||||
mControllerEventListener.onAxisEvent(sVendorName, controllerID, GameControllerDelegate.THUMBSTICK_LEFT_Y, 0.0f, true);
|
||||
mControllerEventListener.onAxisEvent(deviceName, deviceId, GameControllerDelegate.THUMBSTICK_LEFT_Y, 0.0f, true);
|
||||
}else {
|
||||
mControllerEventListener.onAxisEvent(sVendorName, controllerID, GameControllerDelegate.THUMBSTICK_LEFT_Y, newLeftThumbstickY, true);
|
||||
mControllerEventListener.onAxisEvent(deviceName, deviceId, GameControllerDelegate.THUMBSTICK_LEFT_Y, newLeftThumbstickY, true);
|
||||
}
|
||||
mOldLeftThumbstickY = newLeftThumbstickY;
|
||||
}
|
||||
|
@ -99,9 +98,9 @@ public class GameControllerOuya implements GameControllerDelegate{
|
|||
float newRightThumbstickX = c.getAxisValue(OuyaController.AXIS_RS_X);
|
||||
if (Float.compare(newRightThumbstickX, mOldRightThumbstickX) != 0) {
|
||||
if (Float.compare(newRightThumbstickX, 0.0f) == 0) {
|
||||
mControllerEventListener.onAxisEvent(sVendorName, controllerID, GameControllerDelegate.THUMBSTICK_RIGHT_X, 0.0f, true);
|
||||
mControllerEventListener.onAxisEvent(deviceName, deviceId, GameControllerDelegate.THUMBSTICK_RIGHT_X, 0.0f, true);
|
||||
}else {
|
||||
mControllerEventListener.onAxisEvent(sVendorName, controllerID, GameControllerDelegate.THUMBSTICK_RIGHT_X, newRightThumbstickX, true);
|
||||
mControllerEventListener.onAxisEvent(deviceName, deviceId, GameControllerDelegate.THUMBSTICK_RIGHT_X, newRightThumbstickX, true);
|
||||
}
|
||||
mOldRightThumbstickX = newRightThumbstickX;
|
||||
}
|
||||
|
@ -109,9 +108,9 @@ public class GameControllerOuya implements GameControllerDelegate{
|
|||
float newRightThumbstickY = c.getAxisValue(OuyaController.AXIS_RS_Y);
|
||||
if (Float.compare(newRightThumbstickY, mOldRightThumbstickY) != 0) {
|
||||
if (Float.compare(newRightThumbstickY, 0.0f) == 0) {
|
||||
mControllerEventListener.onAxisEvent(sVendorName, controllerID, GameControllerDelegate.THUMBSTICK_RIGHT_Y, 0.0f, true);
|
||||
mControllerEventListener.onAxisEvent(deviceName, deviceId, GameControllerDelegate.THUMBSTICK_RIGHT_Y, 0.0f, true);
|
||||
}else {
|
||||
mControllerEventListener.onAxisEvent(sVendorName, controllerID, GameControllerDelegate.THUMBSTICK_RIGHT_Y, newRightThumbstickY, true);
|
||||
mControllerEventListener.onAxisEvent(deviceName, deviceId, GameControllerDelegate.THUMBSTICK_RIGHT_Y, newRightThumbstickY, true);
|
||||
}
|
||||
mOldRightThumbstickY = newRightThumbstickY;
|
||||
}
|
||||
|
@ -122,9 +121,14 @@ public class GameControllerOuya implements GameControllerDelegate{
|
|||
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
boolean handled = false;
|
||||
|
||||
int action = event.getAction();
|
||||
int keyCode = event.getKeyCode();
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_BUTTON_L2 || keyCode == KeyEvent.KEYCODE_BUTTON_R2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (action == KeyEvent.ACTION_DOWN) {
|
||||
handled = OuyaController.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
@ -139,11 +143,10 @@ public class GameControllerOuya implements GameControllerDelegate{
|
|||
isAnalog = true;
|
||||
}
|
||||
|
||||
int controllerID = OuyaController.getPlayerNumByDeviceId(event.getDeviceId());
|
||||
if (action == KeyEvent.ACTION_DOWN) {
|
||||
mControllerEventListener.onButtonEvent(sVendorName, controllerID, mKeyMap.get(keyCode), true, 1.0f, isAnalog);
|
||||
mControllerEventListener.onButtonEvent(event.getDevice().getName(), event.getDeviceId(), mKeyMap.get(keyCode), true, 1.0f, isAnalog);
|
||||
}else {
|
||||
mControllerEventListener.onButtonEvent(sVendorName, controllerID, mKeyMap.get(keyCode), false, 0.0f, isAnalog);
|
||||
mControllerEventListener.onButtonEvent(event.getDevice().getName(), event.getDeviceId(), mKeyMap.get(keyCode), false, 0.0f, isAnalog);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -711,7 +711,7 @@ std::string Texture2D::getDescription() const
|
|||
// implementation Texture2D (Image)
|
||||
bool Texture2D::initWithImage(Image *image)
|
||||
{
|
||||
return initWithImage(image, image->getRenderFormat());
|
||||
return initWithImage(image, PixelFormat::NONE);
|
||||
}
|
||||
|
||||
bool Texture2D::initWithImage(Image *image, PixelFormat format)
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
* Download: http://cdn.cocos2d-x.org/cocos2d-x-3.2rc0.zip
|
||||
* Full Changelog: https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.2rc0/CHANGELOG
|
||||
* API Reference: http://www.cocos2d-x.org/reference/native-cpp/V3.2beta0/index.html
|
||||
* API Reference: http://www.cocos2d-x.org/reference/native-cpp/V3.2rc0/index.html
|
||||
* v3.0 Release Notes can be found here: [v3.0 Release Notes](https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.0/docs/RELEASE_NOTES.md)
|
||||
|
||||
# Requirements
|
||||
|
@ -116,7 +116,7 @@ Please refer to this document: [ReadMe](../README.md)
|
|||
|
||||
# Highlights of v3.2rc0
|
||||
|
||||
* `fbx-conv` support generating binary format, and `Sprite3D` support it, and about
|
||||
* `fbx-conv` support generating binary format, and `Sprite3D` support it
|
||||
* about 20% performance improved in `Sprite3D`
|
||||
* game controller support
|
||||
* fast tilemap support, it is faster for static tilemap
|
||||
|
|
|
@ -183,7 +183,7 @@ g_guisTests[] =
|
|||
UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
|
||||
sceneManager->setCurrentUISceneId(kUIPageViewTest);
|
||||
sceneManager->setMinUISceneId(kUIPageViewTest);
|
||||
sceneManager->setMaxUISceneId(kUIPageViewTest);
|
||||
sceneManager->setMaxUISceneId(kUIPageViewButtonTest);
|
||||
Scene* scene = sceneManager->currentUIScene();
|
||||
Director::getInstance()->replaceScene(scene);
|
||||
}
|
||||
|
|
|
@ -16,46 +16,70 @@ UIButtonTest_Editor::~UIButtonTest_Editor()
|
|||
|
||||
}
|
||||
|
||||
void UIButtonTest_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIButton_Editor/UIButton_Editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UIButton_Editor/UIButton_Editor_1.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UIButtonTest_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = Director::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
ui::Text* back_label = static_cast<ui::Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<ui::Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* button = static_cast<Button*>(Helper::seekWidgetByName(root, "Button_123"));
|
||||
button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Editor::touchEvent, this));
|
||||
|
||||
Button* title_button = static_cast<Button*>(Helper::seekWidgetByName(root, "Button_126"));
|
||||
title_button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Editor::touchEvent, this));
|
||||
|
||||
Button* scale9_button = static_cast<Button*>(Helper::seekWidgetByName(root, "Button_129"));
|
||||
scale9_button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Editor::touchEvent,this));
|
||||
|
||||
}
|
||||
|
||||
bool UIButtonTest_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// auto _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIButton_Editor/UIButton_Editor_1.json"));
|
||||
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UIButton_Editor/UIButton_Editor_1.csb"));
|
||||
|
||||
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIButton_Editor/UIButton_Editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
this->configureGUIScene();
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* button = static_cast<Button*>(Helper::seekWidgetByName(root, "Button_123"));
|
||||
button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Editor::touchEvent, this));
|
||||
|
||||
Button* title_button = static_cast<Button*>(Helper::seekWidgetByName(root, "Button_126"));
|
||||
title_button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Editor::touchEvent, this));
|
||||
|
||||
Button* scale9_button = static_cast<Button*>(Helper::seekWidgetByName(root, "Button_129"));
|
||||
scale9_button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Editor::touchEvent, this));
|
||||
|
||||
_displayValueLabel = Text::create();
|
||||
_displayValueLabel->setFontName("fonts/Marker Felt.ttf");
|
||||
_displayValueLabel = ui::Text::create();
|
||||
_displayValueLabel->setFontName("Marker Felt");
|
||||
_displayValueLabel->setFontSize(30);
|
||||
_displayValueLabel->setString("No event");
|
||||
_displayValueLabel->setPosition(Vec2(_layout->getContentSize().width / 2,
|
||||
_layout->getContentSize().height - _displayValueLabel->getContentSize().height * 1.75f));
|
||||
_touchGroup->addChild(_displayValueLabel);
|
||||
_layout->getContentSize().height - _displayValueLabel->getContentSize().height * 1.75f));
|
||||
|
||||
_touchGroup->addChild(_displayValueLabel,20);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,9 @@ public:
|
|||
|
||||
bool init();
|
||||
void touchEvent(Ref* pSender, Widget::TouchEventType type);
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UIButtonTest_Editor);
|
||||
Text* _displayValueLabel;
|
||||
|
|
|
@ -16,27 +16,54 @@ UICheckBoxTest_Editor::~UICheckBoxTest_Editor()
|
|||
|
||||
}
|
||||
|
||||
void UICheckBoxTest_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UICheckBox_Editor/ui_checkbox_editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UICheckBox_Editor/ui_checkbox_editor_1.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UICheckBoxTest_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
CheckBox* checkbox = static_cast<CheckBox*>(Helper::seekWidgetByName(root, "CheckBox_540"));
|
||||
checkbox->addEventListener(CC_CALLBACK_2(UICheckBoxTest_Editor::selectedStateEvent, this));
|
||||
|
||||
}
|
||||
|
||||
bool UICheckBoxTest_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UICheckBox_Editor/ui_checkbox_editor_1.csb"));
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UICheckBox_Editor/ui_checkbox_editor_2.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UICheckBox_Editor/ui_checkbox_editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
CheckBox* checkbox = static_cast<CheckBox*>(Helper::seekWidgetByName(root, "CheckBox_540"));
|
||||
checkbox->addEventListener(CC_CALLBACK_2(UICheckBoxTest_Editor::selectedStateEvent, this));
|
||||
|
||||
this->configureGUIScene();
|
||||
|
||||
_displayValueLabel = Text::create();
|
||||
_displayValueLabel->setFontName("fonts/Marker Felt.ttf");
|
||||
|
@ -44,7 +71,7 @@ bool UICheckBoxTest_Editor::init()
|
|||
_displayValueLabel->setString("No event");
|
||||
_displayValueLabel->setPosition(Vec2(_layout->getContentSize().width / 2,
|
||||
_layout->getContentSize().height - _displayValueLabel->getContentSize().height * 1.75f));
|
||||
_touchGroup->addChild(_displayValueLabel);
|
||||
_touchGroup->addChild(_displayValueLabel,20);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,8 @@ public:
|
|||
~UICheckBoxTest_Editor();
|
||||
bool init();
|
||||
void selectedStateEvent(Ref* pSender, CheckBox::EventType type);
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UICheckBoxTest_Editor)
|
||||
Text* _displayValueLabel;
|
||||
|
|
|
@ -4,26 +4,53 @@
|
|||
|
||||
|
||||
// UIImageViewTest_Editor
|
||||
void UIImageViewTest_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIImageView_Editor/ui_ImageView_editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UIImageView_Editor/ui_ImageView_editor_1.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UIImageViewTest_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
}
|
||||
|
||||
bool UIImageViewTest_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIImageView_Editor/ui_ImageView_editor_1.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UIImageView_Editor/ui_ImageView_editor_1.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIImageView_Editor/ui_ImageView_editor_1.json"));
|
||||
|
||||
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
this->configureGUIScene();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,9 @@ class UIImageViewTest_Editor : public UIScene_Editor
|
|||
{
|
||||
public:
|
||||
bool init();
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UIImageViewTest_Editor)
|
||||
};
|
||||
|
|
|
@ -13,44 +13,72 @@ UILayoutTest_Editor::UILayoutTest_Editor()
|
|||
UILayoutTest_Editor::~UILayoutTest_Editor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UILayoutTest_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Editor/ui_layout_editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Editor/ui_layout_editor_1.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UILayoutTest_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool UILayoutTest_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Editor/ui_layout_editor_1.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Editor/ui_layout_editor_1.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Editor/ui_layout_editor_1.json"));
|
||||
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
this->configureGUIScene();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -71,43 +99,68 @@ UILayoutTest_Color_Editor::~UILayoutTest_Color_Editor()
|
|||
|
||||
}
|
||||
|
||||
void UILayoutTest_Color_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Color_Editor/ui_layout_color_editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Color_Editor/ui_layout_color_editor_1.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UILayoutTest_Color_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
}
|
||||
|
||||
bool UILayoutTest_Color_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Color_Editor/ui_layout_color_editor_1.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Color_Editor/ui_layout_color_editor_1.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Color_Editor/ui_layout_color_editor_1.json"));
|
||||
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
this->configureGUIScene();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -127,43 +180,69 @@ UILayoutTest_Gradient_Editor::~UILayoutTest_Gradient_Editor()
|
|||
|
||||
}
|
||||
|
||||
void UILayoutTest_Gradient_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Gradient_Color_Editor/ui_layout_gradient_color_editor_1_0.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Gradient_Color_Editor/ui_layout_gradient_color_editor_1_0.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UILayoutTest_Gradient_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
}
|
||||
|
||||
bool UILayoutTest_Gradient_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Gradient_Color_Editor/ui_layout_gradient_color_editor_1_0.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Gradient_Color_Editor/ui_layout_gradient_color_editor_1_0.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Gradient_Color_Editor/ui_layout_gradient_color_editor_1_0.json"));
|
||||
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
this->configureGUIScene();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -183,43 +262,70 @@ UILayoutTest_BackGroundImage_Editor::~UILayoutTest_BackGroundImage_Editor()
|
|||
|
||||
}
|
||||
|
||||
void UILayoutTest_BackGroundImage_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_BackgroundImage_Editor/ui_layout_backgroundimage_editor_1_0_0.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_BackgroundImage_Editor/ui_layout_backgroundimage_editor_1_0_0.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UILayoutTest_BackGroundImage_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
}
|
||||
|
||||
bool UILayoutTest_BackGroundImage_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_BackgroundImage_Editor/ui_layout_backgroundimage_editor_1_0_0.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_BackgroundImage_Editor/ui_layout_backgroundimage_editor_1_0_0.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_BackgroundImage_Editor/ui_layout_backgroundimage_editor_1_0_0.json"));
|
||||
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
|
||||
this->configureGUIScene();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -239,43 +345,70 @@ UILayoutTest_BackGroundImage_Scale9_Editor::~UILayoutTest_BackGroundImage_Scale9
|
|||
|
||||
}
|
||||
|
||||
void UILayoutTest_BackGroundImage_Scale9_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Scale9_BackgroundImage_Editor/ui_layout_scale9_backgroundimage_editor.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Scale9_BackgroundImage_Editor/ui_layout_scale9_backgroundimage_editor.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UILayoutTest_BackGroundImage_Scale9_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
}
|
||||
|
||||
bool UILayoutTest_BackGroundImage_Scale9_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Scale9_BackgroundImage_Editor/ui_layout_scale9_backgroundimage_editor.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Scale9_BackgroundImage_Editor/ui_layout_scale9_backgroundimage_editor.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Scale9_BackgroundImage_Editor/ui_layout_scale9_backgroundimage_editor.json"));
|
||||
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
|
||||
this->configureGUIScene();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -295,43 +428,70 @@ UILayoutTest_Layout_Linear_Vertical_Editor::~UILayoutTest_Layout_Linear_Vertical
|
|||
|
||||
}
|
||||
|
||||
void UILayoutTest_Layout_Linear_Vertical_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Linear_Vertical_Layout_Editor/ui_layout_linear_vertical_layout_editor.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Linear_Vertical_Layout_Editor/ui_layout_linear_vertical_layout_editor.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UILayoutTest_Layout_Linear_Vertical_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
}
|
||||
|
||||
bool UILayoutTest_Layout_Linear_Vertical_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Linear_Vertical_Layout_Editor/ui_layout_linear_vertical_layout_editor.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Linear_Vertical_Layout_Editor/ui_layout_linear_vertical_layout_editor.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Linear_Vertical_Layout_Editor/ui_layout_linear_vertical_layout_editor.json"));
|
||||
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
this->configureGUIScene();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -351,43 +511,69 @@ UILayoutTest_Layout_Linear_Horizontal_Editor::~UILayoutTest_Layout_Linear_Horizo
|
|||
|
||||
}
|
||||
|
||||
void UILayoutTest_Layout_Linear_Horizontal_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Linear_Horizontal_Layout_Editor/ui_layout_linear_horizontal_layout_editor.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Linear_Horizontal_Layout_Editor/ui_layout_linear_horizontal_layout_editor.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UILayoutTest_Layout_Linear_Horizontal_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
}
|
||||
|
||||
bool UILayoutTest_Layout_Linear_Horizontal_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Linear_Horizontal_Layout_Editor/ui_layout_linear_horizontal_layout_editor.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Linear_Horizontal_Layout_Editor/ui_layout_linear_horizontal_layout_editor.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Linear_Horizontal_Layout_Editor/ui_layout_linear_horizontal_layout_editor.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
|
||||
this->configureGUIScene();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -408,42 +594,68 @@ UILayoutTest_Layout_Relative_Align_Parent_Editor::~UILayoutTest_Layout_Relative_
|
|||
|
||||
}
|
||||
|
||||
void UILayoutTest_Layout_Relative_Align_Parent_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Relative_Align_Parent_Editor/ui_layout_relative_align_parent_editor.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Relative_Align_Parent_Editor/ui_layout_relative_align_parent_editor.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UILayoutTest_Layout_Relative_Align_Parent_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
}
|
||||
|
||||
bool UILayoutTest_Layout_Relative_Align_Parent_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Relative_Align_Parent_Editor/ui_layout_relative_align_parent_editor.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Relative_Align_Parent_Editor/ui_layout_relative_align_parent_editor.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Relative_Align_Parent_Editor/ui_layout_relative_align_parent_editor.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
this->configureGUIScene();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -464,43 +676,68 @@ UILayoutTest_Layout_Relative_Location_Editor::~UILayoutTest_Layout_Relative_Loca
|
|||
|
||||
}
|
||||
|
||||
void UILayoutTest_Layout_Relative_Location_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Relative_Align_Location_Editor/ui_layout_relative_align_location_editor.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Relative_Align_Location_Editor/ui_layout_relative_align_location_editor.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UILayoutTest_Layout_Relative_Location_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
}
|
||||
|
||||
bool UILayoutTest_Layout_Relative_Location_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Relative_Align_Location_Editor/ui_layout_relative_align_location_editor.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Relative_Align_Location_Editor/ui_layout_relative_align_location_editor.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILayout_Editor/UILayout_Relative_Align_Location_Editor/ui_layout_relative_align_location_editor.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
this->configureGUIScene();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,8 @@ public:
|
|||
UILayoutTest_Editor();
|
||||
~UILayoutTest_Editor();
|
||||
bool init();
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UILayoutTest_Editor)
|
||||
};
|
||||
|
@ -45,7 +46,8 @@ public:
|
|||
UILayoutTest_Color_Editor();
|
||||
~UILayoutTest_Color_Editor();
|
||||
bool init();
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UILayoutTest_Color_Editor)
|
||||
};
|
||||
|
@ -57,7 +59,8 @@ public:
|
|||
UILayoutTest_Gradient_Editor();
|
||||
~UILayoutTest_Gradient_Editor();
|
||||
bool init();
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UILayoutTest_Gradient_Editor)
|
||||
};
|
||||
|
@ -69,7 +72,8 @@ public:
|
|||
UILayoutTest_BackGroundImage_Editor();
|
||||
~UILayoutTest_BackGroundImage_Editor();
|
||||
bool init();
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UILayoutTest_BackGroundImage_Editor)
|
||||
};
|
||||
|
@ -81,7 +85,8 @@ public:
|
|||
UILayoutTest_BackGroundImage_Scale9_Editor();
|
||||
~UILayoutTest_BackGroundImage_Scale9_Editor();
|
||||
bool init();
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UILayoutTest_BackGroundImage_Scale9_Editor)
|
||||
};
|
||||
|
@ -92,6 +97,8 @@ class UILayoutTest_Layout_Linear_Vertical_Editor : public UIScene_Editor
|
|||
public:
|
||||
UILayoutTest_Layout_Linear_Vertical_Editor();
|
||||
~UILayoutTest_Layout_Linear_Vertical_Editor();
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
bool init();
|
||||
|
||||
protected:
|
||||
|
@ -105,7 +112,8 @@ public:
|
|||
UILayoutTest_Layout_Linear_Horizontal_Editor();
|
||||
~UILayoutTest_Layout_Linear_Horizontal_Editor();
|
||||
bool init();
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UILayoutTest_Layout_Linear_Horizontal_Editor)
|
||||
};
|
||||
|
@ -117,7 +125,8 @@ public:
|
|||
UILayoutTest_Layout_Relative_Align_Parent_Editor();
|
||||
~UILayoutTest_Layout_Relative_Align_Parent_Editor();
|
||||
bool init();
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UILayoutTest_Layout_Relative_Align_Parent_Editor)
|
||||
};
|
||||
|
@ -129,7 +138,8 @@ public:
|
|||
UILayoutTest_Layout_Relative_Location_Editor();
|
||||
~UILayoutTest_Layout_Relative_Location_Editor();
|
||||
bool init();
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UILayoutTest_Layout_Relative_Location_Editor)
|
||||
};
|
||||
|
|
|
@ -15,47 +15,73 @@ UIListViewTest_Vertical_Editor::~UIListViewTest_Vertical_Editor()
|
|||
|
||||
}
|
||||
|
||||
void UIListViewTest_Vertical_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIListView_Editor/UIListView_Vertical_Editor/ui_listview_editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UIListView_Editor/UIListView_Vertical_Editor/ui_listview_editor_1.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UIListViewTest_Vertical_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene,this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
// ListView* listView = static_cast<ListView*>(UIHelper::seekWidgetByName(root, "ListView_1214"));
|
||||
// CCLOG("listView isBounceEnabled = %d", listView->isBounceEnabled());
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback,this));
|
||||
|
||||
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback,this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
}
|
||||
|
||||
bool UIListViewTest_Vertical_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIListView_Editor/UIListView_Vertical_Editor/ui_listview_editor_1.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UIListView_Editor/UIListView_Vertical_Editor/ui_listview_editor_1.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIListView_Editor/UIListView_Vertical_Editor/ui_listview_editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene,this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
// ListView* listView = static_cast<ListView*>(UIHelper::seekWidgetByName(root, "ListView_1214"));
|
||||
// CCLOG("listView isBounceEnabled = %d", listView->isBounceEnabled());
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback,this));
|
||||
|
||||
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback,this));
|
||||
_layout->addChild(right_button);
|
||||
this->configureGUIScene();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -72,6 +98,61 @@ UIListViewTest_Horizontal_Editor::UIListViewTest_Horizontal_Editor()
|
|||
|
||||
}
|
||||
|
||||
void UIListViewTest_Horizontal_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIListView_Editor/UIListView_Horizontal_Editor/ui_listview_horizontal_editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UIListView_Editor/UIListView_Horizontal_Editor/ui_listview_horizontal_editor_1.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UIListViewTest_Horizontal_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene,this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback,this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
}
|
||||
|
||||
UIListViewTest_Horizontal_Editor::~UIListViewTest_Horizontal_Editor()
|
||||
{
|
||||
|
||||
|
@ -81,38 +162,10 @@ bool UIListViewTest_Horizontal_Editor::init()
|
|||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIListView_Editor/UIListView_Horizontal_Editor/ui_listview_horizontal_editor_1.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UIListView_Editor/UIListView_Horizontal_Editor/ui_listview_horizontal_editor_1.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIListView_Editor/UIListView_Horizontal_Editor/ui_listview_horizontal_editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene,this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback,this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
this->configureGUIScene();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,8 @@ public:
|
|||
~UIListViewTest_Vertical_Editor();
|
||||
bool init();
|
||||
void selectedItemEvent(Ref* pSender, ListView::EventType type);
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UIListViewTest_Vertical_Editor)
|
||||
Text* _displayValueLabel;
|
||||
|
@ -50,7 +51,8 @@ public:
|
|||
~UIListViewTest_Horizontal_Editor();
|
||||
bool init();
|
||||
void selectedItemEvent(Ref* pSender, ListView::EventType type);
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UIListViewTest_Horizontal_Editor)
|
||||
Text* _displayValueLabel;
|
||||
|
|
|
@ -16,34 +16,60 @@ UILoadingBarTest_Editor::~UILoadingBarTest_Editor()
|
|||
|
||||
}
|
||||
|
||||
void UILoadingBarTest_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILoadingBar_Editor/ui_loadingbar_editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILoadingBar_Editor/ui_loadingbar_editor_1.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UILoadingBarTest_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
// back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
LoadingBar* loadingBar_left_to_right = dynamic_cast<LoadingBar*>(Helper::seekWidgetByName(root, "LoadingBar_856"));
|
||||
loadingBar_left_to_right->setPercent(0);
|
||||
|
||||
LoadingBar* loadingBar_right_to_left = dynamic_cast<LoadingBar*>(Helper::seekWidgetByName(root, "LoadingBar_857"));
|
||||
loadingBar_right_to_left->setPercent(0);
|
||||
|
||||
}
|
||||
|
||||
bool UILoadingBarTest_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
scheduleUpdate();
|
||||
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILoadingBar_Editor/ui_loadingbar_editor_1.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILoadingBar_Editor/ui_loadingbar_editor_1.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILoadingBar_Editor/ui_loadingbar_editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
// back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
LoadingBar* loadingBar_left_to_right = dynamic_cast<LoadingBar*>(Helper::seekWidgetByName(root, "LoadingBar_856"));
|
||||
loadingBar_left_to_right->setPercent(0);
|
||||
|
||||
LoadingBar* loadingBar_right_to_left = dynamic_cast<LoadingBar*>(Helper::seekWidgetByName(root, "LoadingBar_857"));
|
||||
loadingBar_right_to_left->setPercent(0);
|
||||
|
||||
|
||||
this->configureGUIScene();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,8 @@ public:
|
|||
bool init();
|
||||
void update(float delta);
|
||||
void toCocosGUITestScene(Ref* sender, Widget::TouchEventType event);
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UILoadingBarTest_Editor)
|
||||
int _count;
|
||||
|
|
|
@ -97,3 +97,114 @@ void UIPageViewTest::pageViewEvent(Ref *pSender, PageView::EventType type)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// UIPageViewButtonTest
|
||||
UIPageViewButtonTest::UIPageViewButtonTest()
|
||||
: _displayValueLabel(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
UIPageViewButtonTest::~UIPageViewButtonTest()
|
||||
{
|
||||
}
|
||||
|
||||
bool UIPageViewButtonTest::init()
|
||||
{
|
||||
if (UIScene::init())
|
||||
{
|
||||
Size widgetSize = _widget->getContentSize();
|
||||
|
||||
// Add a label in which the dragpanel events will be displayed
|
||||
_displayValueLabel = Text::create("Move by horizontal direction", "fonts/Marker Felt.ttf", 32);
|
||||
_displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
|
||||
_displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f,
|
||||
widgetSize.height / 2.0f +
|
||||
_displayValueLabel->getContentSize().height * 1.5));
|
||||
_uiLayer->addChild(_displayValueLabel);
|
||||
|
||||
// Add the black background
|
||||
Text* alert = Text::create("PageView with Buttons", "fonts/Marker Felt.ttf", 30);
|
||||
alert->setColor(Color3B(159, 168, 176));
|
||||
alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 3.075f));
|
||||
_uiLayer->addChild(alert);
|
||||
|
||||
Layout* root = static_cast<Layout*>(_uiLayer->getChildByTag(81));
|
||||
|
||||
Layout* background = dynamic_cast<Layout*>(root->getChildByName("background_Panel"));
|
||||
|
||||
// Create the page view
|
||||
PageView* pageView = PageView::create();
|
||||
pageView->setContentSize(Size(240.0f, 130.0f));
|
||||
Size backgroundSize = background->getContentSize();
|
||||
pageView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f +
|
||||
(backgroundSize.width - pageView->getContentSize().width) / 2.0f,
|
||||
(widgetSize.height - backgroundSize.height) / 2.0f +
|
||||
(backgroundSize.height - pageView->getContentSize().height) / 2.0f));
|
||||
|
||||
pageView->removeAllPages();
|
||||
|
||||
int pageCount = 4;
|
||||
for (int i = 0; i < pageCount; ++i)
|
||||
{
|
||||
HBox* outerBox = HBox::create();
|
||||
outerBox->setContentSize(Size(240.0f, 130.0f));
|
||||
|
||||
for (int k = 0; k < 2; ++k) {
|
||||
VBox* innerBox = VBox::create();
|
||||
|
||||
for (int j = 0; j < 3; j++) {
|
||||
Button *btn = Button::create("cocosui/animationbuttonnormal.png",
|
||||
"cocosui/animationbuttonpressed.png");
|
||||
btn->setName(StringUtils::format("button %d", j));
|
||||
btn->addTouchEventListener( CC_CALLBACK_2(UIPageViewButtonTest::onButtonClicked, this));
|
||||
|
||||
innerBox->addChild(btn);
|
||||
}
|
||||
|
||||
LinearLayoutParameter *parameter = LinearLayoutParameter::create();
|
||||
parameter->setMargin(Margin(0,0,100,0));
|
||||
innerBox->setLayoutParameter(parameter);
|
||||
|
||||
outerBox->addChild(innerBox);
|
||||
|
||||
}
|
||||
|
||||
pageView->insertPage(outerBox,i);
|
||||
}
|
||||
|
||||
pageView->removePageAtIndex(0);
|
||||
|
||||
pageView->addEventListener(CC_CALLBACK_2(UIPageViewButtonTest::pageViewEvent, this));
|
||||
|
||||
_uiLayer->addChild(pageView);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void UIPageViewButtonTest::onButtonClicked(Ref* pSender, Widget::TouchEventType type)
|
||||
{
|
||||
Button *btn = (Button*)pSender;
|
||||
CCLOG("button %s clicked", btn->getName().c_str());
|
||||
}
|
||||
|
||||
|
||||
void UIPageViewButtonTest::pageViewEvent(Ref *pSender, PageView::EventType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case PageView::EventType::TURNING:
|
||||
{
|
||||
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
||||
|
||||
_displayValueLabel->setString(CCString::createWithFormat("page = %ld", pageView->getCurPageIndex() + 1)->getCString());
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,4 +41,18 @@ protected:
|
|||
Text* _displayValueLabel;
|
||||
};
|
||||
|
||||
class UIPageViewButtonTest : public UIScene
|
||||
{
|
||||
public:
|
||||
UIPageViewButtonTest();
|
||||
~UIPageViewButtonTest();
|
||||
bool init();
|
||||
|
||||
void pageViewEvent(Ref* pSender, PageView::EventType type);
|
||||
void onButtonClicked(Ref* pSender, Widget::TouchEventType type);
|
||||
protected:
|
||||
UI_SCENE_CREATE_FUNC(UIPageViewButtonTest)
|
||||
Text* _displayValueLabel;
|
||||
};
|
||||
|
||||
#endif /* defined(__TestCpp__UIPageViewTest__) */
|
||||
|
|
|
@ -16,43 +16,70 @@ UIPageViewTest_Editor::~UIPageViewTest_Editor()
|
|||
|
||||
}
|
||||
|
||||
void UIPageViewTest_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIPageView_Editor/ui_pageview_editor_1.json"));
|
||||
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UIPageView_Editor/ui_pageview_editor_1.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UIPageViewTest_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
}
|
||||
|
||||
bool UIPageViewTest_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIPageView_Editor/ui_pageview_editor_1.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UIPageView_Editor/ui_pageview_editor_1.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIPageView_Editor/ui_pageview_editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
|
||||
this->configureGUIScene();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,8 @@ public:
|
|||
bool init();
|
||||
|
||||
void pageViewEvent(Ref* pSender, PageView::EventType type);
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UIPageViewTest_Editor)
|
||||
Text* _displayValueLabel;
|
||||
|
|
|
@ -100,7 +100,8 @@ static const char* s_testArray[] =
|
|||
"UIScrollViewTest_Both",
|
||||
"UIScrollViewTest_ScrollToPercentBothDirection",
|
||||
"UIScrollViewTest_ScrollToPercentBothDirection_Bounce",
|
||||
"UIPageViewTest,",
|
||||
"UIPageViewTest",
|
||||
"UIPageViewButtonTest",
|
||||
"UIListViewTest_Vertical",
|
||||
"UIListViewTest_Horizontal",
|
||||
/*
|
||||
|
@ -344,7 +345,8 @@ Scene *UISceneManager::currentUIScene()
|
|||
|
||||
case kUIPageViewTest:
|
||||
return UIPageViewTest::sceneWithTitle(s_testArray[_currentUISceneId]);
|
||||
|
||||
case kUIPageViewButtonTest:
|
||||
return UIPageViewButtonTest::sceneWithTitle(s_testArray[_currentUISceneId]);
|
||||
case kUIListViewTest_Vertical:
|
||||
return UIListViewTest_Vertical::sceneWithTitle(s_testArray[_currentUISceneId]);
|
||||
|
||||
|
|
|
@ -90,6 +90,7 @@ enum
|
|||
kUIScrollViewTest_ScrollToPercentBothDirection,
|
||||
kUIScrollViewTest_ScrollToPercentBothDirection_Bounce,
|
||||
kUIPageViewTest,
|
||||
kUIPageViewButtonTest,
|
||||
kUIListViewTest_Vertical,
|
||||
kUIListViewTest_Horizontal,
|
||||
/*
|
||||
|
|
|
@ -26,12 +26,37 @@ bool UIScene_Editor::init()
|
|||
_touchGroup = Layer::create();
|
||||
addChild(_touchGroup);
|
||||
|
||||
//add switch
|
||||
MenuItem* pLoadJsonItem = MenuItemFont::create("Switch to Binary Load");
|
||||
MenuItem* pLoadBinaryItem = MenuItemFont::create("Switch to Json Load");
|
||||
|
||||
pLoadJsonItem->setTag(1);
|
||||
pLoadBinaryItem->setTag(2);
|
||||
|
||||
Vector<MenuItem*> array;;
|
||||
array.pushBack(pLoadJsonItem);
|
||||
array.pushBack(pLoadBinaryItem);
|
||||
|
||||
MenuItemToggle *pToggleItem = MenuItemToggle::createWithCallback(CC_CALLBACK_1(UIScene_Editor::switchLoadMethod,this), array);
|
||||
|
||||
pToggleItem->setPosition(Vec2(VisibleRect::right().x - 150, VisibleRect::top().y - 50));;
|
||||
|
||||
Menu* pMenu =Menu::create(pToggleItem, NULL);
|
||||
pMenu->setPosition( Vec2::ZERO );
|
||||
|
||||
addChild(pMenu, 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void UIScene_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
//subclass should override this method
|
||||
}
|
||||
|
||||
void UIScene_Editor::previousCallback(Ref* sender, Widget::TouchEventType event)
|
||||
{
|
||||
switch (event)
|
||||
|
|
|
@ -69,7 +69,8 @@ public:
|
|||
CC_SYNTHESIZE_READONLY(Text*, _sceneTitle, SceneTitle)
|
||||
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UIScene_Editor);
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
|
||||
protected:
|
||||
Layer* _touchGroup;
|
||||
Layout* _layout;
|
||||
|
|
|
@ -15,43 +15,70 @@ UIScrollViewTest_Vertical_Editor::~UIScrollViewTest_Vertical_Editor()
|
|||
|
||||
}
|
||||
|
||||
void UIScrollViewTest_Vertical_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Vertical_Editor/ui_scrollview_editor_1.json"));
|
||||
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Vertical_Editor/ui_scrollview_editor_1.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UIScrollViewTest_Vertical_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
}
|
||||
|
||||
bool UIScrollViewTest_Vertical_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Vertical_Editor/ui_scrollview_editor_1.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Vertical_Editor/ui_scrollview_editor_1.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Vertical_Editor/ui_scrollview_editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
|
||||
this->configureGUIScene();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -69,45 +96,72 @@ UIScrollViewTest_Horizontal_Editor::UIScrollViewTest_Horizontal_Editor()
|
|||
UIScrollViewTest_Horizontal_Editor::~UIScrollViewTest_Horizontal_Editor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UIScrollViewTest_Horizontal_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Horizontal_Editor/ui_scrollview_horizontal_editor_1.json"));
|
||||
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Horizontal_Editor/ui_scrollview_horizontal_editor_1.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UIScrollViewTest_Horizontal_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool UIScrollViewTest_Horizontal_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Horizontal_Editor/ui_scrollview_horizontal_editor_1.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Horizontal_Editor/ui_scrollview_horizontal_editor_1.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Horizontal_Editor/ui_scrollview_horizontal_editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
this->configureGUIScene();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -127,43 +181,68 @@ UIScrollViewTest_Both_Editor::~UIScrollViewTest_Both_Editor()
|
|||
|
||||
}
|
||||
|
||||
void UIScrollViewTest_Both_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Both_Editor/ui_scrollview_both_editor_1.json"));
|
||||
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Both_Editor/ui_scrollview_both_editor_1.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UIScrollViewTest_Both_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
}
|
||||
|
||||
bool UIScrollViewTest_Both_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Both_Editor/ui_scrollview_both_editor_1.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Both_Editor/ui_scrollview_both_editor_1.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Both_Editor/ui_scrollview_both_editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
Button* left_button = Button::create();
|
||||
left_button->loadTextures("Images/b1.png", "Images/b2.png", "");
|
||||
left_button->setPosition(Vec2(_layout->getContentSize().width / 2 - left_button->getContentSize().width,
|
||||
left_button->getContentSize().height * 0.625));
|
||||
left_button->setTouchEnabled(true);
|
||||
left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this));
|
||||
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(left_button);
|
||||
|
||||
Button* right_button = Button::create();
|
||||
right_button->loadTextures("Images/f1.png", "Images/f2.png", "");
|
||||
right_button->setPosition(Vec2(_layout->getContentSize().width / 2 + right_button->getContentSize().width,
|
||||
right_button->getContentSize().height * 0.625));
|
||||
right_button->setTouchEnabled(true);
|
||||
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this));
|
||||
_layout->addChild(right_button);
|
||||
|
||||
this->configureGUIScene();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -183,6 +262,7 @@ UIScrollViewTest_ScrollToPercentBothDirection_Editor::~UIScrollViewTest_ScrollTo
|
|||
|
||||
}
|
||||
|
||||
|
||||
bool UIScrollViewTest_ScrollToPercentBothDirection_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
|
|
|
@ -33,7 +33,8 @@ public:
|
|||
UIScrollViewTest_Vertical_Editor();
|
||||
~UIScrollViewTest_Vertical_Editor();
|
||||
bool init();
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UIScrollViewTest_Vertical_Editor)
|
||||
Text* _displayValueLabel;
|
||||
|
@ -46,7 +47,8 @@ public:
|
|||
UIScrollViewTest_Horizontal_Editor();
|
||||
~UIScrollViewTest_Horizontal_Editor();
|
||||
bool init();
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UIScrollViewTest_Horizontal_Editor)
|
||||
Text* _displayValueLabel;
|
||||
|
@ -59,7 +61,8 @@ public:
|
|||
UIScrollViewTest_Both_Editor();
|
||||
~UIScrollViewTest_Both_Editor();
|
||||
bool init();
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UIScrollViewTest_Both_Editor)
|
||||
Text* _displayValueLabel;
|
||||
|
@ -72,7 +75,7 @@ public:
|
|||
UIScrollViewTest_ScrollToPercentBothDirection_Editor();
|
||||
~UIScrollViewTest_ScrollToPercentBothDirection_Editor();
|
||||
bool init();
|
||||
|
||||
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UIScrollViewTest_ScrollToPercentBothDirection_Editor)
|
||||
Text* _displayValueLabel;
|
||||
|
|
|
@ -16,32 +16,58 @@ UISliderTest_Editor::~UISliderTest_Editor()
|
|||
|
||||
}
|
||||
|
||||
void UISliderTest_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UISlider_Editor/ui_slider_editor_1.json"));
|
||||
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UISlider_Editor/ui_slider_editor_1.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UISliderTest_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
|
||||
Slider* slider = static_cast<Slider*>(Helper::seekWidgetByName(root, "Slider_738"));
|
||||
slider->addEventListener(CC_CALLBACK_2(UISliderTest_Editor::sliderEvent, this));
|
||||
|
||||
Slider* scale9_slider = static_cast<Slider*>(Helper::seekWidgetByName(root, "Slider_740"));
|
||||
scale9_slider->addEventListener(CC_CALLBACK_2(UISliderTest_Editor::sliderEvent, this));
|
||||
}
|
||||
|
||||
bool UISliderTest_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UISlider_Editor/ui_slider_editor_1.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UISlider_Editor/ui_slider_editor_1.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UISlider_Editor/ui_slider_editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
|
||||
Slider* slider = static_cast<Slider*>(Helper::seekWidgetByName(root, "Slider_738"));
|
||||
slider->addEventListener(CC_CALLBACK_2(UISliderTest_Editor::sliderEvent, this));
|
||||
|
||||
Slider* scale9_slider = static_cast<Slider*>(Helper::seekWidgetByName(root, "Slider_740"));
|
||||
scale9_slider->addEventListener(CC_CALLBACK_2(UISliderTest_Editor::sliderEvent, this));
|
||||
|
||||
|
||||
this->configureGUIScene();
|
||||
|
||||
_displayValueLabel = Text::create();
|
||||
_displayValueLabel->setFontName("fonts/Marker Felt.ttf");
|
||||
|
@ -49,7 +75,7 @@ bool UISliderTest_Editor::init()
|
|||
_displayValueLabel->setString("No event");
|
||||
_displayValueLabel->setPosition(Vec2(_layout->getContentSize().width / 2,
|
||||
_layout->getContentSize().height - _displayValueLabel->getContentSize().height * 1.75f));
|
||||
_touchGroup->addChild(_displayValueLabel);
|
||||
_touchGroup->addChild(_displayValueLabel, 20);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,9 @@ public:
|
|||
~UISliderTest_Editor();
|
||||
bool init();
|
||||
void sliderEvent(Ref* pSender, Slider::EventType type);
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UISliderTest_Editor)
|
||||
Text* _displayValueLabel;
|
||||
|
|
|
@ -3,26 +3,51 @@
|
|||
#include "UITextAtlasTest_Editor.h"
|
||||
|
||||
// UITextAtlasTest_Editor
|
||||
void UITextAtlasTest_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILabelAtlas_Editor/ui_labelatlas_editor_1.json"));
|
||||
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILabelAtlas_Editor/ui_labelatlas_editor_1.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UITextAtlasTest_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
}
|
||||
|
||||
bool UITextAtlasTest_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILabelAtlas_Editor/ui_labelatlas_editor_1.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILabelAtlas_Editor/ui_labelatlas_editor_1.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILabelAtlas_Editor/ui_labelatlas_editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
|
||||
this->configureGUIScene();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@ class UITextAtlasTest_Editor : public UIScene_Editor
|
|||
{
|
||||
public:
|
||||
bool init();
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UITextAtlasTest_Editor)
|
||||
};
|
||||
|
|
|
@ -4,26 +4,51 @@
|
|||
|
||||
|
||||
// UITextBMFontTest_Editor
|
||||
void UITextBMFontTest_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILabelBMFont_Editor/ui_labelbmfont_editor_1.json"));
|
||||
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILabelBMFont_Editor/ui_labelbmfont_editor_1.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UITextBMFontTest_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
}
|
||||
|
||||
bool UITextBMFontTest_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILabelBMFont_Editor/ui_labelbmfont_editor_1.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILabelBMFont_Editor/ui_labelbmfont_editor_1.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILabelBMFont_Editor/ui_labelbmfont_editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
this->configureGUIScene();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@ class UITextBMFontTest_Editor : public UIScene_Editor
|
|||
{
|
||||
public:
|
||||
bool init();
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UITextBMFontTest_Editor)
|
||||
};
|
||||
|
|
|
@ -16,33 +16,60 @@ UITextFieldTest_Editor::~UITextFieldTest_Editor()
|
|||
|
||||
}
|
||||
|
||||
void UITextFieldTest_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UITextField_Editor/ui_textfield_editor_1.json"));
|
||||
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UITextField_Editor/ui_textfield_editor_1.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UITextFieldTest_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
TextField* textField_normal = static_cast<TextField*>(Helper::seekWidgetByName(root, "TextField_1109"));
|
||||
textField_normal->addEventListener(CC_CALLBACK_2(UITextFieldTest_Editor::textFieldEvent, this));
|
||||
|
||||
TextField* textField_max_character = static_cast<TextField*>(Helper::seekWidgetByName(root, "TextField_1110"));
|
||||
textField_max_character->addEventListener(CC_CALLBACK_2(UITextFieldTest_Editor::textFieldEvent, this));
|
||||
|
||||
TextField* textField_password = static_cast<TextField*>(Helper::seekWidgetByName(root, "TextField_1107"));
|
||||
textField_password->addEventListener(CC_CALLBACK_2(UITextFieldTest_Editor::textFieldEvent, this));
|
||||
}
|
||||
|
||||
bool UITextFieldTest_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UITextField_Editor/ui_textfield_editor_1.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UITextField_Editor/ui_textfield_editor_1.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UITextField_Editor/ui_textfield_editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
TextField* textField_normal = static_cast<TextField*>(Helper::seekWidgetByName(root, "TextField_1109"));
|
||||
textField_normal->addEventListener(CC_CALLBACK_2(UITextFieldTest_Editor::textFieldEvent, this));
|
||||
|
||||
TextField* textField_max_character = static_cast<TextField*>(Helper::seekWidgetByName(root, "TextField_1110"));
|
||||
textField_max_character->addEventListener(CC_CALLBACK_2(UITextFieldTest_Editor::textFieldEvent, this));
|
||||
|
||||
TextField* textField_password = static_cast<TextField*>(Helper::seekWidgetByName(root, "TextField_1107"));
|
||||
textField_password->addEventListener(CC_CALLBACK_2(UITextFieldTest_Editor::textFieldEvent, this));
|
||||
|
||||
this->configureGUIScene();
|
||||
|
||||
_displayValueLabel = Text::create();
|
||||
_displayValueLabel->setFontName("fonts/Marker Felt.ttf");
|
||||
|
@ -50,7 +77,7 @@ bool UITextFieldTest_Editor::init()
|
|||
_displayValueLabel->setString("No event");
|
||||
_displayValueLabel->setPosition(Vec2(_layout->getContentSize().width / 2,
|
||||
_layout->getContentSize().height - _displayValueLabel->getContentSize().height * 1.75f));
|
||||
_touchGroup->addChild(_displayValueLabel);
|
||||
_touchGroup->addChild(_displayValueLabel, 20);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,8 @@ public:
|
|||
~UITextFieldTest_Editor();
|
||||
bool init();
|
||||
void textFieldEvent(Ref* pSender, TextField::EventType type);
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UITextFieldTest_Editor)
|
||||
Text* _displayValueLabel;
|
||||
|
|
|
@ -7,25 +7,51 @@
|
|||
// UITextTest_Editor
|
||||
using namespace ui;
|
||||
|
||||
void UITextTest_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILabel_Editor/ui_label_editor_1.json"));
|
||||
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILabel_Editor/ui_label_editor_1.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UITextTest_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
}
|
||||
|
||||
bool UITextTest_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILabel_Editor/ui_label_editor_1.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UILabel_Editor/ui_label_editor_1.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UILabel_Editor/ui_label_editor_1.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
this->configureGUIScene();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@ class UITextTest_Editor : public UIScene_Editor
|
|||
{
|
||||
public:
|
||||
bool init();
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UITextTest_Editor)
|
||||
};
|
||||
|
|
|
@ -15,35 +15,63 @@ UIWidgetAddNodeTest_Editor::~UIWidgetAddNodeTest_Editor()
|
|||
|
||||
}
|
||||
|
||||
void UIWidgetAddNodeTest_Editor::switchLoadMethod(cocos2d::Ref *pSender)
|
||||
{
|
||||
MenuItemToggle *item = (MenuItemToggle*)pSender;
|
||||
|
||||
if (item->getSelectedIndex() == 0){
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIWidgetAddNode_Editor/ui_widget_add_node_editor.json"));
|
||||
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}else{
|
||||
_layout->removeFromParentAndCleanup(true);
|
||||
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UIWidgetAddNode_Editor/ui_widget_add_node_editor.csb"));
|
||||
_touchGroup->addChild(_layout);
|
||||
|
||||
this->configureGUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
void UIWidgetAddNodeTest_Editor::configureGUIScene()
|
||||
{
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
|
||||
// Create the ui widget
|
||||
Widget* widget = Widget::create();
|
||||
widget->setPosition(Vec2(rootSize.width / 2.0f, rootSize.height / 2.0f));
|
||||
widget->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(widget);
|
||||
|
||||
Sprite* sprite = Sprite::create("cocosui/ccicon.png");
|
||||
widget->addChild(sprite);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool UIWidgetAddNodeTest_Editor::init()
|
||||
{
|
||||
if (UIScene_Editor::init())
|
||||
{
|
||||
// _layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIWidgetAddNode_Editor/ui_widget_add_node_editor.json"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromBinaryFile("cocosui/UIEditorTest/UIWidgetAddNode_Editor/ui_widget_add_node_editor.csb"));
|
||||
_layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/UIEditorTest/UIWidgetAddNode_Editor/ui_widget_add_node_editor.json"));
|
||||
_touchGroup->addChild(_layout);
|
||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||
Size rootSize = _layout->getContentSize();
|
||||
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||
(screenSize.height - rootSize.height) / 2));
|
||||
|
||||
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
|
||||
|
||||
Text* back_label = static_cast<Text*>(Helper::seekWidgetByName(root, "back"));
|
||||
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));
|
||||
|
||||
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
|
||||
|
||||
|
||||
// Create the ui widget
|
||||
Widget* widget = Widget::create();
|
||||
widget->setPosition(Vec2(rootSize.width / 2.0f, rootSize.height / 2.0f));
|
||||
widget->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
||||
_layout->addChild(widget);
|
||||
|
||||
Sprite* sprite = Sprite::create("cocosui/ccicon.png");
|
||||
widget->addChild(sprite);
|
||||
|
||||
this->configureGUIScene();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,8 @@ public:
|
|||
UIWidgetAddNodeTest_Editor();
|
||||
~UIWidgetAddNodeTest_Editor();
|
||||
bool init();
|
||||
|
||||
virtual void switchLoadMethod(Ref* pSender);
|
||||
void configureGUIScene();
|
||||
protected:
|
||||
UI_SCENE_EDITOR_CREATE_FUNC(UIWidgetAddNodeTest_Editor)
|
||||
};
|
||||
|
|
|
@ -32,21 +32,28 @@ void GameControllerTest::onConnectController(Controller* controller, Event* even
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
//receive back key
|
||||
controller->receiveExternalKeyEvent(4,true);
|
||||
//receive menu key
|
||||
controller->receiveExternalKeyEvent(82,true);
|
||||
#endif
|
||||
|
||||
char deviceInfo[50];
|
||||
sprintf(deviceInfo,"%s id:%d",controller->getDeviceName().c_str(), controller->getDeviceId());
|
||||
|
||||
if (_firstHolder.controller == nullptr && _secondHolder.controller == nullptr)
|
||||
{
|
||||
char deviceId[20];
|
||||
sprintf(deviceId,"device id:%d",controller->getDeviceId());
|
||||
|
||||
{
|
||||
if (_firstHolder._holderNode)
|
||||
{
|
||||
_firstHolder.controller = controller;
|
||||
_firstHolder._deviceIdLabel->setString(deviceId);
|
||||
_firstHolder._deviceLabel->setString(deviceInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
_secondHolder.controller = controller;
|
||||
_secondHolder._deviceIdLabel->setString(deviceId);
|
||||
_secondHolder._deviceLabel->setString(deviceInfo);
|
||||
}
|
||||
}
|
||||
else if(_secondHolder.controller == nullptr)
|
||||
|
@ -66,9 +73,7 @@ void GameControllerTest::onConnectController(Controller* controller, Event* even
|
|||
this->addChild(_secondHolder._holderNode);
|
||||
}
|
||||
|
||||
char deviceId[20];
|
||||
sprintf(deviceId,"device id:%d",controller->getDeviceId());
|
||||
_secondHolder._deviceIdLabel->setString(deviceId);
|
||||
_secondHolder._deviceLabel->setString(deviceInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -86,9 +91,8 @@ void GameControllerTest::onConnectController(Controller* controller, Event* even
|
|||
_firstHolder._holderNode->setPosition(Vec2(_visibleThreeQuarterX, _visibleCentreY));
|
||||
this->addChild(_firstHolder._holderNode);
|
||||
}
|
||||
char deviceId[20];
|
||||
sprintf(deviceId,"device id:%d",controller->getDeviceId());
|
||||
_firstHolder._deviceIdLabel->setString(deviceId);
|
||||
|
||||
_firstHolder._deviceLabel->setString(deviceInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,7 +148,7 @@ void GameControllerTest::resetControllerHolderState(ControllerHolder& holder)
|
|||
|
||||
holder._leftJoystick->setPosition(Vec2(238,460));
|
||||
holder._rightJoystick->setPosition(Vec2(606,293));
|
||||
holder._deviceIdLabel->setString("Disconnected");
|
||||
holder._deviceLabel->setString("Disconnected");
|
||||
}
|
||||
|
||||
void GameControllerTest::showButtonState(cocos2d::Controller *controller, int keyCode, bool isPressed)
|
||||
|
@ -193,7 +197,12 @@ void GameControllerTest::showButtonState(cocos2d::Controller *controller, int ke
|
|||
holder->_buttonR1->setColor(Color3B(19,231,238));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
{
|
||||
char ketStatus[30];
|
||||
sprintf(ketStatus,"Key Down:%d",keyCode);
|
||||
holder->_externalKeyLabel->setString(ketStatus);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -231,7 +240,12 @@ void GameControllerTest::showButtonState(cocos2d::Controller *controller, int ke
|
|||
holder->_buttonR1->setColor(Color3B::WHITE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
{
|
||||
char ketStatus[30];
|
||||
sprintf(ketStatus,"Key Up:%d",keyCode);
|
||||
holder->_externalKeyLabel->setString(ketStatus);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -248,7 +262,6 @@ void GameControllerTest::onKeyUp(cocos2d::Controller *controller, int keyCode, c
|
|||
|
||||
void GameControllerTest::onAxisEvent(cocos2d::Controller* controller, int keyCode, cocos2d::Event* event)
|
||||
{
|
||||
//onConnectController(controller,nullptr);
|
||||
ControllerHolder* holder = nullptr;
|
||||
if (controller == _firstHolder.controller)
|
||||
holder = &_firstHolder;
|
||||
|
@ -344,12 +357,16 @@ void GameControllerTest::createControllerSprite(ControllerHolder& holder)
|
|||
holder._rightJoystick->setPosition(Vec2(606,293));
|
||||
holder._holderNode->addChild(holder._rightJoystick);
|
||||
|
||||
holder._deviceIdLabel = Label::createWithTTF("Disconnected","fonts/Marker Felt.ttf",36);
|
||||
holder._deviceIdLabel->setPosition(Vec2(499,460));
|
||||
holder._deviceIdLabel->setTextColor(Color4B::RED);
|
||||
holder._holderNode->addChild(holder._deviceIdLabel);
|
||||
holder._deviceLabel = Label::createWithTTF("Disconnected","fonts/Marker Felt.ttf",36);
|
||||
holder._deviceLabel->setPosition(Vec2(499,650));
|
||||
holder._deviceLabel->setTextColor(Color4B::RED);
|
||||
holder._holderNode->addChild(holder._deviceLabel);
|
||||
|
||||
holder._externalKeyLabel = Label::createWithTTF("Key event","fonts/Marker Felt.ttf",36);
|
||||
holder._externalKeyLabel->setPosition(Vec2(499,500));
|
||||
holder._externalKeyLabel->setTextColor(Color4B::RED);
|
||||
holder._holderNode->addChild(holder._externalKeyLabel);
|
||||
//-----------------------------------------------------------------
|
||||
//371,294 64
|
||||
auto dPadTexture = Director::getInstance()->getTextureCache()->addImage("dPad.png");
|
||||
|
||||
auto dPadCenter = Sprite::createWithTexture(dPadTexture,Rect(60,60,68,68));
|
||||
|
@ -400,7 +417,6 @@ void GameControllerTest::createControllerSprite(ControllerHolder& holder)
|
|||
holder._buttonR2->setPosition(Vec2(998-220,910));
|
||||
holder._holderNode->addChild(holder._buttonR2);
|
||||
//-----------------------------------------------------------------
|
||||
//750 460,70
|
||||
holder._buttonX = Sprite::create("X.png");
|
||||
holder._buttonX->setPosition(Vec2(750 - 70,460));
|
||||
holder._holderNode->addChild(holder._buttonX);
|
||||
|
|
|
@ -53,7 +53,8 @@ private:
|
|||
cocos2d::Sprite* _buttonL2;
|
||||
cocos2d::Sprite* _buttonR2;
|
||||
|
||||
cocos2d::Label* _deviceIdLabel;
|
||||
cocos2d::Label* _deviceLabel;
|
||||
cocos2d::Label* _externalKeyLabel;
|
||||
}ControllerHolder;
|
||||
|
||||
ControllerHolder _firstHolder;
|
||||
|
|
Loading…
Reference in New Issue