Skip to content

Commit

Permalink
Restructured V8 bindings.
Browse files Browse the repository at this point in the history
  • Loading branch information
feiy committed Dec 21, 2023
1 parent c246194 commit 2f61810
Show file tree
Hide file tree
Showing 176 changed files with 5,748 additions and 4,783 deletions.
4 changes: 3 additions & 1 deletion QGameDev/XMLEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <QJsonDocument>
#include <QJsonArray>
#include <QMenu>
#include <utils/Logging.h>
#include "XMLEditor.h"
#include "JsonUtils.h"
#include "FogTuner.h"
Expand Down Expand Up @@ -215,8 +216,9 @@ void XMLEditor::OnInit()
QString path = QCoreApplication::applicationFilePath();
std::string cpath = path.toLocal8Bit().toStdString();
m_game_player = std::unique_ptr<GamePlayer>(new GamePlayer(cpath.c_str(), width, height));
m_game_player->SetPrintCallbacks(this, print_std, err_std);
m_game_player->SetUserMessageCallback(this, user_message_callback);

Logging::SetPrintCallbacks(this, print_std, err_std);

QString local_path = QCoreApplication::applicationDirPath();
QString script_filename = local_path + "\\xmleditor\\bundle_index.js";
Expand Down
4 changes: 2 additions & 2 deletions QGamePlayer/PlayerWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <QJsonArray>
#include <QMouseEvent>
#include <QWindow>
#include <utils/Logging.h>
#include "PlayerWindow.h"

PlayerWindow::PlayerWindow(const char* path_proj, int idx)
Expand Down Expand Up @@ -100,8 +101,7 @@ void PlayerWindow::OnInit()
QString path = QCoreApplication::applicationFilePath();
std::string cpath = path.toLocal8Bit().toStdString();
m_game_player = std::unique_ptr<GamePlayer>(new GamePlayer(cpath.c_str(), width, height));
m_game_player->SetPrintCallbacks(this, print_std, err_std);

Logging::SetPrintCallbacks(this, print_std, err_std);
LoadScript(m_script_path);
}

Expand Down
31 changes: 9 additions & 22 deletions Test.V8/Test.V8.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{67d5cd91-a728-4719-8e9c-8610cf661ceb}</ProjectGuid>
<ProjectGuid>{6b0a2bfb-78bb-4361-ab30-47873ab0b9dd}</ProjectGuid>
<RootNamespace>TestV8</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
Expand Down Expand Up @@ -72,18 +72,6 @@
<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>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
Expand Down Expand Up @@ -132,8 +120,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS; GLEW_STATIC=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>../thirdparty;../ThreeEngine; ../thirdparty/glew/include; ../thirdparty/glm/glm; ../Three.V8;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>../thirdparty;../ThreeEngine;../thirdparty/glew/include;../thirdparty/glm/glm;../Three.V8;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand All @@ -145,35 +132,35 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="GLMain.cpp" />
<ClCompile Include="main.cpp" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Three.V8\Three.V8.vcxproj">
<Project>{ccbe3960-dad2-49af-952f-a8a86d75f190}</Project>
<Project>{9123b047-fce7-4474-9826-c6bbbe4fe4c7}</Project>
</ProjectReference>
<ProjectReference Include="..\ThreeEngine\ThreeEngine.vcxproj">
<Project>{030c6452-10bf-48a4-b80f-0d4a996b83ae}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClInclude Include="GLMain.h" />
<ClCompile Include="GLMain.cpp" />
<ClCompile Include="main.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<ClInclude Include="GLMain.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\FFmpeg.Nightly.20200831.1.0\build\native\FFmpeg.Nightly.targets" Condition="Exists('..\packages\FFmpeg.Nightly.20200831.1.0\build\native\FFmpeg.Nightly.targets')" />
<Import Project="..\packages\boost.1.84.0\build\boost.targets" Condition="Exists('..\packages\boost.1.84.0\build\boost.targets')" />
<Import Project="..\packages\FFmpeg.Nightly.20200831.1.0\build\native\FFmpeg.Nightly.targets" Condition="Exists('..\packages\FFmpeg.Nightly.20200831.1.0\build\native\FFmpeg.Nightly.targets')" />
<Import Project="..\packages\zeroc.openssl.v143.1.1.1.3\build\native\zeroc.openssl.v143.targets" Condition="Exists('..\packages\zeroc.openssl.v143.1.1.1.3\build\native\zeroc.openssl.v143.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\FFmpeg.Nightly.20200831.1.0\build\native\FFmpeg.Nightly.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\FFmpeg.Nightly.20200831.1.0\build\native\FFmpeg.Nightly.targets'))" />
<Error Condition="!Exists('..\packages\boost.1.84.0\build\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost.1.84.0\build\boost.targets'))" />
<Error Condition="!Exists('..\packages\FFmpeg.Nightly.20200831.1.0\build\native\FFmpeg.Nightly.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\FFmpeg.Nightly.20200831.1.0\build\native\FFmpeg.Nightly.targets'))" />
<Error Condition="!Exists('..\packages\v8.redist-v143-x64.11.9.169.4\build\native\v8.redist-v143-x64.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\v8.redist-v143-x64.11.9.169.4\build\native\v8.redist-v143-x64.props'))" />
<Error Condition="!Exists('..\packages\v8-v143-x64.11.9.169.4\build\native\v8-v143-x64.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\v8-v143-x64.11.9.169.4\build\native\v8-v143-x64.props'))" />
<Error Condition="!Exists('..\packages\zeroc.openssl.v143.1.1.1.3\build\native\zeroc.openssl.v143.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\zeroc.openssl.v143.1.1.1.3\build\native\zeroc.openssl.v143.targets'))" />
Expand Down
6 changes: 3 additions & 3 deletions Test.V8/Test.V8.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
Expand All @@ -27,7 +30,4 @@
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Test.V8/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class AppMain : private GLMain
int main(int argc, const char* argv[])
{
AppMain app(argv[0]);
app.LoadScript("../game", "bundle_http_test.js");
app.LoadScript("../game", "bundle_game.js");
app.MainLoop();
return 0;
}
52 changes: 28 additions & 24 deletions Three.V8.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ VisualStudioVersion = 17.3.32901.215
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ThreeEngine", "ThreeEngine\ThreeEngine.vcxproj", "{030C6452-10BF-48A4-B80F-0D4A996B83AE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Three.V8", "Three.V8\Three.V8.vcxproj", "{CCBE3960-DAD2-49AF-952F-A8A86D75F190}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test.Cpp", "Test.Cpp\Test.Cpp.vcxproj", "{3F00C726-809A-4269-9281-33B6AACE99F9}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test.V8", "Test.V8\Test.V8.vcxproj", "{67D5CD91-A728-4719-8E9C-8610CF661CEB}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ThreeMM", "ThreeMM\ThreeMM.vcxproj", "{7F3BB2FF-13E9-45A0-B8E3-F663FC651EFD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Lightmapper", "Lightmapper\Lightmapper.vcxproj", "{CD28457C-63C3-43E9-8C91-A015D91B7B49}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LightmapCompressor", "LightmapCompressor\LightmapCompressor.vcxproj", "{BE12DD92-F55E-4138-8755-A62107C35182}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Three.V8", "Three.V8\Three.V8.vcxproj", "{9123B047-FCE7-4474-9826-C6BBBE4FE4C7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test.V8", "Test.V8\Test.V8.vcxproj", "{6B0A2BFB-78BB-4361-AB30-47873AB0B9DD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -37,16 +37,6 @@ Global
{030C6452-10BF-48A4-B80F-0D4A996B83AE}.Release|x64.Build.0 = Release|x64
{030C6452-10BF-48A4-B80F-0D4A996B83AE}.Release|x86.ActiveCfg = Release|Win32
{030C6452-10BF-48A4-B80F-0D4A996B83AE}.Release|x86.Build.0 = Release|Win32
{CCBE3960-DAD2-49AF-952F-A8A86D75F190}.Debug|Any CPU.ActiveCfg = Debug|Win32
{CCBE3960-DAD2-49AF-952F-A8A86D75F190}.Debug|x64.ActiveCfg = Debug|x64
{CCBE3960-DAD2-49AF-952F-A8A86D75F190}.Debug|x64.Build.0 = Debug|x64
{CCBE3960-DAD2-49AF-952F-A8A86D75F190}.Debug|x86.ActiveCfg = Debug|Win32
{CCBE3960-DAD2-49AF-952F-A8A86D75F190}.Debug|x86.Build.0 = Debug|Win32
{CCBE3960-DAD2-49AF-952F-A8A86D75F190}.Release|Any CPU.ActiveCfg = Release|Win32
{CCBE3960-DAD2-49AF-952F-A8A86D75F190}.Release|x64.ActiveCfg = Release|x64
{CCBE3960-DAD2-49AF-952F-A8A86D75F190}.Release|x64.Build.0 = Release|x64
{CCBE3960-DAD2-49AF-952F-A8A86D75F190}.Release|x86.ActiveCfg = Release|Win32
{CCBE3960-DAD2-49AF-952F-A8A86D75F190}.Release|x86.Build.0 = Release|Win32
{3F00C726-809A-4269-9281-33B6AACE99F9}.Debug|Any CPU.ActiveCfg = Debug|Win32
{3F00C726-809A-4269-9281-33B6AACE99F9}.Debug|x64.ActiveCfg = Debug|x64
{3F00C726-809A-4269-9281-33B6AACE99F9}.Debug|x64.Build.0 = Debug|x64
Expand All @@ -57,16 +47,6 @@ Global
{3F00C726-809A-4269-9281-33B6AACE99F9}.Release|x64.Build.0 = Release|x64
{3F00C726-809A-4269-9281-33B6AACE99F9}.Release|x86.ActiveCfg = Release|Win32
{3F00C726-809A-4269-9281-33B6AACE99F9}.Release|x86.Build.0 = Release|Win32
{67D5CD91-A728-4719-8E9C-8610CF661CEB}.Debug|Any CPU.ActiveCfg = Debug|Win32
{67D5CD91-A728-4719-8E9C-8610CF661CEB}.Debug|x64.ActiveCfg = Debug|x64
{67D5CD91-A728-4719-8E9C-8610CF661CEB}.Debug|x64.Build.0 = Debug|x64
{67D5CD91-A728-4719-8E9C-8610CF661CEB}.Debug|x86.ActiveCfg = Debug|Win32
{67D5CD91-A728-4719-8E9C-8610CF661CEB}.Debug|x86.Build.0 = Debug|Win32
{67D5CD91-A728-4719-8E9C-8610CF661CEB}.Release|Any CPU.ActiveCfg = Release|Win32
{67D5CD91-A728-4719-8E9C-8610CF661CEB}.Release|x64.ActiveCfg = Release|x64
{67D5CD91-A728-4719-8E9C-8610CF661CEB}.Release|x64.Build.0 = Release|x64
{67D5CD91-A728-4719-8E9C-8610CF661CEB}.Release|x86.ActiveCfg = Release|Win32
{67D5CD91-A728-4719-8E9C-8610CF661CEB}.Release|x86.Build.0 = Release|Win32
{7F3BB2FF-13E9-45A0-B8E3-F663FC651EFD}.Debug|Any CPU.ActiveCfg = Debug|x64
{7F3BB2FF-13E9-45A0-B8E3-F663FC651EFD}.Debug|Any CPU.Build.0 = Debug|x64
{7F3BB2FF-13E9-45A0-B8E3-F663FC651EFD}.Debug|x64.ActiveCfg = Debug|x64
Expand Down Expand Up @@ -103,6 +83,30 @@ Global
{BE12DD92-F55E-4138-8755-A62107C35182}.Release|x64.Build.0 = Release|x64
{BE12DD92-F55E-4138-8755-A62107C35182}.Release|x86.ActiveCfg = Release|Win32
{BE12DD92-F55E-4138-8755-A62107C35182}.Release|x86.Build.0 = Release|Win32
{9123B047-FCE7-4474-9826-C6BBBE4FE4C7}.Debug|Any CPU.ActiveCfg = Debug|x64
{9123B047-FCE7-4474-9826-C6BBBE4FE4C7}.Debug|Any CPU.Build.0 = Debug|x64
{9123B047-FCE7-4474-9826-C6BBBE4FE4C7}.Debug|x64.ActiveCfg = Debug|x64
{9123B047-FCE7-4474-9826-C6BBBE4FE4C7}.Debug|x64.Build.0 = Debug|x64
{9123B047-FCE7-4474-9826-C6BBBE4FE4C7}.Debug|x86.ActiveCfg = Debug|Win32
{9123B047-FCE7-4474-9826-C6BBBE4FE4C7}.Debug|x86.Build.0 = Debug|Win32
{9123B047-FCE7-4474-9826-C6BBBE4FE4C7}.Release|Any CPU.ActiveCfg = Release|x64
{9123B047-FCE7-4474-9826-C6BBBE4FE4C7}.Release|Any CPU.Build.0 = Release|x64
{9123B047-FCE7-4474-9826-C6BBBE4FE4C7}.Release|x64.ActiveCfg = Release|x64
{9123B047-FCE7-4474-9826-C6BBBE4FE4C7}.Release|x64.Build.0 = Release|x64
{9123B047-FCE7-4474-9826-C6BBBE4FE4C7}.Release|x86.ActiveCfg = Release|Win32
{9123B047-FCE7-4474-9826-C6BBBE4FE4C7}.Release|x86.Build.0 = Release|Win32
{6B0A2BFB-78BB-4361-AB30-47873AB0B9DD}.Debug|Any CPU.ActiveCfg = Debug|x64
{6B0A2BFB-78BB-4361-AB30-47873AB0B9DD}.Debug|Any CPU.Build.0 = Debug|x64
{6B0A2BFB-78BB-4361-AB30-47873AB0B9DD}.Debug|x64.ActiveCfg = Debug|x64
{6B0A2BFB-78BB-4361-AB30-47873AB0B9DD}.Debug|x64.Build.0 = Debug|x64
{6B0A2BFB-78BB-4361-AB30-47873AB0B9DD}.Debug|x86.ActiveCfg = Debug|Win32
{6B0A2BFB-78BB-4361-AB30-47873AB0B9DD}.Debug|x86.Build.0 = Debug|Win32
{6B0A2BFB-78BB-4361-AB30-47873AB0B9DD}.Release|Any CPU.ActiveCfg = Release|x64
{6B0A2BFB-78BB-4361-AB30-47873AB0B9DD}.Release|Any CPU.Build.0 = Release|x64
{6B0A2BFB-78BB-4361-AB30-47873AB0B9DD}.Release|x64.ActiveCfg = Release|x64
{6B0A2BFB-78BB-4361-AB30-47873AB0B9DD}.Release|x64.Build.0 = Release|x64
{6B0A2BFB-78BB-4361-AB30-47873AB0B9DD}.Release|x86.ActiveCfg = Release|Win32
{6B0A2BFB-78BB-4361-AB30-47873AB0B9DD}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Loading

0 comments on commit 2f61810

Please sign in to comment.