Add support for nxxm.

[nxxm](https://nxxm.github.io)
This commit is contained in:
ArthurSonzogni
2019-02-02 01:59:48 +01:00
parent 2eddd0fa17
commit ef0de8d873
72 changed files with 309 additions and 165 deletions

View File

@@ -1,7 +1,3 @@
cmake_minimum_required(VERSION 3.0)
add_subdirectory(component)
add_subdirectory(dom)
add_executable(print_key_press print_key_press.cpp)
target_link_libraries(print_key_press PUBLIC component)
add_subdirectory(util)

85
examples/html/test.html Normal file
View File

@@ -0,0 +1,85 @@
<!doctype html>
<html lang="en_US">
<head>
<meta charset="utf-8">
<style>
html, body, textarea{
margin:0;
padding:0;
width: 100%;
height: 100%;
overflow:hidden;
}
body {
background-color:gray;
};
textarea {
white-space: pre-wrap;
background-color:white;
}
</style>
<script type="text/c++">
#include <iostream>
#include "ftxui/screen/screen.hpp"
#include "ftxui/dom/elements.hpp"
int main() {
using namespace ftxui;
auto document =
hbox(
window(text(L" main frame ") | hcenter,
vbox(
text(L"Line 1"),
text(L"Line 2"),
text(L"Line 3"),
vbox(
text(L"Line 4"),
text(L"Line 5"),
text(L"Line 6")
) | border,
hbox(
window(text(L"frame 2"),
vbox(
text(L"Line 4"),
gauge(0.5) | border,
text(L"Line 6")
)
),
window(text(L"frame 3"),
vbox(
text(L"Line 7"),
text(L"Line 8"),
text(L"Line 9")
)
)
),
text(L"footer footer footer footer footer")
)
),
filler()
);
auto screen = Screen::Create(Dimension::Fit(document));
Render(screen, document.get());
std::cout << screen.ToString() << std::endl;
return 0;
}
</script>
</head>
<body>
<textarea id="box"></textarea>
</body>
<script>
window.Module = {
'print': function(text) {
console.log(text);
document.getElementById("box").value += text + '\n';
}
};
</script>
</html>

View File

@@ -0,0 +1,6 @@
function(example name)
add_executable(${name} ${name}.cpp)
target_link_libraries(${name} PUBLIC component)
endfunction(example)
example(print_key_press)