MXVK Vulkan Framework 0.33.1
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 1327 of file main.cpp.

1327 {
1328 try {
1329 const bool explicit_resolution = hasResolutionArgument(argc, argv);
1330 Arguments args = proc_args(argc, argv);
1331 if (!explicit_resolution) {
1332 args.width = base_width;
1333 args.height = base_height;
1334 }
1335
1336 example::MasterPieceWindow window(args.path, args.width, args.height, args.fullscreen, args.enable_vsync);
1337 window.loop();
1338 } catch (mxvk::Exception &e) {
1339 std::cerr << std::format("mxvk: Exception: {}\n", e.text());
1340 return EXIT_FAILURE;
1341 } catch (ArgException<std::string> &e) {
1342 std::cerr << std::format("mxvk: Argument Exception: {}\n", e.text());
1343 return EXIT_FAILURE;
1344 }
1345
1346 return EXIT_SUCCESS;
1347}
Arguments proc_args(int &argc, char **argv)
Parse standard libmx2 command-line options from main()'s argv.
Definition argz.hpp:872
Exception thrown by Argz::proc() on unrecognised or malformed options.
Definition argz.hpp:178
String text() const
Definition argz.hpp:182
std::string text() const
constexpr int base_width
Definition main.cpp:34
bool hasResolutionArgument(int argc, char **argv)
Definition main.cpp:128
constexpr int base_height
Definition main.cpp:35
Plain data structure returned by proc_args() with all common libmx2 CLI options.
Definition argz.hpp:730
bool fullscreen
Whether fullscreen mode was requested.
Definition argz.hpp:736
bool enable_vsync
Enable FIFO present mode / v-sync (--enable-vsync).
Definition argz.hpp:750
int height
Viewport height in pixels (default: 720).
Definition argz.hpp:733
std::string path
Asset root; proc_args() defaults it to the executable directory.
Definition argz.hpp:735
int width
Viewport width in pixels (default: 1280).
Definition argz.hpp:732