mac server mod (#12054)

* mac server mod

Co-authored-by: bravetwo <bravetwo@163.com>
This commit is contained in:
yangchao
2022-07-19 13:42:21 +08:00
committed by GitHub
parent 12625f09d8
commit fefd8efcda
6 changed files with 10 additions and 7 deletions
+2 -1
View File
@@ -63,6 +63,7 @@ set(CC_USE_METAL ${CC_USE_METAL} CACHE INTERNAL "")
if(USE_SERVER_MODE)
set(CC_USE_VULKAN OFF)
set(CC_USE_METAL OFF)
set(CC_USE_GLES3 OFF)
set(CC_USE_GLES2 OFF)
add_definitions(-DCC_SERVER_MODE)
@@ -492,7 +493,7 @@ cocos_source_files(
cocos/platform/interfaces/modules/canvas/ICanvasRenderingContext2D.cpp
cocos/platform/interfaces/modules/canvas/ICanvasRenderingContext2D.h
)
if(USE_SERVER_MODE)
if(USE_SERVER_MODE AND (NOT MACOSX))
cocos_source_files(
cocos/platform/empty/modules/CanvasRenderingContext2DDelegate.cpp
cocos/platform/empty/modules/CanvasRenderingContext2DDelegate.h
+1 -1
View File
@@ -39,7 +39,7 @@
#include "base/Utils.h"
#include "base/memory/Memory.h"
#include "platform/FileUtils.h"
#include "AudioDecoder.h""
#include "AudioDecoder.h"
using namespace cc;
+1 -1
View File
@@ -118,7 +118,7 @@ int32_t MacPlatform::init() {
registerInterface(std::make_shared<Network>());
registerInterface(std::make_shared<Screen>());
registerInterface(std::make_shared<System>());
registerInterface(std::make_shared<SystemWindow>());
registerInterface(std::make_shared<SystemWindow>(this));
registerInterface(std::make_shared<Vibrator>());
return 0;
}
-2
View File
@@ -28,8 +28,6 @@
@interface View : NSView <CALayerDelegate>
#ifdef CC_USE_METAL
@property (nonatomic, assign) id<MTLDevice> device;
#endif
@end
@@ -33,7 +33,7 @@ namespace cc {
class SystemWindow : public ISystemWindow {
public:
SystemWindow();
SystemWindow(IEventDispatch *delegate);
~SystemWindow() override;
bool createWindow(const char* title,
@@ -33,7 +33,7 @@ namespace {
namespace cc {
SystemWindow::SystemWindow() = default;
SystemWindow::SystemWindow(IEventDispatch *delegate) {}
SystemWindow::~SystemWindow() = default;
@@ -47,7 +47,9 @@ bool SystemWindow::createWindow(const char *title,
_height = h;
AppDelegate *delegate = [[NSApplication sharedApplication] delegate];
NSString *aString = [NSString stringWithUTF8String:title];
#if !defined(CC_SERVER_MODE)
[delegate createLeftBottomWindow:aString width:w height:h];
#endif
return true;
}
@@ -62,7 +64,9 @@ bool SystemWindow::createWindow(const char *title,
_height = h;
AppDelegate *delegate = [[NSApplication sharedApplication] delegate];
NSString *aString = [NSString stringWithUTF8String:title];
#if !defined(CC_SERVER_MODE)
[delegate createWindow:aString xPos:x yPos:y width:w height:h];
#endif
return true;
}
void SystemWindow::closeWindow() {