fruit moment

This commit is contained in:
lachrymal 2023-04-06 19:50:37 -04:00
parent 0b6096afd5
commit 93b8864834
8 changed files with 62 additions and 45 deletions

View file

@ -3,11 +3,11 @@
#include "Graphics.h"
#include "Track.h"
#include <SDL2/SDL.h>
#include <SDL2/SDL_main.h>
#include <SDL2/SDL_timer.h>
#include <SDL.h>
#include <SDL_main.h>
#include <SDL_timer.h>
#include <bx/math.h>
#include <SDL2/SDL_syswm.h>
#include <SDL_syswm.h>
#include <bgfx/bgfx.h>
#include <bgfx/platform.h>
@ -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 = 900, .h = 500,
.opacity = 1.0f, .fill = 0xFFFFFFFF
};
ADVect::TextTrack speaker = {
ADVect::TextTrack speaker = {
.current{},
.pos_x = 250, .pos_y = 150,
.w = 500, .h = 500,
@ -114,6 +114,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;
@ -270,7 +271,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({
{
@ -311,8 +313,10 @@ int main(int argc, char* argv[]) {
}*/
if (name == "BG")
bg.change(current_time, ADVect::Graphics::GetImageTextureFromFile(NVL::to_std_string(std::get<NVL::String>(NVL::Environment::Variable(args[1]).value))), 200);
// bg.current = ADVect::Graphics::GetImageTextureFromFile(NVL::to_std_string(std::get<NVL::String>(NVL::Environment::Variable(args[1]).value)));
else if (name == "Avatar")
avatar.change(current_time, ADVect::Graphics::GetImageTextureFromFile(NVL::to_std_string(std::get<NVL::String>(NVL::Environment::Variable(args[1]).value))), 200);
// avatar.current = ADVect::Graphics::GetImageTextureFromFile(NVL::to_std_string(std::get<NVL::String>(NVL::Environment::Variable(args[1]).value)));
else if (name == "BGDialogue")
dialogue_bg.current = ADVect::Graphics::GetImageTextureFromFile(NVL::to_std_string(std::get<NVL::String>(NVL::Environment::Variable(args[1]).value)));
else

View file

@ -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 ()
endif ()

View file

@ -1,6 +1,6 @@
#pragma once
#include <SDL2/SDL.h>
#include <SDL.h>
#include <bgfx/bgfx.h>

View file

@ -36,21 +36,28 @@ namespace ADVect {
template <typename T, bool UsePointer, bool IsNamed, bool IsVisual, bool IsVisualFill, bool HasTransition>
struct Track {
std::conditional_t<UsePointer, T*, T> current{};
[[no_unique_address]] std::conditional_t<IsNamed, std::string, std::monostate> name{};
// [[no_unique_address]] std::conditional_t<IsNamed, std::string, std::monostate> name{};
std::conditional_t<IsNamed, std::string, std::monostate> name{};
// Visual
[[no_unique_address]] std::conditional_t<IsVisual, i32, std::monostate> pos_x{}, pos_y{};
[[no_unique_address]] std::conditional_t<IsVisual, u32, std::monostate> w{}, h{};
[[no_unique_address]] std::conditional_t<IsVisual, f32, std::monostate> opacity{};
// Visual
// [[no_unique_address]] std::conditional_t<IsVisual, i32, std::monostate> pos_x{}, pos_y{};
// [[no_unique_address]] std::conditional_t<IsVisual, u32, std::monostate> w{}, h{};
// [[no_unique_address]] std::conditional_t<IsVisual, f32, std::monostate> opacity{};
std::conditional_t<IsVisual, i32, std::monostate> pos_x{}, pos_y{};
std::conditional_t<IsVisual, u32, std::monostate> w{}, h{};
std::conditional_t<IsVisual, f32, std::monostate> opacity{};
// TODO other transforms
// Fill
static_assert(IsVisual || !IsVisualFill, "Track cannot have fill unless visual");
[[no_unique_address]] std::conditional_t<IsVisualFill, u32, std::monostate> fill{};
// Transition, with assumption that we need to access the original when transition is underway
[[no_unique_address]] std::conditional_t<HasTransition, std::conditional_t<UsePointer, T*, T>, std::monostate> next{};
[[no_unique_address]] std::conditional_t<HasTransition, Varying<f32>, std::monostate> transition{};
// [[no_unique_address]] std::conditional_t<IsVisualFill, u32, std::monostate> fill{};
std::conditional_t<IsVisualFill, u32, std::monostate> fill{};
// Transition, with assumption that we need to access the original when transition is underway
// [[no_unique_address]] std::conditional_t<HasTransition, std::conditional_t<UsePointer, T*, T>, std::monostate> next{};
// [[no_unique_address]] std::conditional_t<HasTransition, Varying<f32>, std::monostate> transition{};
std::conditional_t<HasTransition, std::conditional_t<UsePointer, T*, T>, std::monostate> next{};
std::conditional_t<HasTransition, Varying<f32>, std::monostate> transition{};
void check(u64 current_time) requires HasTransition {
if constexpr (UsePointer) {
if (next != nullptr && transition.check(current_time)) {
@ -126,7 +133,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);
}
}
}

View file

@ -1,5 +1,5 @@
BEGIN Inferno
ImageTrack BG
BEGIN Inferno
//ImageTrack BG
Show BG "image.png"
<<-
[]
@ -7,7 +7,7 @@ Show BG "image.png"
由我这里,直通[b]{无尽之苦}。
由我这里,直通[b]{堕落众生}。
圣裁于高天激发造我的君主;
造我的大能是[b, rb("C")]{神}的力量,是无上的[b, rb(" L L V M")]{智慧与众爱}所自出。
造我的大能是[b, rb("C")]{神}的力量,是无上的[b, rb("LLVM")]{智慧与众爱}所自出。
我永远不朽;在我之前,万象 未形,只有永恒的事物存在。
来者呀,快把一切希望弃扬。
我所见到的文字,毫无光彩, 用暗色刻在地狱之门的高处。
@ -32,4 +32,4 @@ Show BG "image.png"
这些天使,不是上帝的叛徒或信徒;他们为私利而自成一帮。
天穹嫌他们不够好,把他们放逐; 深坑呢,又不愿给他们栖身之地,怕坏人因此而显得光荣突出。
->>
END
END

View file

@ -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
END

View file

@ -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.

View file

@ -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"])