Just™ Game Engine
base.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021-2022 Konstanty Misiak
3 *
4 * SPDX-License-Identifier: MIT
5 */
6
7#pragma once
8
9#define JNG_BIND_EVENT_FUNC(func) [this](auto&& ...args) -> decltype(auto) { return this->func(std::forward<decltype(args)>(args)...); }
10
11namespace jng {
12
14 {
15 protected:
16 NonCopyable() = default;
17 ~NonCopyable() = default;
18 private:
19 NonCopyable(const NonCopyable&) = delete;
20 NonCopyable& operator=(const NonCopyable&) = delete;
21 };
22
23 template<typename T>
24 using Scope = std::unique_ptr<T>;
25 template<typename T, typename ...Args>
26 constexpr Scope<T> makeScope(Args&& ...args)
27 {
28 return std::make_unique<T>(std::forward<Args>(args)...);
29 }
30
31 template<typename T>
32 using Ref = std::shared_ptr<T>;
33 template<typename T, typename ...Args>
34 constexpr Ref<T> makeRef(Args&& ...args)
35 {
36 return std::make_shared<T>(std::forward<Args>(args)...);
37 }
38
39 using u8 = uint8_t;
40 using u16 = uint16_t;
41 using u32 = uint32_t;
42 using u64 = uint64_t;
43 using s8 = int8_t;
44 using s16 = int16_t;
45 using s32 = int32_t;
46 using s64 = int64_t;
47 using f32 = float;
48 using f64 = double;
49
50} // namespace jng
51
52#include "jng/debug/assert.hpp"
53#include "jng/debug/log.hpp"
Definition: base.hpp:14
NonCopyable()=default
~NonCopyable()=default
constexpr Code T
Definition: key_codes.hpp:56
Definition: base.hpp:11
int32_t s32
Definition: base.hpp:45
constexpr Scope< T > makeScope(Args &&...args)
Definition: base.hpp:26
float f32
Definition: base.hpp:47
uint16_t u16
Definition: base.hpp:40
int16_t s16
Definition: base.hpp:44
int8_t s8
Definition: base.hpp:43
uint64_t u64
Definition: base.hpp:42
std::unique_ptr< T > Scope
Definition: base.hpp:24
uint32_t u32
Definition: base.hpp:41
double f64
Definition: base.hpp:48
constexpr Ref< T > makeRef(Args &&...args)
Definition: base.hpp:34
std::shared_ptr< T > Ref
Definition: base.hpp:32
int64_t s64
Definition: base.hpp:46
uint8_t u8
Definition: base.hpp:39