MXVK Vulkan Framework 0.24.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 "mxvk/mxvk_math.h"
#include "mxvk/mxvk_png.hpp"
#include <SDL3/SDL.h>
#include <algorithm>
#include <array>
#include <chrono>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <format>
#include <iostream>
#include <limits>
#include <memory>
#include <random>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

struct  anonymous_namespace{main.cpp}::Block
struct  anonymous_namespace{main.cpp}::Cell
struct  anonymous_namespace{main.cpp}::Piece
class  anonymous_namespace{main.cpp}::PuzzleDropWindow
struct  anonymous_namespace{main.cpp}::RasterVertex
class  anonymous_namespace{main.cpp}::SoftwareRenderer
class  anonymous_namespace{main.cpp}::SurfaceDeleter
struct  anonymous_namespace{main.cpp}::Texture
struct  anonymous_namespace{main.cpp}::TextureLevel

Namespaces

namespace  anonymous_namespace{main.cpp}

Macros

#define math3d_puzzle_drop_ASSET_DIR   "."

Enumerations

enum class  anonymous_namespace{main.cpp}::BlockType {
  anonymous_namespace{main.cpp}::Null = 0 , anonymous_namespace{main.cpp}::Clear , anonymous_namespace{main.cpp}::Red1 , anonymous_namespace{main.cpp}::Red2 ,
  anonymous_namespace{main.cpp}::Red3 , anonymous_namespace{main.cpp}::Green1 , anonymous_namespace{main.cpp}::Green2 , anonymous_namespace{main.cpp}::Green3 ,
  anonymous_namespace{main.cpp}::Blue1 , anonymous_namespace{main.cpp}::Blue2 , anonymous_namespace{main.cpp}::Blue3 , anonymous_namespace{main.cpp}::Match
}
enum class  anonymous_namespace{main.cpp}::ShiftDirection { anonymous_namespace{main.cpp}::Down , anonymous_namespace{main.cpp}::Up }

Functions

void anonymous_namespace{main.cpp}::build_mipmaps (Texture &texture)
bool anonymous_namespace{main.cpp}::is_play_block (BlockType type)
Texture anonymous_namespace{main.cpp}::load_texture (const std::string &path, bool generate_mipmaps=false)
int main (int argc, char **argv)
bool anonymous_namespace{main.cpp}::same_or_match (BlockType actual, BlockType expected)
int anonymous_namespace{main.cpp}::texture_index (BlockType type)

Variables

constexpr float anonymous_namespace{main.cpp}::BLOCK_HALF_EXTENT = 0.064f
constexpr float anonymous_namespace{main.cpp}::BLOCK_SPACING = 0.145f
constexpr std::array< const char *, 10 > anonymous_namespace{main.cpp}::BLOCK_TEXTURE_FILES
constexpr int anonymous_namespace{main.cpp}::BOARD_HEIGHT = 22
constexpr int anonymous_namespace{main.cpp}::BOARD_WIDTH = 20
constexpr std::array< float, 3 > anonymous_namespace{main.cpp}::FALL_SECONDS {0.86f, 0.68f, 0.50f}
constexpr float anonymous_namespace{main.cpp}::FRAME_GAP = 0.016f
constexpr float anonymous_namespace{main.cpp}::FRAME_HALF_EXTENT = BLOCK_HALF_EXTENT * 0.72f
constexpr int anonymous_namespace{main.cpp}::LEVEL_COUNT = 8

Macro Definition Documentation

◆ math3d_puzzle_drop_ASSET_DIR

#define math3d_puzzle_drop_ASSET_DIR   "."

Definition at line 28 of file main.cpp.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 1569 of file main.cpp.

1569 {
1570 try {
1571 const Arguments args = proc_args(argc, argv);
1572 const FramebufferDimensions framebuffer = args.framebufferSpecified
1573 ? args.framebuffer
1575 PuzzleDropWindow window(args, framebuffer);
1576 window.loop();
1577 } catch (const mxvk::Exception &exception) {
1578 std::cerr << std::format("mxvk: Exception: {}\n", exception.text());
1579 return EXIT_FAILURE;
1580 } catch (const ArgException<std::string> &exception) {
1581 std::cerr << std::format("mxvk: Argument Exception: {}\n", exception.text());
1582 return EXIT_FAILURE;
1583 } catch (const std::exception &exception) {
1584 std::cerr << std::format("3dmath_puzzle_drop: Exception: {}\n", exception.what());
1585 return EXIT_FAILURE;
1586 }
1587 return EXIT_SUCCESS;
1588}
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
PuzzleDropWindow(const Arguments &args, const FramebufferDimensions &framebuffer)
Definition main.cpp:778
std::string text() const
constexpr int DEFAULT_FRAME_WIDTH
Definition main.cpp:26
constexpr int DEFAULT_FRAME_HEIGHT
Definition main.cpp:27
Plain data structure returned by proc_args() with all common libmx2 CLI options.
Definition argz.hpp:730
FramebufferDimensions framebuffer
Software framebuffer size requested by --framebuffer.
Definition argz.hpp:758
bool framebufferSpecified
Whether --framebuffer was provided.
Definition argz.hpp:759
Parsed software framebuffer dimensions.
Definition argz.hpp:721