17 Commits

Author SHA1 Message Date
qiuguohua
ee86fc40bd Native platform modifies exit process (#14141) 2023-02-15 17:11:28 +08:00
pandamicro
afd22296b4 MIT license update and to new year 2023 (#13927)
* Cpp MIT license update and to date
* TS MIT license update and to date
2022-12-28 11:25:12 +08:00
James Chen
62d8b4daae Remove unused swapWindow methods. (#13356)
The operation of swapping (presenting) buffers is done in gfx::Device::present. To swap multi-systemwindows, multiple gfx swapchains need be created, and relevant gfx backend will iterate each swapchain and present them. Therefore, `swap buffers` operation doesn't need to be in SystemWindow or SystemWindowManager.

```c++
void GLES3Device::present() {
    CC_PROFILE(GLES3DevicePresent);
    auto *queue = static_cast<GLES3Queue *>(_queue);
    _numDrawCalls = queue->_numDrawCalls;
    _numInstances = queue->_numInstances;
    _numTriangles = queue->_numTriangles;

    bool isGFXDeviceNeedsPresent = _xr ? _xr->isGFXDeviceNeedsPresent(_api) : true;
    for (auto *swapchain : _swapchains) { // We iterate each swapchain and do the present thing here.
        if (isGFXDeviceNeedsPresent) _gpuContext->present(swapchain);
    }
    if (_xr) _xr->postGFXDevicePresent(_api);

    // Clear queue stats
    queue->_numDrawCalls = 0;
    queue->_numInstances = 0;
    queue->_numTriangles = 0;
}
```

Besides, `SDL_GL_SwapWindow` invocation is doing nothing on Windows & Linux platforms, it will generate an SDL an error that `The specified window isn't an OpenGL window` because GL context is not created by SDL_GL_CreateContext. We create contexts in our gfx code.

https://github.com/libsdl-org/SDL/blob/main/src/video/SDL_video.c#L4192

```c++

#define NOT_AN_OPENGL_WINDOW "The specified window isn't an OpenGL window"
int
SDL_GL_SwapWindowWithResult(SDL_Window * window)
{
    CHECK_WINDOW_MAGIC(window, -1);

    if (!(window->flags & SDL_WINDOW_OPENGL)) {
        return SDL_SetError(NOT_AN_OPENGL_WINDOW);
    }

    if (SDL_GL_GetCurrentWindow() != window) {
        return SDL_SetError("The specified window has not been made current");
    }

    return _this->GL_SwapWindow(_this, window);
}

void
SDL_GL_SwapWindow(SDL_Window * window)
{
    SDL_GL_SwapWindowWithResult(window);
}
```

Also, SDL_GL_SwapWindow could not take any effect if running on gfx Vulkan backend.

```c++
void SDLHelper::swapWindow(SDL_Window *window) {
    SDL_GL_SwapWindow(window);
}
```
2022-11-14 11:46:58 +08:00
James Chen
cf8675a949 fixed #13232: [feature] Support to pass commandline arguments to JS (#13268)
* [feature] Support to pass arguments to execution file and export them to JS ( native.process.argv ) .
2022-11-10 09:47:28 +08:00
江战
280fd976bc Add EventTarget & EventBus (#13100) 2022-10-28 15:44:33 +08:00
林玮
785fd91511 Add multi-windows support (#12243)
Co-authored-by: bofeng.song <bofeng.song@chukong-inc.com>
2022-09-15 14:55:44 +08:00
bofeng-song
113fad0259 refine: rename windowHanler to windowHandle, rename onDestory to onDestroy (#11907) 2022-07-09 13:54:18 +08:00
minggo
f07d3f3bda Merge branch 'v3.5.1-ds' into v3.6.0_merge_v3.5.1-ds 2022-06-07 15:02:34 +08:00
yangchao
d87262dead V3.5.1 ds servermode (#11207) 2022-05-25 09:39:16 +08:00
pandamicro
baafb1f4d3 Revert "V3.5.1 no window (#11016)" (#11071)
This reverts commit bd1c1e0088.
2022-05-14 10:20:44 +08:00
yangchao
bd1c1e0088 V3.5.1 no window (#11016) 2022-05-12 09:43:46 +08:00
minggo
271cc5cf23 Remove some format rule (#10919)
* remove some rules
* format all codes with new format rule
2022-05-04 13:09:24 +08:00
qiuguohua
b6af1ada02 V3.5.0 create window (#10481)
* 1. Modify the parameters of the creation window
2. Modify the relationship between platform and interface
3. Rename vibrate to vibrator in linux and QNX

* Fix empty platform implementation

* Fix empty platform implementation

* Modify mac and ios createwindow interface

* Create a centered window by default

* Mobile platforms do not require window creation
2022-03-25 18:43:17 +08:00
qiuguohua
6a16077bc5 SDL related interface encapsulation (#10385)
* SDL related interface encapsulation
2022-03-18 14:43:01 +08:00
qiuguohua
c082902fe4 Fix fps calculation error for linux and QNX (#10141) 2022-02-22 09:57:24 +08:00
Yun Hsiao Wu
14a17c9d22 license upgrade (#4210) 2022-01-24 17:18:47 +08:00
oahcy
5379e6ef35 引擎适配linux平台 (#4035) 2021-11-29 17:17:15 +08:00