mirror of https://github.com/axmolengine/axmol.git
enabled console for WinRT
This commit is contained in:
parent
52fc6d618b
commit
c8e4fe1fbf
|
@ -40,7 +40,7 @@
|
||||||
#include <WS2tcpip.h>
|
#include <WS2tcpip.h>
|
||||||
#include <Winsock2.h>
|
#include <Winsock2.h>
|
||||||
#define bzero(a, b) memset(a, 0, b);
|
#define bzero(a, b) memset(a, 0, b);
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
|
||||||
#include "inet_ntop_winrt.h"
|
#include "inet_ntop_winrt.h"
|
||||||
#include "CCWinRTUtils.h"
|
#include "CCWinRTUtils.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -111,8 +111,6 @@ static bool isFloat( std::string myString ) {
|
||||||
return iss.eof() && !iss.fail();
|
return iss.eof() && !iss.fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CC_TARGET_PLATFORM != CC_PLATFORM_WINRT
|
|
||||||
|
|
||||||
// helper free functions
|
// helper free functions
|
||||||
|
|
||||||
// dprintf() is not defined in Android
|
// dprintf() is not defined in Android
|
||||||
|
@ -183,7 +181,6 @@ static void printFileUtils(int fd)
|
||||||
}
|
}
|
||||||
sendPrompt(fd);
|
sendPrompt(fd);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(__MINGW32__)
|
#if defined(__MINGW32__)
|
||||||
|
@ -231,9 +228,7 @@ static void _log(const char *format, va_list args)
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
|
|
||||||
Director::getInstance()->getConsole()->log(buf);
|
Director::getInstance()->getConsole()->log(buf);
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,8 +249,6 @@ void log(const char * format, ...)
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Console code
|
// Console code
|
||||||
//
|
//
|
||||||
|
@ -328,7 +321,7 @@ bool Console::listenOnTCP(int port)
|
||||||
hints.ai_family = AF_INET; // AF_UNSPEC: Do we need IPv6 ?
|
hints.ai_family = AF_INET; // AF_UNSPEC: Do we need IPv6 ?
|
||||||
hints.ai_socktype = SOCK_STREAM;
|
hints.ai_socktype = SOCK_STREAM;
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
|
||||||
WSADATA wsaData;
|
WSADATA wsaData;
|
||||||
n = WSAStartup(MAKEWORD(2, 2),&wsaData);
|
n = WSAStartup(MAKEWORD(2, 2),&wsaData);
|
||||||
|
|
||||||
|
@ -354,7 +347,7 @@ bool Console::listenOnTCP(int port)
|
||||||
break; /* success */
|
break; /* success */
|
||||||
|
|
||||||
/* bind error, close and try next one */
|
/* bind error, close and try next one */
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
|
||||||
closesocket(listenfd);
|
closesocket(listenfd);
|
||||||
#else
|
#else
|
||||||
close(listenfd);
|
close(listenfd);
|
||||||
|
@ -441,7 +434,7 @@ void Console::commandExit(int fd, const std::string &args)
|
||||||
{
|
{
|
||||||
FD_CLR(fd, &_read_set);
|
FD_CLR(fd, &_read_set);
|
||||||
_fds.erase(std::remove(_fds.begin(), _fds.end(), fd), _fds.end());
|
_fds.erase(std::remove(_fds.begin(), _fds.end(), fd), _fds.end());
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
|
||||||
closesocket(fd);
|
closesocket(fd);
|
||||||
#else
|
#else
|
||||||
close(fd);
|
close(fd);
|
||||||
|
@ -1074,7 +1067,7 @@ void Console::loop()
|
||||||
//receive a SIGPIPE, which will cause linux system shutdown the sending process.
|
//receive a SIGPIPE, which will cause linux system shutdown the sending process.
|
||||||
//Add this ioctl code to check if the socket has been closed by peer.
|
//Add this ioctl code to check if the socket has been closed by peer.
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
|
||||||
u_long n = 0;
|
u_long n = 0;
|
||||||
ioctlsocket(fd, FIONREAD, &n);
|
ioctlsocket(fd, FIONREAD, &n);
|
||||||
#else
|
#else
|
||||||
|
@ -1119,14 +1112,14 @@ void Console::loop()
|
||||||
// clean up: ignore stdin, stdout and stderr
|
// clean up: ignore stdin, stdout and stderr
|
||||||
for(const auto &fd: _fds )
|
for(const auto &fd: _fds )
|
||||||
{
|
{
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
|
||||||
closesocket(fd);
|
closesocket(fd);
|
||||||
#else
|
#else
|
||||||
close(fd);
|
close(fd);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
|
||||||
closesocket(_listenfd);
|
closesocket(_listenfd);
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
#else
|
#else
|
||||||
|
@ -1135,7 +1128,6 @@ void Console::loop()
|
||||||
_running = false;
|
_running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* #if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) */
|
|
||||||
|
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
|
@ -72,7 +72,6 @@ void CC_DLL log(const char * format, ...) CC_FORMAT_PRINTF(1, 2);
|
||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
|
|
||||||
class CC_DLL Console
|
class CC_DLL Console
|
||||||
: public Ref
|
: public Ref
|
||||||
{
|
{
|
||||||
|
@ -148,7 +147,6 @@ private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Console);
|
CC_DISALLOW_COPY_AND_ASSIGN(Console);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* #if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) */
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
||||||
#endif /* defined(__CCCONSOLE_H__) */
|
#endif /* defined(__CCCONSOLE_H__) */
|
||||||
|
|
|
@ -59,9 +59,7 @@ class TextureCache;
|
||||||
class Renderer;
|
class Renderer;
|
||||||
class Camera;
|
class Camera;
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
|
|
||||||
class Console;
|
class Console;
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Class that creates and handles the main Window and manages how
|
@brief Class that creates and handles the main Window and manages how
|
||||||
|
@ -391,9 +389,7 @@ public:
|
||||||
/** Returns the Console
|
/** Returns the Console
|
||||||
@since v3.0
|
@since v3.0
|
||||||
*/
|
*/
|
||||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
|
|
||||||
Console* getConsole() const { return _console; }
|
Console* getConsole() const { return _console; }
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Gets delta time since last tick to main loop */
|
/* Gets delta time since last tick to main loop */
|
||||||
float getDeltaTime() const;
|
float getDeltaTime() const;
|
||||||
|
@ -503,10 +499,8 @@ protected:
|
||||||
/* Renderer for the Director */
|
/* Renderer for the Director */
|
||||||
Renderer *_renderer;
|
Renderer *_renderer;
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
|
|
||||||
/* Console for the director */
|
/* Console for the director */
|
||||||
Console *_console;
|
Console *_console;
|
||||||
#endif
|
|
||||||
|
|
||||||
// GLView will recreate stats labels to fit visible rect
|
// GLView will recreate stats labels to fit visible rect
|
||||||
friend class GLView;
|
friend class GLView;
|
||||||
|
|
Loading…
Reference in New Issue