diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-02-07 01:03:16 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-02-07 01:03:16 +0000 |
| commit | 6e7bac7b34a86f4e8e1a663631d5f260c064ac0a (patch) | |
| tree | 36ad11810cdb9b722411ec9365cc3f8babbac323 /Common/NativeApp/include | |
| parent | Update README.md (diff) | |
| download | DiligentEngine-6e7bac7b34a86f4e8e1a663631d5f260c064ac0a.tar.gz DiligentEngine-6e7bac7b34a86f4e8e1a663631d5f260c064ac0a.zip | |
Reworked Win32 native app implementation
Diffstat (limited to 'Common/NativeApp/include')
| -rw-r--r-- | Common/NativeApp/include/NativeAppBase.h | 50 | ||||
| -rw-r--r-- | Common/NativeApp/include/NativeAppData.h | 38 |
2 files changed, 88 insertions, 0 deletions
diff --git a/Common/NativeApp/include/NativeAppBase.h b/Common/NativeApp/include/NativeAppBase.h new file mode 100644 index 0000000..590b6c9 --- /dev/null +++ b/Common/NativeApp/include/NativeAppBase.h @@ -0,0 +1,50 @@ +/* Copyright 2015-2018 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +struct NativeAppAttributes +{ +#ifdef PLATFORM_WIN32 + // * HWND on Win32 + void* NativeWindowHandle = nullptr; +#endif + int WindowWidth = 0; + int WindowHeight = 0; +}; + +class NativeAppBase +{ +public: + virtual ~NativeAppBase() {} + + virtual void ProcessCommandLine(const char *CmdLine) = 0; + virtual const char* GetAppTitle()const = 0; + virtual void Initialize(const struct NativeAppAttributes &NativeAppAttribs) = 0; + virtual void Update(double CurrTime, double ElapsedTime) {}; + virtual void PlatformRender() = 0; + virtual bool HandleNativeMessage(struct NativeMessage &msg) = 0; + virtual void Resize(int width, int height) = 0; +}; + +extern NativeAppBase* CreateApplication(); diff --git a/Common/NativeApp/include/NativeAppData.h b/Common/NativeApp/include/NativeAppData.h new file mode 100644 index 0000000..ac8c55f --- /dev/null +++ b/Common/NativeApp/include/NativeAppData.h @@ -0,0 +1,38 @@ +/* Copyright 2015-2018 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +#ifdef PLATFORM_WIN32 +#include <Windows.h> +#endif + +struct NativeMessage +{ +#ifdef PLATFORM_WIN32 + HWND hWnd; + UINT message; + WPARAM wParam; + LPARAM lParam; +#endif +}; |
