srell thank you

This commit is contained in:
lachrymaL 2022-08-23 18:02:15 -04:00
parent b0b73bb47e
commit 19e7374ac4
No known key found for this signature in database
GPG key ID: F3640ACFA174B1C1
103 changed files with 22545 additions and 32 deletions

View file

@ -25,16 +25,10 @@ namespace {
NVL::String speaker; NVL::String speaker;
u32 scene_pos = 0; u32 scene_pos = 0;
char* date;
} }
namespace ADVect { namespace ADVect {
void Init(std::string name, const std::vector<NVL::Parse::Scene>& sc) { void Init(std::string name, const std::vector<NVL::Parse::Scene>& sc) {
std::time_t now_time = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
date = std::ctime(&now_time);
date[10] = '\0';
date = &date[4];
m_name = name; m_name = name;
scenes = sc; // sure make a copy whatever scenes = sc; // sure make a copy whatever
@ -151,7 +145,7 @@ namespace ADVect {
bgfx::dbgTextClear(); bgfx::dbgTextClear();
bgfx::dbgTextPrintf(0, 44, 0xF0, "NouVeL x ADVect :: %s 2022", date); bgfx::dbgTextPrintf(0, 44, 0xF0, "NouVeL x ADVect :: %s %s", __DATE__, __TIME__);
bgfx::dbgTextPrintf(0, 43, 0xF0, "Current Position: %u", scene_pos); bgfx::dbgTextPrintf(0, 43, 0xF0, "Current Position: %u", scene_pos);
bgfx::dbgTextPrintf(0, 42, 0xF0, "Current Scene: %s", NVL::to_std_string(scenes[current_scene].name).c_str()); bgfx::dbgTextPrintf(0, 42, 0xF0, "Current Scene: %s", NVL::to_std_string(scenes[current_scene].name).c_str());

View file

@ -12,8 +12,9 @@ include_directories ("include" "../NVL/")
add_subdirectory("ext/freetype") add_subdirectory("ext/freetype")
add_subdirectory("ext/bgfx") add_subdirectory("ext/bgfx")
if (WIN32) if (WIN32)
target_link_libraries (Game ${PROJECT_SOURCE_DIR}/lib/SDL2.lib ${PROJECT_SOURCE_DIR}/lib/SDL2main.lib NVL freetype bgfx bx) 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)
else () else ()
target_link_libraries (Game NVL freetype bgfx bx) find_package(SDL2 REQUIRED)
add_compile_options(-lSDL2) target_link_libraries (Game PRIVATE NVL freetype bgfx bx SDL2::SDL2 SDL2::SDL2main)
endif () endif ()

View file

@ -14,14 +14,14 @@ namespace {
FT_Error error; FT_Error error;
FT_Face face_regular, face_bold; FT_Face face_regular, face_bold;
static struct PosUVVertex struct PosUVVertex {
{
f32 x; f32 x;
f32 y; f32 y;
f32 z; f32 z;
f32 u; f32 u;
f32 v; f32 v;
} quad_vert[] = };
static PosUVVertex quad_vert[] =
{ {
{ 0.f, 0.f, 0.0f, 0.0f, 0.0f }, { 0.f, 0.f, 0.0f, 0.0f, 0.0f },
{ 0.f, 1.f, 0.0f, 0.0f, 1.0f }, { 0.f, 1.f, 0.0f, 0.0f, 1.0f },

View file

@ -1,7 +1,7 @@
import subprocess, os import subprocess, os
plats = [ plats = [
{ 'location': 'glsl', 'frag': '440', 'vert': '440' }, { 'location': 'glsl', 'frag': '140', 'vert': '140' },
{ 'location': 'dx11', 'frag': 'ps_5_0', 'vert': 'vs_5_0' }, { 'location': 'dx11', 'frag': 'ps_5_0', 'vert': 'vs_5_0' },
{ 'location': 'spirv', 'frag': 'spirv', 'vert': 'spirv' } { 'location': 'spirv', 'frag': 'spirv', 'vert': 'spirv' }
] ]

View file

@ -7,6 +7,6 @@ SAMPLER2D(s_texColor, 0);
void main() void main()
{ {
vec2 uv = { v_texcoord0.x, 1.0f - v_texcoord0.y }; vec2 uv = vec2(v_texcoord0.x, 1.0f - v_texcoord0.y);
gl_FragColor = vec4(1.0, 1.0, 1.0, texture2D(s_texColor, uv).a); gl_FragColor = vec4(1.0, 1.0, 1.0, texture2D(s_texColor, uv).a);
} }

View file

@ -7,6 +7,6 @@ SAMPLER2D(s_texColor, 0);
void main() void main()
{ {
vec2 uv = { v_texcoord0.x, 1.0f - v_texcoord0.y }; vec2 uv = vec2(v_texcoord0.x, 1.0f - v_texcoord0.y);
gl_FragColor = texture2D(s_texColor, uv); gl_FragColor = texture2D(s_texColor, uv);
} }

View file

@ -11,6 +11,18 @@
"buildCommandArgs": "", "buildCommandArgs": "",
"ctestCommandArgs": "", "ctestCommandArgs": "",
"intelliSenseMode": "windows-clang-x64" "intelliSenseMode": "windows-clang-x64"
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": []
} }
] ]
} }

View file

@ -4,6 +4,7 @@
cmake_minimum_required (VERSION 3.8) cmake_minimum_required (VERSION 3.8)
project (NVL) project (NVL)
include_directories("include")
add_library (NVL STATIC "NouVeL.cpp" "Parser.cpp" "Environment.cpp" "Environment.h" "Common.h") add_library (NVL STATIC "NouVeL.cpp" "Parser.cpp" "Environment.cpp" "Environment.h" "Common.h")
# add_executable (NVL "NouVeL.cpp" "Parser.cpp" "Environment.cpp" "Environment.h" "Common.h" ) # add_executable (NVL "NouVeL.cpp" "Parser.cpp" "Environment.cpp" "Environment.h" "Common.h" )

View file

@ -41,5 +41,6 @@ namespace NVL::Environment {
struct Markup { struct Markup {
u32 begin, end; u32 begin, end;
std::vector<std::pair<String, std::vector<String>>> efs; std::vector<std::pair<String, std::vector<String>>> efs;
} UnpackMarkupVariable(const Variable& m); };
Markup UnpackMarkupVariable(const Variable& m);
} }

View file

@ -5,10 +5,9 @@
#include <iostream> #include <iostream>
#include <regex> #include <srell.hpp>
#include <utility> #include <utility>
#include <stdexcept>
#include "Environment.h" #include "Environment.h"
@ -18,10 +17,10 @@ namespace {
struct ParseGroup { struct ParseGroup {
String accept; String accept;
operator String() const { constexpr operator String() const {
return accept; return accept;
} }
bool operator== (const String& other) const { constexpr bool operator== (const String& other) const {
return accept == other; return accept == other;
} }
}; };
@ -29,7 +28,7 @@ namespace {
struct Match { struct Match {
String accept; String accept;
operator Char() const { constexpr operator Char() const {
if (accept.length() == 1) if (accept.length() == 1)
return accept[0]; return accept[0];
else { else {
@ -37,7 +36,7 @@ namespace {
return '\0'; return '\0';
} }
} }
bool operator== (const String& other) const { constexpr bool operator== (const String& other) const {
return accept == other; return accept == other;
} }
}; };
@ -344,15 +343,16 @@ namespace {
* - Vec: Params * - Vec: Params
*/ */
Parse::Object MatchMarkup(String& s) { Parse::Object MatchMarkup(String& s) {
static const std::regex typer(R"((?:^|[^\\])\[([^\]]+)\]\s*\{([^\}]+)\})"); // G1 -> Specifiers, G2 -> Contents static const srell::basic_regex<Char>
static const std::regex effect(R"(\s*(?:([^,\(\)]+?)\s*\(\s*([^\(\)]+?)\s*\)|([^,\(\)]+?))\s*(?:,\s*|$))"); // G1 & G2 -> Func, G3 -> Attr typer(uR"((?:^|[^\\])\[([^\]]+)\]\s*\{([^\}]+)\})"), // G1 -> Specifiers, G2 -> Contents
static const std::regex param(R"(([^,]+?)\s*(?:,\s*|$))"); // Comma split of func args effect(uR"(\s*(?:([^,\(\)]+?)\s*\(\s*([^\(\)]+?)\s*\)|([^,\(\)]+?))\s*(?:,\s*|$))"), // G1 & G2 -> Func, G3 -> Attr
param(uR"(([^,]+?)\s*(?:,\s*|$))"); // Comma split of func args
std::vector<Parse::Object> tags; std::vector<Parse::Object> tags;
std::match_results<String::const_iterator> tags_match; srell::match_results<String::const_iterator> tags_match;
std::match_results<String::const_iterator> effects_match; srell::match_results<String::const_iterator> effects_match;
std::match_results<String::const_iterator> params_match; srell::match_results<String::const_iterator> params_match;
String reconstruction{}; String reconstruction{};
@ -362,7 +362,7 @@ namespace {
// Match tags // Match tags
String::const_iterator tags_start(s.cbegin()); String::const_iterator tags_start(s.cbegin());
while (std::regex_search(tags_start, s.cend(), tags_match, typer)) { while (srell::regex_search(tags_start, s.cend(), tags_match, typer)) {
has_markup = true; has_markup = true;
Parse::Object m{ Parse::Type::Array, std::vector<Parse::Object>{} }; Parse::Object m{ Parse::Type::Array, std::vector<Parse::Object>{} };
reconstruction.append(tags_match.prefix().first, std::next(tags_match[0].first, 1)); // match will overmatch behind by 1 reconstruction.append(tags_match.prefix().first, std::next(tags_match[0].first, 1)); // match will overmatch behind by 1
@ -381,14 +381,14 @@ namespace {
// Match markup options // Match markup options
String::const_iterator effects_start(tags_match[1].first); String::const_iterator effects_start(tags_match[1].first);
while (std::regex_search(effects_start, tags_match[1].second, effects_match, effect)) { while (srell::regex_search(effects_start, tags_match[1].second, effects_match, effect)) {
if (effects_match[3].matched) { if (effects_match[3].matched) {
effects.push_back({ Parse::Type::String, effects_match[3].str() }); effects.push_back({ Parse::Type::String, effects_match[3].str() });
} }
else { else {
std::vector<Parse::Object> args; std::vector<Parse::Object> args;
String::const_iterator params_start(effects_match[2].first); String::const_iterator params_start(effects_match[2].first);
while (std::regex_search(params_start, effects_match[2].second, params_match, param)) { while (srell::regex_search(params_start, effects_match[2].second, params_match, param)) {
size_t temp = 0; size_t temp = 0;
args.push_back(ParseExpression(params_match[1].str() + SEPARATOR.accept[0], temp)); // PeekToken will freak out if I don't do this args.push_back(ParseExpression(params_match[1].str() + SEPARATOR.accept[0], temp)); // PeekToken will freak out if I don't do this
params_start = params_match.suffix().first; params_start = params_match.suffix().first;

Some files were not shown because too many files have changed in this diff Show more