diff --git a/ADVect/ADVect.cpp b/ADVect/ADVect.cpp index 2d60b5d..83b2463 100644 --- a/ADVect/ADVect.cpp +++ b/ADVect/ADVect.cpp @@ -3,11 +3,11 @@ #include "Graphics.h" #include "Track.h" -#include -#include -#include +#include +#include +#include #include -#include +#include #include #include @@ -33,12 +33,12 @@ namespace { u32 current_scene = 0; u32 scene_pos = 0; - ADVect::MarkupTextTransitionTrack m_text{ + ADVect::MarkupTextTransitionTrack m_text{ .current{}, .pos_x = 280, .pos_y = 90, .w = 800, .h = 500, .opacity = 1.0f, .fill = 0xFFFFFFFF }; - ADVect::TextTrack speaker = { + ADVect::TextTrack speaker = { .current{}, .pos_x = 250, .pos_y = 150, .w = 500, .h = 500, @@ -93,6 +93,7 @@ namespace ADVect { bgfxInit.platformData.nwh = wmi.info.win.window; #elif BX_PLATFORM_OSX bgfxInit.platformData.nwh = wmi.info.cocoa.window; + bgfx::renderFrame(); #elif BX_PLATFORM_LINUX bgfxInit.platformData.ndt = wmi.info.x11.display; bgfxInit.platformData.nwh = (void*)(uintptr_t)wmi.info.x11.window; @@ -248,7 +249,8 @@ namespace ADVect { } int main(int argc, char* argv[]) { - std::filesystem::current_path("E:\\Archive\\Projects\\NouVeL\\ADVect\\runtime"); +// std::filesystem::current_path("E:\\Archive\\Projects\\NouVeL\\ADVect\\runtime"); + std::filesystem::current_path("/Users/lachrymal/Projects/NouVeL/ADVect/runtime/"); NVL::Environment::ENVIRONMENT.enter({ { @@ -291,7 +293,30 @@ int main(int argc, char* argv[]) { { u"Show", NVL::Environment::Variable([](std::vector args) { +<<<<<<< HEAD std::get)>>(args[0].value)({args[1]}); +======= + std::string name = NVL::to_std_string(std::get(NVL::Environment::Variable(args[0]).value)); +/* NamedImageTrack* t = find_image_track(name); + if (t == nullptr) { + std::cerr << "ADV: Cannot find ImageTrack " << name << std::endl; + } + else { + auto s = std::get(NVL::Environment::Variable(args[1]).value); + auto s2 = NVL::to_std_string(s); + t->current = ADVect::Graphics::GetImageTextureFromFile(s2); + }*/ + if (name == "BG") + bg.change(current_time, ADVect::Graphics::GetImageTextureFromFile(NVL::to_std_string(std::get(NVL::Environment::Variable(args[1]).value))), 200); +// bg.current = ADVect::Graphics::GetImageTextureFromFile(NVL::to_std_string(std::get(NVL::Environment::Variable(args[1]).value))); + else if (name == "Avatar") + avatar.change(current_time, ADVect::Graphics::GetImageTextureFromFile(NVL::to_std_string(std::get(NVL::Environment::Variable(args[1]).value))), 200); +// avatar.current = ADVect::Graphics::GetImageTextureFromFile(NVL::to_std_string(std::get(NVL::Environment::Variable(args[1]).value))); + else if (name == "BGDialogue") + dialogue_bg.current = ADVect::Graphics::GetImageTextureFromFile(NVL::to_std_string(std::get(NVL::Environment::Variable(args[1]).value))); + else + std::cerr << "ADV: Cannot find ImageTrack " << name << std::endl; +>>>>>>> 93b8864834b77391f0c1ea7fc0007f6110d69a5a return NVL::Environment::Type::Nil; }, 2) } diff --git a/ADVect/CMakeLists.txt b/ADVect/CMakeLists.txt index 32d9ffc..37a427a 100644 --- a/ADVect/CMakeLists.txt +++ b/ADVect/CMakeLists.txt @@ -14,7 +14,11 @@ add_subdirectory("ext/bgfx") if (WIN32) include_directories("include_windows") target_link_libraries (Game PRIVATE ${PROJECT_SOURCE_DIR}/lib/SDL2.lib ${PROJECT_SOURCE_DIR}/lib/SDL2main.lib NVL freetype bgfx bx) +elseif (APPLE) + set_target_properties(Game PROPERTIES XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") + find_package(SDL2 REQUIRED) + target_link_libraries (Game PRIVATE NVL freetype bgfx bx SDL2::SDL2) else () find_package(SDL2 REQUIRED) target_link_libraries (Game PRIVATE NVL freetype bgfx bx SDL2::SDL2 SDL2::SDL2main) -endif () \ No newline at end of file +endif () diff --git a/ADVect/Graphics.h b/ADVect/Graphics.h index 128510b..6583a45 100644 --- a/ADVect/Graphics.h +++ b/ADVect/Graphics.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include diff --git a/ADVect/Track.h b/ADVect/Track.h index 2b35fd9..febaea8 100644 --- a/ADVect/Track.h +++ b/ADVect/Track.h @@ -35,21 +35,28 @@ namespace ADVect { template struct Track { std::conditional_t current{}; - [[no_unique_address]] std::conditional_t name{}; +// [[no_unique_address]] std::conditional_t name{}; + std::conditional_t name{}; - // Visual - [[no_unique_address]] std::conditional_t pos_x{}, pos_y{}; - [[no_unique_address]] std::conditional_t w{}, h{}; - [[no_unique_address]] std::conditional_t opacity{}; + // Visual +// [[no_unique_address]] std::conditional_t pos_x{}, pos_y{}; +// [[no_unique_address]] std::conditional_t w{}, h{}; +// [[no_unique_address]] std::conditional_t opacity{}; + std::conditional_t pos_x{}, pos_y{}; + std::conditional_t w{}, h{}; + std::conditional_t opacity{}; // TODO other transforms // Fill static_assert(IsVisual || !IsVisualFill, "Track cannot have fill unless visual"); - [[no_unique_address]] std::conditional_t fill{}; - - // Transition, with assumption that we need to access the original when transition is underway - [[no_unique_address]] std::conditional_t, std::monostate> next{}; - [[no_unique_address]] std::conditional_t, std::monostate> transition{}; +// [[no_unique_address]] std::conditional_t fill{}; + std::conditional_t fill{}; + + // Transition, with assumption that we need to access the original when transition is underway +// [[no_unique_address]] std::conditional_t, std::monostate> next{}; +// [[no_unique_address]] std::conditional_t, std::monostate> transition{}; + std::conditional_t, std::monostate> next{}; + std::conditional_t, std::monostate> transition{}; void check(u64 current_time) requires HasTransition { if constexpr (UsePointer) { if (next != nullptr && transition.check(current_time)) { @@ -125,7 +132,7 @@ namespace ADVect { ADVect::Graphics::DrawTextureImageAlpha(*t.next, t.pos_x, t.pos_y, t.transition.get(current_time)); } else { - ADVect::Graphics::DrawTextureImage(*t.current, t.pos_x, t.pos_y); + ADVect::Graphics::DrawTextureImageAlpha(*t.current, t.pos_x, t.pos_y, 1.0f); } } } diff --git a/ADVect/runtime/dante_ch.nvl b/ADVect/runtime/dante_ch.nvl index c03922b..ccad646 100644 --- a/ADVect/runtime/dante_ch.nvl +++ b/ADVect/runtime/dante_ch.nvl @@ -1,4 +1,9 @@ +<<<<<<< HEAD BEGIN Inferno +======= +BEGIN Inferno +//ImageTrack BG +>>>>>>> 93b8864834b77391f0c1ea7fc0007f6110d69a5a Show BG "image.png" Show BGDialogue "grad.png" <<- @@ -7,7 +12,11 @@ Show BGDialogue "grad.png" 由我这里,直通[b]{无尽之苦}。 由我这里,直通[b]{堕落众生}。 圣裁于高天激发造我的君主; +<<<<<<< HEAD 造我的大能是[b, rb("C")]{神}的力量,是无上的[b, rb("L L V M")]{智慧与众爱}所自出。 +======= +造我的大能是[b, rb("C")]{神}的力量,是无上的[b, rb("LLVM")]{智慧与众爱}所自出。 +>>>>>>> 93b8864834b77391f0c1ea7fc0007f6110d69a5a 我永远不朽;在我之前,万象 未形,只有永恒的事物存在。 来者呀,快把一切希望弃扬。 我所见到的文字,毫无光彩, 用暗色刻在地狱之门的高处。 @@ -31,4 +40,4 @@ Show BGDialogue "grad.png" 这些天使,不是上帝的叛徒或信徒;他们为私利而自成一帮。 天穹嫌他们不够好,把他们放逐; 深坑呢,又不愿给他们栖身之地,怕坏人因此而显得光荣突出。 ->> -END \ No newline at end of file +END diff --git a/ADVect/runtime/dante_de.nvl b/ADVect/runtime/dante_de.nvl index ad2e18d..4b81d7a 100644 --- a/ADVect/runtime/dante_de.nvl +++ b/ADVect/runtime/dante_de.nvl @@ -1,6 +1,6 @@ -BEGIN Inferno +BEGIN Inferno -ImageTrack BG +// ImageTrack BG Show BG "image.png" <<- @@ -49,4 +49,4 @@ Die Himmel trieben sie als Mißzier aus, Und da durch sie der Sünder Stolz erstünde, Nimmt sie nicht ein der tiefen Hölle Graus. ->> -END \ No newline at end of file +END diff --git a/ADVect/runtime/dialogue.nvl b/ADVect/runtime/dialogue.nvl index 7fcfccb..e722d40 100644 --- a/ADVect/runtime/dialogue.nvl +++ b/ADVect/runtime/dialogue.nvl @@ -1,4 +1,4 @@ -BEGIN Scene1 +BEGIN Scene1 Show BG "image.png" Show BGDialogue "grad.png" @@ -23,8 +23,7 @@ After the login screen comes up, type in the password "G00gle." When the system reboots, you will see a prompt asking you to install a new program. Type "Y" and press ENTER. The Google search engine will come up. Type in "www.yahoo.com" and hit ENTER. -A window will appear saying "You have successfully installed Google Chrome." Click OK. -A new browser will open. Log in to your Yahoo mail account. +A window will appear saying "You have successfully installed Google Chrome." Click OK. A new browser will open. Log in to your Yahoo mail account. Go to your inbox and click on the link to download the latest version of Google Chrome. Install the update. diff --git a/ADVect/shader.py b/ADVect/shader.py index 4a637ed..09db318 100644 --- a/ADVect/shader.py +++ b/ADVect/shader.py @@ -1,33 +1,36 @@ import subprocess, os -SHADERC = "..\\out\\install\\x64-Debug\\bin\\shaderc" -OUT = "..\\out\\build\\x64-Debug\\ADVect\\shaders\\" +#SHADERC = "..\\out\\install\\x64-Debug\\bin\\shaderc" +SHADERC = "/Users/lachrymal/Projects/NouVeL/build/ADVect/ext/bgfx/Debug/shaderc" +#OUT = "..\\out\\build\\x64-Debug\\ADVect\\shaders\\" # OUT = "..\\build\\ADVect\\shaders\\" +OUT = "/Users/lachrymal/Projects/NouVeL/ADVect/runtime/shaders/" -P = lambda location, frag, vert: { 'location': location, 'frag': frag, 'vert': vert } +P = lambda location, platform, frag, vert: { 'location': location, 'platform': platform, 'frag': frag, 'vert': vert } plats = [ - P('glsl', '140', '140'), - P('dx11', 'ps_5_0', 'vs_5_0'), - P('spirv', 'spirv', 'spirv') +# P('glsl', 'windows', '140', '140'), +# P('dx11', 'windows', 'ps_5_0', 'vs_5_0'), +# P('spirv', 'windows', 'spirv', 'spirv'), + P('metal', 'osx', 'metal', 'metal') ] for root, dirs, _ in os.walk('shaders'): for name in dirs: for config in plats: subprocess.run([SHADERC, "-f", os.path.join(root, name, name + '.frag'), - "--type", "fragment" - "--platform", "windows", + "--type", "fragment", + "--platform", config['platform'], "--profile", config['frag'], "--varyingdef", os.path.join(root, name, "varying.def.sc"), - "-i", "ext\\bgfx\\bgfx\\examples\\common", - "-i", "ext\\bgfx\\bgfx\\src", + "-i", "/Users/lachrymal/Projects/NouVeL/ADVect/ext/bgfx/bgfx/examples/common", + "-i", "/Users/lachrymal/Projects/NouVeL/ADVect/ext/bgfx/bgfx/src", "-o", OUT + config['location'] + "\\" + name + ".frag.bin"]) subprocess.run([SHADERC, "-f", os.path.join(root, name, name + '.vert'), - "--type", "vertex" - "--platform", "windows", + "--type", "vertex", + "--platform", config['platform'], "--profile", config['vert'], "--varyingdef", os.path.join(root, name, "varying.def.sc"), - "-i", "ext\\bgfx\\bgfx\\examples\\common", - "-i", "ext\\bgfx\\bgfx\\src", + "-i", "/Users/lachrymal/Projects/NouVeL/ADVect/ext/bgfx/bgfx/examples/common", + "-i", "/Users/lachrymal/Projects/NouVeL/ADVect/ext/bgfx/bgfx/src", "-o", OUT + config['location'] + "\\" + name + ".vert.bin"]) - \ No newline at end of file +