mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
Android issue (#2247)
* change window handler to uintptr_t * fix compiling error
This commit is contained in:
@@ -57,7 +57,7 @@ namespace
|
||||
sprintf(commandBuf, "window.innerWidth = %d; window.innerHeight = %d; window.windowHandler = 0x%" PRIxPTR ";",
|
||||
g_width,
|
||||
g_height,
|
||||
(intptr_t)cocos2d::JniHelper::getAndroidApp()->window);
|
||||
(uintptr_t)cocos2d::JniHelper::getAndroidApp()->window);
|
||||
se->evalString(commandBuf);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace
|
||||
sprintf(commandBuf, "window.innerWidth = %d; window.innerHeight = %d; window.windowHandler = 0x%" PRIxPTR ";",
|
||||
g_width,
|
||||
g_height,
|
||||
(intptr_t)(UIApplication.sharedApplication.delegate.window.rootViewController.view) );
|
||||
(uintptr_t)(UIApplication.sharedApplication.delegate.window.rootViewController.view) );
|
||||
se->evalString(commandBuf);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace
|
||||
sprintf(commandBuf, "window.innerWidth = %d; window.innerHeight = %d; window.windowHandler = 0x%" PRIxPTR ";",
|
||||
g_width,
|
||||
g_height,
|
||||
(intptr_t)[NSApplication sharedApplication].mainWindow.contentView);
|
||||
(uintptr_t)[NSApplication sharedApplication].mainWindow.contentView);
|
||||
se->evalString(commandBuf);
|
||||
|
||||
cocos2d::CustomEvent applicationReady;
|
||||
|
||||
@@ -23,7 +23,7 @@ class CC_CORE_API GFXContext : public Object {
|
||||
|
||||
protected:
|
||||
GFXDevice* _device = nullptr;
|
||||
intptr_t _windowHandle = 0;
|
||||
uintptr_t _windowHandle = 0;
|
||||
GFXContext* _sharedContext = nullptr;
|
||||
GFXVsyncMode _vsyncMode = GFXVsyncMode::OFF;
|
||||
GFXFormat _colorFmt = GFXFormat::UNKNOWN;
|
||||
|
||||
@@ -650,7 +650,7 @@ struct GFXWindowInfo {
|
||||
};
|
||||
|
||||
struct GFXContextInfo {
|
||||
intptr_t windowHandle = 0;
|
||||
uintptr_t windowHandle = 0;
|
||||
GFXContext* sharedCtx = nullptr;
|
||||
GFXVsyncMode vsyncMode = GFXVsyncMode::OFF;
|
||||
};
|
||||
|
||||
@@ -467,9 +467,9 @@ namespace se {
|
||||
return static_cast<unsigned long>(toNumber());
|
||||
}
|
||||
|
||||
intptr_t Value::toIntptr_t() const
|
||||
intptr_t Value::toUIntptr_t() const
|
||||
{
|
||||
return static_cast<intptr_t>(toNumber());
|
||||
return static_cast<uintptr_t>(toNumber());
|
||||
}
|
||||
|
||||
float Value::toFloat() const
|
||||
|
||||
@@ -316,7 +316,7 @@ namespace se {
|
||||
* @brief Converts se::Value to unsigned long.
|
||||
* @return intptr_t.
|
||||
*/
|
||||
intptr_t toIntptr_t() const;
|
||||
intptr_t toUIntptr_t() const;
|
||||
/**
|
||||
* @brief Converts se::Value to float number.
|
||||
* @return float number.
|
||||
|
||||
@@ -412,12 +412,12 @@ bool seval_to_Uint8Array(const se::Value& v, uint8_t* ret)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool seval_to_intptr_t(const se::Value& v, intptr_t* ret)
|
||||
bool seval_to_uintptr_t(const se::Value& v, uintptr_t* ret)
|
||||
{
|
||||
assert(ret != nullptr);
|
||||
if (v.isNumber())
|
||||
{
|
||||
*ret = v.toIntptr_t();
|
||||
*ret = v.toUIntptr_t();
|
||||
return true;
|
||||
}
|
||||
*ret = 0UL;
|
||||
|
||||
@@ -111,7 +111,7 @@ bool seval_to_std_vector_uint16(const se::Value& v, std::vector<uint16_t>* ret);
|
||||
bool seval_to_std_vector_float(const se::Value& v, std::vector<float>* ret);
|
||||
bool seval_to_std_vector_Vec2(const se::Value& v, std::vector<cocos2d::Vec2>* ret);
|
||||
bool seval_to_Uint8Array(const se::Value& v, uint8_t* ret);
|
||||
bool seval_to_intptr_t(const se::Value& v, intptr_t* ret);
|
||||
bool seval_to_uintptr_t(const se::Value& v, uintptr_t* ret);
|
||||
|
||||
bool seval_to_std_map_string_string(const se::Value& v, std::map<std::string, std::string>* ret);
|
||||
bool seval_to_Data(const se::Value& v, cocos2d::Data* ret);
|
||||
|
||||
+2
-2
@@ -37,6 +37,8 @@
|
||||
namespace
|
||||
{
|
||||
Game *game = nullptr;
|
||||
struct cocos2d::TouchEvent touchEvent;
|
||||
struct cocos2d::KeyboardEvent keyboardEvent;
|
||||
|
||||
/**
|
||||
* Shared state for our app.
|
||||
@@ -48,8 +50,6 @@ namespace
|
||||
int32_t width = 0;
|
||||
int32_t height = 0;
|
||||
bool initialized = false;
|
||||
cocos2d::TouchEvent touchEvent;
|
||||
cocos2d::KeyboardEvent keyboardEvent;
|
||||
};
|
||||
|
||||
void engineHandleCmd(struct android_app* app, int32_t cmd)
|
||||
|
||||
Submodule native/tools/bindings-generator updated: 1513c8a2ed...6c6bfae1c7
Reference in New Issue
Block a user