Now have a basic prototype lighting system.
This commit is contained in:
parent
1bb04b4562
commit
a9217e8423
4 changed files with 65 additions and 48 deletions
|
@ -10,7 +10,7 @@
|
|||
using namespace fmt;
|
||||
|
||||
|
||||
#line 115 "ansi_parser.rl"
|
||||
#line 121 "ansi_parser.rl"
|
||||
|
||||
|
||||
|
||||
|
@ -101,7 +101,7 @@ static const int ansi_parser_error = 0;
|
|||
static const int ansi_parser_en_main = 26;
|
||||
|
||||
|
||||
#line 118 "ansi_parser.rl"
|
||||
#line 124 "ansi_parser.rl"
|
||||
|
||||
#include <ftxui/screen/terminal.hpp>
|
||||
|
||||
|
@ -124,7 +124,7 @@ bool ANSIParser::parse(std::wstring_view codes, ColorCB color_cb, WriteCB write_
|
|||
const wchar_t *eof = pe;
|
||||
sf::Color bgcolor($default_bg);
|
||||
sf::Color color($default_fg);
|
||||
sf::Color &target = color;
|
||||
sf::Color* target = &color;
|
||||
|
||||
|
||||
#line 122 "ansi_parser.cpp"
|
||||
|
@ -132,7 +132,7 @@ bool ANSIParser::parse(std::wstring_view codes, ColorCB color_cb, WriteCB write_
|
|||
cs = ansi_parser_start;
|
||||
}
|
||||
|
||||
#line 143 "ansi_parser.rl"
|
||||
#line 149 "ansi_parser.rl"
|
||||
|
||||
#line 125 "ansi_parser.cpp"
|
||||
{
|
||||
|
@ -246,13 +246,13 @@ _match:
|
|||
case 3:
|
||||
#line 43 "ansi_parser.rl"
|
||||
{
|
||||
target = color;
|
||||
target = &color;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
#line 46 "ansi_parser.rl"
|
||||
{
|
||||
target = bgcolor;
|
||||
target = &bgcolor;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
|
@ -263,14 +263,20 @@ _match:
|
|||
break;
|
||||
case 6:
|
||||
#line 54 "ansi_parser.rl"
|
||||
{ color = $default_fg; }
|
||||
{
|
||||
color = $default_fg;
|
||||
color_cb(color, bgcolor);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
#line 55 "ansi_parser.rl"
|
||||
{ bgcolor = $default_bg; }
|
||||
#line 58 "ansi_parser.rl"
|
||||
{
|
||||
bgcolor = $default_bg;
|
||||
color_cb(color, bgcolor);
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
#line 56 "ansi_parser.rl"
|
||||
#line 62 "ansi_parser.rl"
|
||||
{
|
||||
color = $default_bg;
|
||||
bgcolor = $default_fg;
|
||||
|
@ -278,7 +284,7 @@ _match:
|
|||
}
|
||||
break;
|
||||
case 9:
|
||||
#line 61 "ansi_parser.rl"
|
||||
#line 67 "ansi_parser.rl"
|
||||
{
|
||||
color = $default_fg;
|
||||
bgcolor = $default_bg;
|
||||
|
@ -286,40 +292,40 @@ _match:
|
|||
}
|
||||
break;
|
||||
case 10:
|
||||
#line 66 "ansi_parser.rl"
|
||||
#line 72 "ansi_parser.rl"
|
||||
{
|
||||
color = sf::Color(100,100,100);
|
||||
color_cb(color, bgcolor);
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
#line 70 "ansi_parser.rl"
|
||||
#line 76 "ansi_parser.rl"
|
||||
{
|
||||
color = sf::Color::Red;
|
||||
color_cb(color, bgcolor);
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
#line 75 "ansi_parser.rl"
|
||||
{ target.r = value; }
|
||||
#line 81 "ansi_parser.rl"
|
||||
{ target->r = value; }
|
||||
break;
|
||||
case 13:
|
||||
#line 76 "ansi_parser.rl"
|
||||
{ target.g = value; }
|
||||
#line 82 "ansi_parser.rl"
|
||||
{ target->g = value; }
|
||||
break;
|
||||
case 14:
|
||||
#line 77 "ansi_parser.rl"
|
||||
{ target.b = value; }
|
||||
#line 83 "ansi_parser.rl"
|
||||
{ target->b = value; }
|
||||
break;
|
||||
case 15:
|
||||
#line 78 "ansi_parser.rl"
|
||||
#line 84 "ansi_parser.rl"
|
||||
{ value = 0; }
|
||||
break;
|
||||
case 16:
|
||||
#line 79 "ansi_parser.rl"
|
||||
#line 85 "ansi_parser.rl"
|
||||
{}
|
||||
break;
|
||||
#line 292 "ansi_parser.cpp"
|
||||
#line 298 "ansi_parser.cpp"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -336,10 +342,10 @@ _again:
|
|||
while ( __nacts-- > 0 ) {
|
||||
switch ( *__acts++ ) {
|
||||
case 16:
|
||||
#line 79 "ansi_parser.rl"
|
||||
#line 85 "ansi_parser.rl"
|
||||
{}
|
||||
break;
|
||||
#line 310 "ansi_parser.cpp"
|
||||
#line 316 "ansi_parser.cpp"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -347,12 +353,11 @@ _again:
|
|||
_out: {}
|
||||
}
|
||||
|
||||
#line 144 "ansi_parser.rl"
|
||||
#line 150 "ansi_parser.rl"
|
||||
|
||||
bool good = pe - p == 0;
|
||||
|
||||
if(!good) {
|
||||
println("FAIL AT {}", pe - p);
|
||||
p -= 10;
|
||||
// dear cthuhlu, save me from the pain that is wstring
|
||||
for(int i = 0; i < 100; i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue