MXVK Vulkan Framework 0.35.0
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
main.cpp File Reference
#include "mxvk/argz.hpp"
#include "mxvk/mxvk.hpp"
#include "mxvk/mxvk_exception.hpp"
#include <SDL3/SDL.h>
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <filesystem>
#include <format>
#include <fstream>
#include <iostream>
#include <memory>
#include <random>
#include <string>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

struct  anonymous_namespace{main.cpp}::Cell
class  anonymous_namespace{main.cpp}::HighScores
struct  anonymous_namespace{main.cpp}::Layout
class  example::MasterPieceWindow
struct  anonymous_namespace{main.cpp}::Piece
struct  anonymous_namespace{main.cpp}::ScoreEntry

Namespaces

namespace  anonymous_namespace{main.cpp}
namespace  example

Enumerations

enum class  anonymous_namespace{main.cpp}::Screen {
  anonymous_namespace{main.cpp}::Intro , anonymous_namespace{main.cpp}::Menu , anonymous_namespace{main.cpp}::Game , anonymous_namespace{main.cpp}::Scores ,
  anonymous_namespace{main.cpp}::Credits , anonymous_namespace{main.cpp}::NameEntry , anonymous_namespace{main.cpp}::Intro , anonymous_namespace{main.cpp}::Menu ,
  anonymous_namespace{main.cpp}::Game , anonymous_namespace{main.cpp}::Scores , anonymous_namespace{main.cpp}::Credits , anonymous_namespace{main.cpp}::NameEntry
}

Functions

bool anonymous_namespace{main.cpp}::hasResolutionArgument (int argc, char **argv)
int main (int argc, char **argv)
std::filesystem::path anonymous_namespace{main.cpp}::resolveAssetRoot (const std::string &path)
std::filesystem::path anonymous_namespace{main.cpp}::resolvePuzzleAssetRoot (const std::filesystem::path &asset_root)
std::filesystem::path anonymous_namespace{main.cpp}::scorePath (const std::filesystem::path &asset_root)

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 1270 of file main.cpp.

1270 {
1271 try {
1272 const bool explicit_resolution = hasResolutionArgument(argc, argv);
1273 Arguments args = proc_args(argc, argv);
1274 if (!explicit_resolution) {
1275 args.width = base_width;
1276 args.height = base_height;
1277 }
1278
1279 example::MasterPieceWindow window(args.path, args.width, args.height, args.fullscreen, args.enable_vsync);
1280 window.loop();
1281 } catch (mxvk::Exception &e) {
1282 std::cerr << std::format("mxvk: Exception: {}\n", e.text());
1283 return EXIT_FAILURE;
1284 } catch (ArgException<std::string> &e) {
1285 std::cerr << std::format("mxvk: Argument Exception: {}\n", e.text());
1286 return EXIT_FAILURE;
1287 }
1288
1289 return EXIT_SUCCESS;
1290}
Arguments proc_args(int &argc, char **argv)
Parse standard libmx2 command-line options from main()'s argv.
Definition argz.hpp:854
Exception thrown by Argz::proc() on unrecognised or malformed options.
Definition argz.hpp:169
String text() const
Definition argz.hpp:173
std::string text() const
constexpr int base_width
Definition main.cpp:34
bool hasResolutionArgument(int argc, char **argv)
Definition main.cpp:126
constexpr int base_height
Definition main.cpp:35
Plain data structure returned by proc_args() with all common libmx2 CLI options.
Definition argz.hpp:718
bool fullscreen
Whether fullscreen mode was requested.
Definition argz.hpp:724
bool enable_vsync
Enable FIFO present mode / v-sync (--enable-vsync).
Definition argz.hpp:738
int height
Viewport height in pixels (default: 720).
Definition argz.hpp:721
std::string path
Asset root; proc_args() defaults it to the executable directory.
Definition argz.hpp:723
int width
Viewport width in pixels (default: 1280).
Definition argz.hpp:720