Wecome to Door++, a modern BBS Door development kit written in C++
Getting Started
Clone the door++ project into a sub-directory of your project. In your project CmakeLists.txt file, add add_subdirectory(door++)
. Under the add_executable(your-door your-door.cpp) line, add target_link_libraries(your-door door++ pthread)
`.
In main, create the door instance:
#include "door.h"
int main( int argc, char * argv[] ) {
}
Advanced Features of Door++
A line is text that can be updated, and can be colorized by the use of a rendering function.
If you want all uppercase letters one color, and lowercase another. That can be done.
size_t pos = txt.find(':');
if (pos == std::string::npos) {
for (char const &c : txt) {
if (std::isdigit(c))
r.append(value);
else
r.append(status);
}
} else {
pos++;
r.append(status, pos);
r.append(value, txt.length() - pos);
}
return r;
};
return rf;
}
std::unique_ptr<door::Line> scoreLine = std::make_unique<door::Line>("Score: 0", 50);
scoreLine->setRender(svRender);
std::string text = "Score: ";
text.append(std::to_string(score));
return text;
};
scoreLine->setUpdater(scoreUpdate);
A Panel is a group of lines with a known position.
std::unique_ptr<door::Panel> panel = std::make_unique<door::Panel>(50);
panel->addLines(std::move(scoreLine));
panel->set(5, 5);
panel->update();
A Panel that displays options for the user to select
m.setColor(border_color);
mtitle.setColor(title_color);
mtitle.setPadding(" ", title_color);
m.setTitle(std::make_unique<door::Line>(mtitle), 1);
m.addSelection('P', "Play Cards");
m.addSelection('S', "View Scores");
m.addSelection('C', "Configure");
m.addSelection('H', "Help");
m.addSelection('A', "About this game");
m.addSelection('Q', "Quit");
int r;
if (r < 0) {
}
if ( r == 1 ) {
}
...