Skip to content

Commit

Permalink
[CL] feat(CEF): CEF integration for Windows, new Chat
Browse files Browse the repository at this point in the history
  • Loading branch information
Insineer committed Feb 18, 2021
1 parent d96f150 commit 4c69fec
Show file tree
Hide file tree
Showing 49 changed files with 5,939 additions and 407 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,5 @@ cmake-build-debug/
OSS13 Client.exe
OSS13 Server.exe
python*.dll
/Resources/Browser
/External/cef/windows-bin
40 changes: 40 additions & 0 deletions OSS13 Client/OSS13 Client.exe.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity
type="win32"
name="Contoso.ExampleApplication.ExampleBinary"
version="1.2.3.4"
processorArchitecture="x86"
/>
<description>Contoso Example Application</description>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
</application>
</compatibility>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<!--
UAC settings:
- app should run at same integrity level as calling process
- app does not need to manipulate windows belonging to
higher-integrity-level processes
-->
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"
/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
64 changes: 58 additions & 6 deletions OSS13 Client/OSS13 Client.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="Shared">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\Properties\vcpkg.props" />
<Import Project="..\Properties\common.props" />
<Import Project="$(SolutionDir)Properties\vcpkg.props" />
<Import Project="$(SolutionDir)Properties\common.props" />
<Import Project="$(SolutionDir)Properties\cef.props" />
</ImportGroup>
<ImportGroup Label="Shared Debug" Condition="'$(Configuration)'=='Debug'">
<Import Project="..\Properties\debug.props" />
<Import Project="$(SolutionDir)Properties\debug.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
Expand All @@ -80,54 +81,86 @@
<AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalOptions>-D_SCL_SECURE_NO_WARNINGS %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SFML_STATIC;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SFML_STATIC;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ProjectReference Include="..\SharedLibrary\SharedLibrary.vcxproj">
<Project>{7434416a-7972-4353-af2f-709a7eca887b}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Sources\Browser\BrowserControllerHandlers.cpp" />
<ClCompile Include="Sources\Browser\BrowserImpl.cpp" />
<ClCompile Include="Sources\Client.cpp" />
<ClCompile Include="Sources\Browser\BrowserControllerImpl.cpp" />
<ClCompile Include="Sources\Browser\BrowserHandlerImpl.cpp" />
<ClCompile Include="Sources\Graphics\Sprite.cpp" />
<ClCompile Include="Sources\Graphics\SpriteFactory.cpp" />
<ClCompile Include="Sources\Graphics\Texture.cpp" />
Expand All @@ -141,13 +174,14 @@
<ClCompile Include="Sources\Graphics\UI\UIModule\AuthUI.cpp" />
<ClCompile Include="Sources\Graphics\UI\UIModule\GameProcessUI.cpp" />
<ClCompile Include="Sources\Graphics\UI\UIModule\UIModule.cpp" />
<ClCompile Include="Sources\Graphics\UI\Widget\BrowserWidget.cpp" />
<ClCompile Include="Sources\Graphics\UI\Widget\Button.cpp" />
<ClCompile Include="Sources\Graphics\UI\Widget\Chat.cpp" />
<ClCompile Include="Sources\Graphics\UI\Widget\Console.cpp" />
<ClCompile Include="Sources\Graphics\UI\Widget\Container.cpp" />
<ClCompile Include="Sources\Graphics\UI\Widget\CustomWidget.cpp" />
<ClCompile Include="Sources\Graphics\UI\Widget\DynamicWidget.cpp" />
<ClCompile Include="Sources\Graphics\UI\Widget\Entry.cpp" />
<ClCompile Include="Sources\Graphics\UI\Widget\FormattedTextField.cpp" />
<ClCompile Include="Sources\Graphics\UI\Widget\GameProcess\TileContextMenu.cpp" />
<ClCompile Include="Sources\Graphics\UI\Widget\ImGuiWidget.cpp" />
<ClCompile Include="Sources\Graphics\UI\Widget\Label.cpp" />
Expand All @@ -159,7 +193,14 @@
<ClCompile Include="Sources\ResourceManager.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Sources\Browser\BrowserControllerHandlers.h" />
<ClInclude Include="Sources\Browser\BrowserImpl.h" />
<ClInclude Include="Sources\Client.hpp" />
<ClInclude Include="Sources\Browser\BrowserController.h" />
<ClInclude Include="Sources\Browser\BrowserControllerImpl.h" />
<ClInclude Include="Sources\Browser\Browser.h" />
<ClInclude Include="Sources\Browser\BrowserUI.h" />
<ClInclude Include="Sources\Browser\BrowserHandlerImpl.h" />
<ClInclude Include="Sources\Graphics\Sprite.hpp" />
<ClInclude Include="Sources\Graphics\SpriteFactory.h" />
<ClInclude Include="Sources\Graphics\SpriteInfo.h" />
Expand All @@ -176,13 +217,14 @@
<ClInclude Include="Sources\Graphics\UI\UIModule\AuthUI.hpp" />
<ClInclude Include="Sources\Graphics\UI\UIModule\GameProcessUI.hpp" />
<ClInclude Include="Sources\Graphics\UI\UIModule\UIModule.hpp" />
<ClInclude Include="Sources\Graphics\UI\Widget\BrowserWidget.h" />
<ClInclude Include="Sources\Graphics\UI\Widget\Button.hpp" />
<ClInclude Include="Sources\Graphics\UI\Widget\Chat.h" />
<ClInclude Include="Sources\Graphics\UI\Widget\Console.h" />
<ClInclude Include="Sources\Graphics\UI\Widget\Container.hpp" />
<ClInclude Include="Sources\Graphics\UI\Widget\CustomWidget.h" />
<ClInclude Include="Sources\Graphics\UI\Widget\DynamicWidget.h" />
<ClInclude Include="Sources\Graphics\UI\Widget\Entry.hpp" />
<ClInclude Include="Sources\Graphics\UI\Widget\FormattedTextField.hpp" />
<ClInclude Include="Sources\Graphics\UI\Widget\GameProcess\TileContextMenu.h" />
<ClInclude Include="Sources\Graphics\UI\Widget\ImGuiWidget.h" />
<ClInclude Include="Sources\Graphics\UI\Widget\Label.hpp" />
Expand All @@ -194,7 +236,17 @@
<ClInclude Include="Sources\Network\SyncCommandsProcessor.h" />
<ClInclude Include="Sources\ResourceManager.hpp" />
</ItemGroup>
<ItemGroup>
<Manifest Include="OSS13 Client.exe.manifest" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

<ItemGroup>
<CefResources Include="$(SolutionDir)\External\cef\windows-bin\Resources\**\*.pak"/>
</ItemGroup>
<Target Name="Build">
<Copy SourceFiles="@(CefResources)" DestinationFiles="@(CefResources->'$(SolutionDir)\Resources\Browser\%(RecursiveDir)%(Filename)%(Extension)')"/>
</Target>
</Project>
54 changes: 48 additions & 6 deletions OSS13 Client/OSS13 Client.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
<ClCompile Include="Sources\Graphics\UI\Widget\Entry.cpp">
<Filter>Файлы исходного кода</Filter>
</ClCompile>
<ClCompile Include="Sources\Graphics\UI\Widget\FormattedTextField.cpp">
<Filter>Файлы исходного кода</Filter>
</ClCompile>
<ClCompile Include="Sources\Graphics\UI\Widget\ImGuiWidget.cpp">
<Filter>Файлы исходного кода</Filter>
</ClCompile>
Expand Down Expand Up @@ -105,6 +102,24 @@
<ClCompile Include="Sources\Network\SyncCommandsProcessor.cpp">
<Filter>Файлы исходного кода</Filter>
</ClCompile>
<ClCompile Include="Sources\Graphics\UI\Widget\BrowserWidget.cpp">
<Filter>Файлы исходного кода</Filter>
</ClCompile>
<ClCompile Include="Sources\Browser\BrowserControllerImpl.cpp">
<Filter>Файлы исходного кода</Filter>
</ClCompile>
<ClCompile Include="Sources\Browser\BrowserControllerHandlers.cpp">
<Filter>Файлы исходного кода</Filter>
</ClCompile>
<ClCompile Include="Sources\Browser\BrowserHandlerImpl.cpp">
<Filter>Файлы исходного кода</Filter>
</ClCompile>
<ClCompile Include="Sources\Browser\BrowserImpl.cpp">
<Filter>Файлы исходного кода</Filter>
</ClCompile>
<ClCompile Include="Sources\Graphics\UI\Widget\Chat.cpp">
<Filter>Файлы исходного кода</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Sources\Graphics\TileGrid\Block.hpp">
Expand Down Expand Up @@ -143,9 +158,6 @@
<ClInclude Include="Sources\Graphics\UI\Widget\Entry.hpp">
<Filter>Заголовочные файлы</Filter>
</ClInclude>
<ClInclude Include="Sources\Graphics\UI\Widget\FormattedTextField.hpp">
<Filter>Заголовочные файлы</Filter>
</ClInclude>
<ClInclude Include="Sources\Graphics\UI\Widget\ImGuiWidget.h">
<Filter>Заголовочные файлы</Filter>
</ClInclude>
Expand Down Expand Up @@ -209,5 +221,35 @@
<ClInclude Include="Sources\Network\SyncCommandsProcessor.h">
<Filter>Заголовочные файлы</Filter>
</ClInclude>
<ClInclude Include="Sources\Graphics\UI\Widget\BrowserWidget.h">
<Filter>Заголовочные файлы</Filter>
</ClInclude>
<ClInclude Include="Sources\Browser\Browser.h">
<Filter>Заголовочные файлы</Filter>
</ClInclude>
<ClInclude Include="Sources\Browser\BrowserController.h">
<Filter>Заголовочные файлы</Filter>
</ClInclude>
<ClInclude Include="Sources\Browser\BrowserControllerImpl.h">
<Filter>Заголовочные файлы</Filter>
</ClInclude>
<ClInclude Include="Sources\Browser\BrowserUI.h">
<Filter>Заголовочные файлы</Filter>
</ClInclude>
<ClInclude Include="Sources\Browser\BrowserControllerHandlers.h">
<Filter>Заголовочные файлы</Filter>
</ClInclude>
<ClInclude Include="Sources\Browser\BrowserHandlerImpl.h">
<Filter>Заголовочные файлы</Filter>
</ClInclude>
<ClInclude Include="Sources\Browser\BrowserImpl.h">
<Filter>Заголовочные файлы</Filter>
</ClInclude>
<ClInclude Include="Sources\Graphics\UI\Widget\Chat.h">
<Filter>Заголовочные файлы</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Manifest Include="OSS13 Client.exe.manifest" />
</ItemGroup>
</Project>
23 changes: 23 additions & 0 deletions OSS13 Client/Sources/Browser/Browser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once

#include <memory>

#include <SFML/Window/Event.hpp>

#include <Shared/Geometry/Vec2.hpp>
#include <Shared/IFaces/IFace.h>

struct Browser : public IFace
{
// set content in HTML format
virtual void SetContent(const std::string& content) = 0;

virtual bool OnMouseButtonPressed(sf::Mouse::Button button, uf::vec2i position) = 0;
virtual bool OnMouseButtonReleased(sf::Mouse::Button button, uf::vec2i position) = 0;
virtual bool OnMouseMoved(uf::vec2i position) = 0;
virtual bool OnMouseLeft() = 0;
virtual bool OnMouseWheelScrolled(float delta, uf::vec2i position) = 0;
virtual bool OnKeyPressed(sf::Event::KeyEvent keyEvent) = 0;
virtual bool OnKeyReleased(sf::Event::KeyEvent keyEvent) = 0;
virtual bool OnTextEntered(uint32_t unicodeChar) = 0;
};
21 changes: 21 additions & 0 deletions OSS13 Client/Sources/Browser/BrowserController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#pragma once

#include <filesystem>

#include <Shared/IFaces/IFace.h>

#include <Browser/Browser.h>
#include <Browser/BrowserUI.h>

struct BrowserController : public IFace
{
virtual void Initialize(const std::filesystem::path &executablePath) = 0;
virtual void Update() = 0;
virtual void Shutdown() = 0;
virtual bool CanBeReleased() = 0;

virtual Browser &CreateBrowser(BrowserUI &ui) = 0;
virtual void CloseBrowser(Browser* browser) = 0;
};

std::unique_ptr<BrowserController> CreateBrowserConroller();
14 changes: 14 additions & 0 deletions OSS13 Client/Sources/Browser/BrowserControllerHandlers.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "BrowserControllerHandlers.h"

#include "BrowserControllerImpl.h"

BrowserControllerHandlers::BrowserControllerHandlers(BrowserControllerImpl& browserController) :
browserController(browserController)
{ }

CefRefPtr<CefBrowserProcessHandler> BrowserControllerHandlers::GetBrowserProcessHandler() {
return this;
}

void BrowserControllerHandlers::OnContextInitialized()
{ }
24 changes: 24 additions & 0 deletions OSS13 Client/Sources/Browser/BrowserControllerHandlers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#pragma once

#include <cef_app.h>
#include <cef_base.h>

class BrowserControllerImpl;

class BrowserControllerHandlers :
public CefApp,
public CefBrowserProcessHandler
{
public:
BrowserControllerHandlers(BrowserControllerImpl &browserController);

// CefApp
CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() final;

// CefBrowserProcessHandler
void OnContextInitialized() final;

private:
BrowserControllerImpl& browserController;
IMPLEMENT_REFCOUNTING(BrowserControllerHandlers);
};
Loading

0 comments on commit 4c69fec

Please sign in to comment.