Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added base framework

  • Loading branch information...
commit be469cef43d8372455b2f2a06c21a45ae155ae89 1 parent bd2789e
Sam Neirinck authored
1  inc/.gitignore
View
@@ -0,0 +1 @@
+awesomium/
64 src/Awesomium-CE3/AwesomiumCE3/Awesomium.cpp
View
@@ -0,0 +1,64 @@
+#include "stdafx.h"
+#include "Awesomium.h"
+
+#include <Awesomium/awesomium_capi.h>
+
+CRYREGISTER_CLASS(CAwesomium)
+
+CAwesomium::CAwesomium()
+{
+
+}
+
+CAwesomium::~CAwesomium()
+{
+
+}
+
+bool CAwesomium::Init(bool enablePlugins)
+{
+ if (!gEnv || gEnv->pGameFramework)
+ {
+ gEnv->pLog->LogError("Failed to initialize Awesomium, no gameframework found. This is probably caused by calling the Init method too soon");
+ return false;
+ }
+
+ gEnv->pGameFramework->RegisterListener(this, "AwesomiumCE3", FRAMEWORKLISTENERPRIORITY_HUD);
+
+ awe_webcore_initialize(enablePlugins, true, false, awe_string_empty(), awe_string_empty(),awe_string_empty(),
+ AWE_LL_NORMAL, false, awe_string_empty(), true, awe_string_empty(), awe_string_empty(), awe_string_empty(),
+ awe_string_empty(), awe_string_empty(), awe_string_empty(), true, 0, false, false, awe_string_empty());
+
+ return true;
+}
+
+void CAwesomium::Shutdown()
+{
+
+}
+
+void CAwesomium::OnPostUpdate(float fDeltaTime)
+{
+
+}
+
+void CAwesomium::OnSaveGame(ISaveGame* pSaveGame)
+{
+
+}
+
+void CAwesomium::OnLoadGame(ILoadGame* pLoadGame)
+{
+}
+
+void CAwesomium::OnLevelEnd(const char* nextLevel)
+{
+}
+
+void CAwesomium::OnActionEvent(const SActionEvent& event)
+{
+}
+
+void CAwesomium::OnPreRender()
+{
+}
34 src/Awesomium-CE3/AwesomiumCE3/Awesomium.h
View
@@ -0,0 +1,34 @@
+#pragma once
+#include "Headers/IAwesomium.h"
+
+#include <CryExtension/Impl/ClassWeaver.h>
+#include <IGameFramework.h>
+
+class CAwesomium : public IAwesomium, public IGameFrameworkListener
+{
+ CRYINTERFACE_BEGIN()
+ CRYINTERFACE_ADD(IAwesomium)
+ CRYINTERFACE_END()
+
+ CRYGENERATE_SINGLETONCLASS(CAwesomium, "Awesomium", 0x0, 0x1)
+
+public:
+ // IAwesomium interface
+ virtual bool Init(bool enablePlugins) override;
+ virtual void Shutdown() override;
+ // -IAwesomium
+
+ // IGameFrameworkListener
+ virtual void OnPostUpdate(float fDeltaTime) override;
+ virtual void OnSaveGame(ISaveGame* pSaveGame) override;
+ virtual void OnLoadGame(ILoadGame* pLoadGame) override;
+ virtual void OnLevelEnd(const char* nextLevel) override;
+ virtual void OnActionEvent(const SActionEvent& event) override;
+ virtual void OnPreRender() override;
+ // -IGameFrameworkListener
+
+
+
+protected:
+ bool m_bEnablePlugins;
+};
20 src/Awesomium-CE3/AwesomiumCE3/AwesomiumCE3.sln
View
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 11
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AwesomiumCE3", "AwesomiumCE3.vcxproj", "{94C5317A-1028-4C06-B74D-FFBF22847C5E}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {94C5317A-1028-4C06-B74D-FFBF22847C5E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {94C5317A-1028-4C06-B74D-FFBF22847C5E}.Debug|Win32.Build.0 = Debug|Win32
+ {94C5317A-1028-4C06-B74D-FFBF22847C5E}.Release|Win32.ActiveCfg = Release|Win32
+ {94C5317A-1028-4C06-B74D-FFBF22847C5E}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
98 src/Awesomium-CE3/AwesomiumCE3/AwesomiumCE3.vcxproj
View
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and '$(VisualStudioVersion)' == ''">$(VCTargetsPath11)</VCTargetsPath>
+ </PropertyGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{94C5317A-1028-4C06-B74D-FFBF22847C5E}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>AwesomiumCE3</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v100</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v100</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(SolutionDir)..\output\bin32\</OutDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(SolutionDir)..\output\bin32\</OutDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>Create</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;AWESOMIUMCE3_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(ProjectDir)..\..\..\inc\awesomium;$(ProjectDir)..\..\..\inc\stlport;$(ProjectDir)..\..\..\inc\boost;$(ProjectDir)..\..\..\inc\cryengine\CryCommon;$(ProjectDir)..\..\..\inc\cryengine\CryAction;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalLibraryDirectories>$(ProjectDir)..\..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>Awesomium_d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;AWESOMIUMCE3_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(ProjectDir)\..\..\inc\stlport;$(ProjectDir)\..\..\inc\boost;$(ProjectDir)\..\..\cryengine\CryCommon;$(ProjectDir)\..\..\cryengine\CryAction;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="Awesomium.h" />
+ <ClInclude Include="Headers\IAwesomium.h" />
+ <ClInclude Include="stdafx.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="Awesomium.cpp" />
+ <ClCompile Include="stdafx.cpp" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
19 src/Awesomium-CE3/AwesomiumCE3/AwesomiumCE3.vcxproj.filters
View
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <ClInclude Include="stdafx.h" />
+ <ClInclude Include="Awesomium.h" />
+ <ClInclude Include="Headers\IAwesomium.h">
+ <Filter>Headers</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="stdafx.cpp" />
+ <ClCompile Include="Awesomium.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="Headers">
+ <UniqueIdentifier>{ee9ef1b5-bfab-4d8e-915e-cc17aa9cbac5}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+</Project>
14 src/Awesomium-CE3/AwesomiumCE3/Headers/IAwesomium.h
View
@@ -0,0 +1,14 @@
+#pragma once
+
+#include <CryExtension/ICryUnknown.h>
+
+
+struct IAwesomium : public ICryUnknown
+{
+ CRYINTERFACE_DECLARE(IAwesomium, 0x0, 0x1)
+
+ virtual bool Init(bool enablePlugins) = 0;
+ virtual void Shutdown() = 0;
+};
+
+typedef boost::shared_ptr<IAwesomium> IAwesomiumPtr;
2  src/Awesomium-CE3/AwesomiumCE3/stdafx.cpp
View
@@ -0,0 +1,2 @@
+#include "stdafx.h"
+#include <platform_impl.h>
68 src/Awesomium-CE3/AwesomiumCE3/stdafx.h
View
@@ -0,0 +1,68 @@
+#pragma once
+
+#include <CryModuleDefs.h>
+
+// Insert your headers here
+#include <platform.h>
+#include <algorithm>
+#include <vector>
+#include <memory>
+#include <list>
+#include <functional>
+#include <limits>
+
+#include <smartptr.h>
+
+#include <CryThread.h>
+#include <Cry_Math.h>
+#include <ISystem.h>
+#include <I3DEngine.h>
+#include <IInput.h>
+#include <IConsole.h>
+#include <ITimer.h>
+#include <ILog.h>
+#include <IGameplayRecorder.h>
+#include <ISerialize.h>
+
+#ifndef GAMEDLL_EXPORTS
+#define GAMEDLL_EXPORTS
+#endif
+
+#ifdef GAMEDLL_EXPORTS
+#define GAME_API DLL_EXPORT
+#else
+#define GAME_API
+#endif
+
+#pragma warning(disable: 4018) // conditional expression is constant
+
+//////////////////////////////////////////////////////////////////////////
+//! Reports a Game Warning to validator with WARNING severity.
+inline void GameWarning( const char *format,... ) PRINTF_PARAMS(1, 2);
+inline void GameWarning( const char *format,... )
+{
+ if (!format)
+ return;
+ va_list args;
+ va_start(args, format);
+ GetISystem()->WarningV( VALIDATOR_MODULE_GAME,VALIDATOR_WARNING,0,NULL,format,args );
+ va_end(args);
+}
+
+extern struct SCVars *g_pGameCVars;
+
+#define PLAYER_REFACTORING 1
+
+//---------------------------------------------------------------------
+inline float LinePointDistanceSqr(const Line& line, const Vec3& point, float zScale = 1.0f)
+{
+ Vec3 x0=point;
+ Vec3 x1=line.pointonline;
+ Vec3 x2=line.pointonline+line.direction;
+
+ x0.z*=zScale;
+ x1.z*=zScale;
+ x2.z*=zScale;
+
+ return ((x2-x1).Cross(x1-x0)).GetLengthSquared()/(x2-x1).GetLengthSquared();
+}
Please sign in to comment.
Something went wrong with that request. Please try again.