/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include "window.h"
int screen_area();
std::string window_title() {
const auto& window = Window::GetWindow();
return window.title;
}
int main()
{
std::cout << "window size: " << screen_area() << std::endl;
std::cout << "window title: " << window_title() << std::endl;
return 0;
}
#pragma once
#include <string>
struct Window {
int width;
int height;
bool fullscreen;
std::string title;
double volume;
static const Window& GetWindow();
};
#include "window.h"
#define SIMDJSON_STATIC_REFLECTION 1
#include "simdjson.h"
constexpr const char json_data[] = {
#embed "data.json"
, 0
};
namespace {
constexpr auto global_window = simdjson::compile_time::parse_json<json_data>();
}
const Window& Window::GetWindow() {
return global_window;
}
int screen_area() {
const auto& window = Window::GetWindow();
return window.width * window.height;
}
#include "window.h"
int screen_area() {
const auto& window = Window::GetWindow();
return window.width * window.height;
}
#pragma once
#include <string>
constexpr const char json_data[] = {
#embed "data.json"
, 0
};
namespace {
constexpr auto global_window = simdjson::compile_time::parse_json<json_data>();
}
struct Window {
int width;
int height;
bool fullscreen;
std::string title;
double volume;
};