feat: c++20 support, and compiler macros for appname and title
This commit is contained in:
parent
0ff2dae233
commit
d0f6bb3480
2 changed files with 9 additions and 4 deletions
8
App.cpp
8
App.cpp
|
@ -9,6 +9,10 @@
|
|||
#include <String.h>
|
||||
#include <StringView.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <format>
|
||||
|
||||
#define APP_NAME "Renga"
|
||||
#define APP_AUTHOR "hex_andre"
|
||||
|
||||
// quick and dirty function to quickly make text labels
|
||||
BStringView *MakeText(const char* text)
|
||||
|
@ -16,7 +20,7 @@ BStringView *MakeText(const char* text)
|
|||
return new BStringView("rstr", text);
|
||||
}
|
||||
|
||||
App::App(void) : BApplication("application/x-vnd.hex-Renga")
|
||||
App::App(void) : BApplication(std::format("application/x-vnd.{}-{}", APP_AUTHOR, APP_NAME).c_str())
|
||||
{
|
||||
// Initialize BRect frame for window
|
||||
BRect frame(100, 100, 500, 400);
|
||||
|
@ -24,7 +28,7 @@ App::App(void) : BApplication("application/x-vnd.hex-Renga")
|
|||
// Initialize parent group for all UI elements to sit in. This is so they all get grouped nicely together
|
||||
BGroupLayout *pGroup = new BGroupLayout(B_HORIZONTAL);
|
||||
// Create window
|
||||
BWindow *window = new BWindow(frame, "Hello World!", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE);
|
||||
BWindow *window = new BWindow(frame, std::format("{} by {}", APP_NAME, APP_AUTHOR).c_str(), B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE);
|
||||
|
||||
// Set window layout to parent group created earlier
|
||||
window->SetLayout(pGroup);
|
||||
|
|
5
Makefile
5
Makefile
|
@ -1,10 +1,11 @@
|
|||
BINARY=renga
|
||||
CPP=g++
|
||||
CPP=clang
|
||||
FLAGS=-lbe -std=c++20 -lstdc++
|
||||
|
||||
all: build
|
||||
|
||||
build:
|
||||
$(CPP) App.cpp -o $(BINARY) -lbe
|
||||
$(CPP) App.cpp -o $(BINARY) $(FLAGS)
|
||||
test: build
|
||||
./renga
|
||||
|
||||
|
|
Loading…
Reference in a new issue