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 <SDL3/SDL.h>
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <filesystem>
#include <fstream>
#include <limits>
#include <memory>
#include <random>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>
#include <glm/ext/matrix_clip_space.hpp>
#include <glm/ext/matrix_transform.hpp>
#include <glm/glm.hpp>
#include "mxvk/argz.hpp"
#include "mxvk/mxvk.hpp"
#include "mxvk/mxvk_abstract_model.hpp"
#include "mxvk/mxvk_exception.hpp"
#include "mxvk/mxvk_png.hpp"

Go to the source code of this file.

Classes

class  anonymous_namespace{main.cpp}::HighScores
struct  anonymous_namespace{main.cpp}::PoolBall
class  demo::PoolWindow
struct  anonymous_namespace{main.cpp}::Score
struct  anonymous_namespace{main.cpp}::SinkAnim

Namespaces

namespace  anonymous_namespace{main.cpp}
namespace  demo

Macros

#define POOL_DEMO_ASSET_DIR   "."

Enumerations

enum class  anonymous_namespace{main.cpp}::GamePhase {
  anonymous_namespace{main.cpp}::Aiming , anonymous_namespace{main.cpp}::Charging , anonymous_namespace{main.cpp}::Rolling , anonymous_namespace{main.cpp}::Placing ,
  anonymous_namespace{main.cpp}::GameOver
}
enum class  anonymous_namespace{main.cpp}::GameScreen { anonymous_namespace{main.cpp}::Intro , anonymous_namespace{main.cpp}::Scores , anonymous_namespace{main.cpp}::Game , anonymous_namespace{main.cpp}::Start }

Functions

bool anonymous_namespace{main.cpp}::hasPoolAssets (const std::filesystem::path &root)
int main (int argc, char **argv)
float anonymous_namespace{main.cpp}::randFloat (float mn, float mx)
std::filesystem::path anonymous_namespace{main.cpp}::resolveAssetRoot (const std::string &path)

Variables

constexpr float anonymous_namespace{main.cpp}::AIM_LENGTH = 2.0f
constexpr float anonymous_namespace{main.cpp}::AIM_THICKNESS_Y = 0.008f
constexpr float anonymous_namespace{main.cpp}::AIM_THICKNESS_Z = 0.015f
const std::array< glm::vec3, NUM_BALLSanonymous_namespace{main.cpp}::BALL_COLORS
constexpr float anonymous_namespace{main.cpp}::CAM_BASE_TOTAL_SCALE = 1.359411f
constexpr float anonymous_namespace{main.cpp}::CUE_LENGTH = 2.5f
constexpr float anonymous_namespace{main.cpp}::CUE_THICKNESS = 0.03f
constexpr float anonymous_namespace{main.cpp}::FRICTION = 0.9988f
constexpr float anonymous_namespace{main.cpp}::MAX_POWER = 1.5f
constexpr float anonymous_namespace{main.cpp}::MIN_SPEED = 0.001f
constexpr int anonymous_namespace{main.cpp}::NUM_BALLS = 16
constexpr float anonymous_namespace{main.cpp}::PI = 3.14159265358979323846f
constexpr float anonymous_namespace{main.cpp}::POCKET_INSET = 0.25f
constexpr float anonymous_namespace{main.cpp}::POCKET_R = 0.25f
const std::array< glm::vec2, 6 > anonymous_namespace{main.cpp}::POCKETS
constexpr float anonymous_namespace{main.cpp}::SINK_DURATION = 0.45f
constexpr float anonymous_namespace{main.cpp}::TABLE_H = 6.0f
constexpr float anonymous_namespace{main.cpp}::TABLE_HALF_H = TABLE_H / 2.0f
constexpr float anonymous_namespace{main.cpp}::TABLE_HALF_W = TABLE_W / 2.0f
constexpr float anonymous_namespace{main.cpp}::TABLE_W = 12.0f

Macro Definition Documentation

◆ POOL_DEMO_ASSET_DIR

#define POOL_DEMO_ASSET_DIR   "."

Definition at line 29 of file main.cpp.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 1677 of file main.cpp.

1677 {
1678 try {
1679 Arguments args = proc_args(argc, argv);
1680 std::string assets = resolveAssetRoot(args.path);
1681 SDL_Log("pool_demo: using asset root: %s", assets.c_str());
1682 demo::PoolWindow window(args.width, args.height, args.fullscreen, args.enable_vsync, assets);
1683 window.loop();
1684 } catch (const mxvk::Exception &e) {
1685 SDL_Log("mxvk: Exception: %s", e.text().c_str());
1686 return EXIT_FAILURE;
1687 }
1688
1689 return EXIT_SUCCESS;
1690}
Arguments proc_args(int &argc, char **argv)
Parse standard libmx2 command-line options from main()'s argv.
Definition argz.hpp:872
std::string text() const
std::filesystem::path resolveAssetRoot(const std::string &path)
Definition main.cpp:138
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