mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 22:53:34 +00:00
Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
651a05c4bc | ||
|
|
1cfb8745e2 | ||
|
|
b3f3a01ee6 | ||
|
|
4acd240737 | ||
|
|
b79b8da031 | ||
|
|
bc7ef4484f | ||
|
|
9db5515fb5 | ||
|
|
387a1f5632 | ||
|
|
0babc2235f | ||
|
|
1a9a6ec6f8 | ||
|
|
d59d9f285a | ||
|
|
d16af1c4a8 | ||
|
|
5dcc2045d6 | ||
|
|
19ce912afe | ||
|
|
890e301b78 | ||
|
|
218a97e4ec | ||
|
|
74e5e35f5a | ||
|
|
e6298b1dc3 | ||
|
|
df860a5a64 | ||
|
|
b22064035a | ||
|
|
197c71021b | ||
|
|
d5fa70d7ab | ||
|
|
fd8e98f1ce | ||
|
|
0e10e5f8e1 | ||
|
|
689c9b3ed4 | ||
|
|
ecd43dedc5 | ||
|
|
dea507ec0e |
75
.github/workflows/windows.yml
vendored
git.filemode.normal_file
75
.github/workflows/windows.yml
vendored
git.filemode.normal_file
@@ -0,0 +1,75 @@
|
|||||||
|
name: Windows (xmake)
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
paths-ignore:
|
||||||
|
- '.gitignore'
|
||||||
|
- 'LICENSE'
|
||||||
|
- 'README.md'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [windows-latest]
|
||||||
|
arch: [x64]
|
||||||
|
mode: [release]
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Get current date as package key
|
||||||
|
id: cache_key
|
||||||
|
run: echo "key=$(date +'%W')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# Install system dependencies
|
||||||
|
- name: Install Vulkan SDK
|
||||||
|
uses: humbletim/install-vulkan-sdk@v1.1.1
|
||||||
|
with:
|
||||||
|
version: 1.3.204.1
|
||||||
|
cache: true
|
||||||
|
|
||||||
|
# Force xmake to a specific folder (for cache)
|
||||||
|
- name: Set xmake env
|
||||||
|
run: echo "XMAKE_GLOBALDIR=${{ runner.workspace }}/xmake-global" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
# Install xmake
|
||||||
|
- name: Setup xmake
|
||||||
|
uses: xmake-io/github-action-setup-xmake@v1
|
||||||
|
with:
|
||||||
|
xmake-version: branch@master
|
||||||
|
actions-cache-folder: .xmake-cache-W${{ steps.cache_key.outputs.key }}
|
||||||
|
|
||||||
|
# Update xmake repository (in order to have the file that will be cached)
|
||||||
|
- name: Update xmake repository
|
||||||
|
run: xmake repo --update
|
||||||
|
|
||||||
|
# Fetch xmake dephash
|
||||||
|
- name: Retrieve dependencies hash
|
||||||
|
id: dep_hash
|
||||||
|
run: echo "hash=$(xmake l utils.ci.packageskey)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# Cache xmake dependencies
|
||||||
|
- name: Retrieve cached xmake dependencies
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
|
||||||
|
key: Windows-${{ matrix.arch }}-${{ matrix.mode }}-${{ steps.dep_hash.outputs.hash }}-W${{ steps.cache_key.outputs.key }}
|
||||||
|
|
||||||
|
# Setup compilation mode and install project dependencies
|
||||||
|
- name: Configure xmake and install dependencies
|
||||||
|
run: xmake config --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --yes
|
||||||
|
|
||||||
|
# Build the mlx
|
||||||
|
- name: Build MacroLibX
|
||||||
|
run: xmake --yes
|
||||||
|
|
||||||
|
# Build the test
|
||||||
|
- name: Build Test
|
||||||
|
run: xmake build --yes Test
|
||||||
13
.gitignore
vendored
13
.gitignore
vendored
@@ -4,5 +4,18 @@
|
|||||||
*.a
|
*.a
|
||||||
*.so
|
*.so
|
||||||
*.out
|
*.out
|
||||||
|
*.dll
|
||||||
|
*.lib
|
||||||
|
*.exp
|
||||||
|
*.json
|
||||||
|
*.tmp
|
||||||
|
*.ilk
|
||||||
|
*.pdb
|
||||||
|
*.exe
|
||||||
|
.vs/
|
||||||
|
.xmake/
|
||||||
.cache/
|
.cache/
|
||||||
|
objs/
|
||||||
|
build/
|
||||||
test/.gdb_history
|
test/.gdb_history
|
||||||
|
test/Test
|
||||||
|
|||||||
5
Makefile
5
Makefile
@@ -6,18 +6,19 @@
|
|||||||
# By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ #
|
# By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2022/10/04 16:43:41 by maldavid #+# #+# #
|
# Created: 2022/10/04 16:43:41 by maldavid #+# #+# #
|
||||||
# Updated: 2023/11/24 10:03:17 by maldavid ### ########.fr #
|
# Updated: 2023/12/07 15:25:52 by kbz_8 ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
NAME = libmlx.so
|
NAME = libmlx.so
|
||||||
|
|
||||||
SRCS = $(wildcard $(addsuffix /*.cpp, ./src/core))
|
SRCS = $(wildcard $(addsuffix /*.cpp, ./src/core))
|
||||||
|
SRCS += $(wildcard $(addsuffix /*.cpp, ./src/core/**))
|
||||||
SRCS += $(wildcard $(addsuffix /*.cpp, ./src/platform))
|
SRCS += $(wildcard $(addsuffix /*.cpp, ./src/platform))
|
||||||
SRCS += $(wildcard $(addsuffix /*.cpp, ./src/renderer))
|
SRCS += $(wildcard $(addsuffix /*.cpp, ./src/renderer))
|
||||||
SRCS += $(wildcard $(addsuffix /*.cpp, ./src/renderer/**))
|
SRCS += $(wildcard $(addsuffix /*.cpp, ./src/renderer/**))
|
||||||
|
|
||||||
OBJ_DIR = objs
|
OBJ_DIR = objs/makefile
|
||||||
OBJS = $(addprefix $(OBJ_DIR)/, $(SRCS:.cpp=.o))
|
OBJS = $(addprefix $(OBJ_DIR)/, $(SRCS:.cpp=.o))
|
||||||
|
|
||||||
OS = $(shell uname -s)
|
OS = $(shell uname -s)
|
||||||
|
|||||||
38
README.md
38
README.md
@@ -5,19 +5,20 @@
|
|||||||
<a href="https://github.com/420verfl0w/MacroLibX/actions/workflows/linux_gcc.yml"><img src="https://github.com/420verfl0w/MacroLibX/actions/workflows/linux_gcc.yml/badge.svg"></a>
|
<a href="https://github.com/420verfl0w/MacroLibX/actions/workflows/linux_gcc.yml"><img src="https://github.com/420verfl0w/MacroLibX/actions/workflows/linux_gcc.yml/badge.svg"></a>
|
||||||
<a href="https://github.com/420verfl0w/MacroLibX/actions/workflows/macos_x86.yml"><img src="https://github.com/420verfl0w/MacroLibX/actions/workflows/macos_x86.yml/badge.svg"></a>
|
<a href="https://github.com/420verfl0w/MacroLibX/actions/workflows/macos_x86.yml"><img src="https://github.com/420verfl0w/MacroLibX/actions/workflows/macos_x86.yml/badge.svg"></a>
|
||||||
</div>
|
</div>
|
||||||
|
<div align="center">
|
||||||
|
<a href="https://github.com/420verfl0w/MacroLibX/actions/workflows/windows.yml"><img src="https://github.com/420verfl0w/MacroLibX/actions/workflows/windows.yml/badge.svg"></a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
###### MacroLibX a rewrite of 42 School's MiniLibX using SDL2 and Vulkan.
|
###### MacroLibX, a rewrite of 42 School's MiniLibX using SDL2 and Vulkan.
|
||||||
The goal of this version is to provide a light, fast, and modern graphical tool while keeping the same API.
|
The goal of this version is to provide a light, fast, and modern graphical tool while keeping the same API.
|
||||||
|
|
||||||
## 🖥️ Installation
|
## 🖥️ Installation
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
|
||||||
You first need to install the proper dependencies for your operating-system.
|
You first need to install the proper dependencies for your operating-system.
|
||||||
|
|
||||||
#### 🐧 Linux
|
#### 🐧 Linux
|
||||||
|
|
||||||
Here are a few common cases for different Linux distributions:
|
Here are a few common cases for different Linux distributions:
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
@@ -38,15 +39,16 @@ sudo apt install libsdl2-2.0-0 libsdl2-dev build-essential
|
|||||||
</details>
|
</details>
|
||||||
|
|
||||||
#### 🍎 macOS
|
#### 🍎 macOS
|
||||||
|
|
||||||
[MacroLibX](#) on macOS requires [SDL2](#) and [MoltenVK](https://github.com/KhronosGroup/MoltenVK). You can install both using the [Homebrew](https://brew.sh) package manager:
|
[MacroLibX](#) on macOS requires [SDL2](#) and [MoltenVK](https://github.com/KhronosGroup/MoltenVK). You can install both using the [Homebrew](https://brew.sh) package manager:
|
||||||
```sh
|
```sh
|
||||||
brew install molten-vk
|
brew install molten-vk
|
||||||
brew install SDL2
|
brew install SDL2
|
||||||
```
|
```
|
||||||
|
|
||||||
### Clone and Build
|
### 🪟 Windows
|
||||||
|
To build on Windows you may need to use the [xmake](https://xmake.io) build. [Here's](./XMAKE_BUILD.md) how you can use it.
|
||||||
|
|
||||||
|
### Clone and Build
|
||||||
Finally, you can clone the Git repository. When inside it, run the GNU `make` command to compile MacroLibX.
|
Finally, you can clone the Git repository. When inside it, run the GNU `make` command to compile MacroLibX.
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/420verfl0w/MacroLibX.git
|
git clone https://github.com/420verfl0w/MacroLibX.git
|
||||||
@@ -54,13 +56,7 @@ cd MacroLibX
|
|||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
If you want to build using GCC you can add `TOOLCHAIN=gcc` to your `make` command
|
|
||||||
```bash
|
|
||||||
make TOOLCHAIN=gcc
|
|
||||||
```
|
|
||||||
|
|
||||||
## 🔨 Compile your project
|
## 🔨 Compile your project
|
||||||
|
|
||||||
To compile your project with MacroLibX, you just provide the shared library path in your compilation/linking command:
|
To compile your project with MacroLibX, you just provide the shared library path in your compilation/linking command:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@@ -73,16 +69,22 @@ And you can enjoy your project
|
|||||||
<img src="./res/screenshot_test.png" alt="drawing" width="400"/>
|
<img src="./res/screenshot_test.png" alt="drawing" width="400"/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
### ⚠️ Troubleshooting
|
## ⚙️ Some compilation configurations
|
||||||
|
|
||||||
#### If you run into glitches when writing or reading pixels from images
|
### 📦 Compile mode
|
||||||
|
By default the mlx is built in release mode but you can switch to debug by using `make DEBUG=true`.
|
||||||
|
|
||||||
You need to add `IMAGES_OPTIMIZED=false` to your `make` command:
|
### 🛠️ Set the toolchain
|
||||||
|
If you want to use `GCC` to build the mlx you can use `make TOOLCHAIN=gcc`
|
||||||
|
|
||||||
```sh
|
### ⚠️⚠️⚠️ 🖼️ Image optimisations ⚠️⚠️⚠️
|
||||||
# In your cloned environment, inside the MacroLibX folder
|
If you run into glitches when writing or reading pixels from images you can turn off images optimisations by using `make IMAGES_OPTIMIZED=false`.
|
||||||
make IMAGES_OPTIMIZED=false
|
|
||||||
```
|
### 🖥️ Force the integrated GPU (not recommended)
|
||||||
|
You can force the mlx to use your integrated GPU by using `make FORCE_INTEGRATED_GPU=true`. Note that there are a lot of chances that your application crashes by using that.
|
||||||
|
|
||||||
|
### 💽 Dump the graphics memory
|
||||||
|
The mlx can dump it's graphics memory use to json files every two seconds by enabling this option `make GRAPHICS_MEMORY_DUMP=true`.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
47
XMAKE_BUILD.md
git.filemode.normal_file
47
XMAKE_BUILD.md
git.filemode.normal_file
@@ -0,0 +1,47 @@
|
|||||||
|
# 🏗️ xmake build
|
||||||
|
To build on Windows (if you don't use [WSL](https://learn.microsoft.com/en-us/windows/wsl/install)), the MacroLibX uses [xmake](https://xmake.io), a build system which will download and compile all dependencies it won't find on your computer.
|
||||||
|
|
||||||
|
## 💾 Install xmake
|
||||||
|
You can find how to install it on your system [here](https://xmake.io/#/guide/installation). Note that you can also download a [portable version](https://github.com/xmake-io/xmake/releases) of xmake if you wish not to install it.
|
||||||
|
|
||||||
|
## ⚙️ Configure the MacroLibX build
|
||||||
|
Just as the Makfile build system, you can configure how xmake should build the MacroLibX. The base command to configure it is `xmake config [opts...]` or `xmake f [opts...]`.
|
||||||
|
|
||||||
|
### 📦 Compile mode
|
||||||
|
You can configure xmake to build the mlx in debug mode or in release mode (release mode is enabled by default). To do so you can use `xmake config --mode=debug` or `xmake config --mode=release`.
|
||||||
|
|
||||||
|
### 🛠️ Set the toolchain
|
||||||
|
To change the compilation toolchain you can use `xmake config --toolchain=[gcc|clang|...]`
|
||||||
|
|
||||||
|
### ⚠️⚠️⚠️ 🖼️ Image optimisations ⚠️⚠️⚠️
|
||||||
|
If you run into glitches when writing or reading pixels from images you can turn off images optimisations by using `xmake config --images_optimized=n`.
|
||||||
|
|
||||||
|
### 🖥️ Force the integrated GPU (not recommended)
|
||||||
|
You can force the mlx to use your integrated GPU using `xmake config --force_integrated_gpu=y`. Note that there are a lot of chances that your application crashes by using that.
|
||||||
|
|
||||||
|
### 💽 Dump the graphics memory
|
||||||
|
The mlx can dump it's graphics memory use to json files every two seconds by enabling this option `xmake config --graphics_memory_dump=y`.
|
||||||
|
|
||||||
|
### 🪛 A possible build configuration
|
||||||
|
As a configuration example here's how the command can look like `xmake config --mode=debug --toolchain=clang --graphics_memory_dump=y --images_optimized=n`
|
||||||
|
|
||||||
|
## 🚧 Build the lib
|
||||||
|
|
||||||
|
### Compile using command-line (first method)
|
||||||
|
Once you're ready to compile the lib, run `xmake` (or `xmake -jX` if you wish not to use all your computer threads, with X being the number of threads you wish to use) and watch as the lib compiles.
|
||||||
|
|
||||||
|
### Generate a project (second method)
|
||||||
|
xmake can also generate a project file for another tool:
|
||||||
|
* Visual Studio : `xmake project -k vs`
|
||||||
|
* CMakeLists.txt (which you can open in CLion and more) : `xmake project -k cmake`
|
||||||
|
* Makefile : `xmake project -k make`
|
||||||
|
* Ninja : `xmake project -k ninja`
|
||||||
|
* XCode : `xmake project -k xcode`
|
||||||
|
|
||||||
|
You should now be able to open the project file with the tool of your choice.
|
||||||
|
|
||||||
|
## 😋 Enjoy
|
||||||
|
Enjoy you project built with the mlx
|
||||||
|
<p align="center">
|
||||||
|
<img src="./res/screenshot_test_windows.png" alt="drawing" width="400"/>
|
||||||
|
</p>
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/04 16:56:35 by maldavid #+# #+# */
|
/* Created: 2022/10/04 16:56:35 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/23 14:32:06 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 18:07:40 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -15,6 +15,20 @@
|
|||||||
#ifndef __MACRO_LIB_X_H__
|
#ifndef __MACRO_LIB_X_H__
|
||||||
#define __MACRO_LIB_X_H__
|
#define __MACRO_LIB_X_H__
|
||||||
|
|
||||||
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
|
#define MLX_EXPORT __declspec(dllexport)
|
||||||
|
#define MLX_IMPORT __declspec(dllimport)
|
||||||
|
#else
|
||||||
|
#define MLX_EXPORT
|
||||||
|
#define MLX_IMPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MLX_BUILD
|
||||||
|
#define MLX_API MLX_EXPORT
|
||||||
|
#else
|
||||||
|
#define MLX_API MLX_IMPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@@ -25,7 +39,8 @@ typedef enum
|
|||||||
MLX_KEYUP = 1,
|
MLX_KEYUP = 1,
|
||||||
MLX_MOUSEDOWN = 2,
|
MLX_MOUSEDOWN = 2,
|
||||||
MLX_MOUSEUP = 3,
|
MLX_MOUSEUP = 3,
|
||||||
MLX_WINDOW_EVENT = 4
|
MLX_MOUSEWHEEL = 4,
|
||||||
|
MLX_WINDOW_EVENT = 5
|
||||||
} mlx_event_type;
|
} mlx_event_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,7 +48,7 @@ typedef enum
|
|||||||
*
|
*
|
||||||
* @return (void*) An opaque pointer to the internal MLX application or NULL (0x0) in case of error
|
* @return (void*) An opaque pointer to the internal MLX application or NULL (0x0) in case of error
|
||||||
*/
|
*/
|
||||||
void* mlx_init();
|
MLX_API void* mlx_init();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates a new window
|
* @brief Creates a new window
|
||||||
@@ -45,7 +60,7 @@ void* mlx_init();
|
|||||||
*
|
*
|
||||||
* @return (void*) An opaque pointer to the internal MLX window or NULL (0x0) in case of error
|
* @return (void*) An opaque pointer to the internal MLX window or NULL (0x0) in case of error
|
||||||
*/
|
*/
|
||||||
void* mlx_new_window(void* mlx, int w, int h, const char* title);
|
MLX_API void* mlx_new_window(void* mlx, int w, int h, const char* title);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gives a function to be executed at each loop turn
|
* @brief Gives a function to be executed at each loop turn
|
||||||
@@ -57,7 +72,7 @@ void* mlx_new_window(void* mlx, int w, int h, const char* title);
|
|||||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int mlx_loop_hook(void* mlx, int (*f)(), void* param);
|
MLX_API int mlx_loop_hook(void* mlx, int (*f)(void*), void* param);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Starts the internal main loop
|
* @brief Starts the internal main loop
|
||||||
@@ -66,7 +81,7 @@ int mlx_loop_hook(void* mlx, int (*f)(), void* param);
|
|||||||
*
|
*
|
||||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||||
*/
|
*/
|
||||||
int mlx_loop(void* mlx);
|
MLX_API int mlx_loop(void* mlx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Ends the internal main loop
|
* @brief Ends the internal main loop
|
||||||
@@ -75,21 +90,21 @@ int mlx_loop(void* mlx);
|
|||||||
*
|
*
|
||||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||||
*/
|
*/
|
||||||
int mlx_loop_end(void* mlx);
|
MLX_API int mlx_loop_end(void* mlx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Shows mouse cursor
|
* @brief Shows mouse cursor
|
||||||
*
|
*
|
||||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||||
*/
|
*/
|
||||||
int mlx_mouse_show();
|
MLX_API int mlx_mouse_show();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Hides mouse cursor
|
* @brief Hides mouse cursor
|
||||||
*
|
*
|
||||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||||
*/
|
*/
|
||||||
int mlx_mouse_hide();
|
MLX_API int mlx_mouse_hide();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Moves cursor to givent position
|
* @brief Moves cursor to givent position
|
||||||
@@ -101,7 +116,7 @@ int mlx_mouse_hide();
|
|||||||
*
|
*
|
||||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||||
*/
|
*/
|
||||||
int mlx_mouse_move(void* mlx, void* win, int x, int y);
|
MLX_API int mlx_mouse_move(void* mlx, void* win, int x, int y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get cursor's position
|
* @brief Get cursor's position
|
||||||
@@ -112,7 +127,7 @@ int mlx_mouse_move(void* mlx, void* win, int x, int y);
|
|||||||
*
|
*
|
||||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||||
*/
|
*/
|
||||||
int mlx_mouse_get_pos(void* mlx, int* x, int* y);
|
MLX_API int mlx_mouse_get_pos(void* mlx, int* x, int* y);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -126,7 +141,7 @@ int mlx_mouse_get_pos(void* mlx, int* x, int* y);
|
|||||||
*
|
*
|
||||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||||
*/
|
*/
|
||||||
int mlx_on_event(void* mlx, void* win, mlx_event_type event, int (*f)(), void* param);
|
MLX_API int mlx_on_event(void* mlx, void* win, mlx_event_type event, int (*f)(int, void*), void* param);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -143,7 +158,7 @@ int mlx_on_event(void* mlx, void* win, mlx_event_type event, int (*f)(), void* p
|
|||||||
*
|
*
|
||||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||||
*/
|
*/
|
||||||
int mlx_pixel_put(void* mlx, void* win, int x, int y, int color);
|
MLX_API int mlx_pixel_put(void* mlx, void* win, int x, int y, int color);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -155,7 +170,7 @@ int mlx_pixel_put(void* mlx, void* win, int x, int y, int color);
|
|||||||
*
|
*
|
||||||
* @return (void*) An opaque pointer to the internal image or NULL (0x0) in case of error
|
* @return (void*) An opaque pointer to the internal image or NULL (0x0) in case of error
|
||||||
*/
|
*/
|
||||||
void* mlx_new_image(void* mlx, int width, int height);
|
MLX_API void* mlx_new_image(void* mlx, int width, int height);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get image pixel data
|
* @brief Get image pixel data
|
||||||
@@ -175,7 +190,7 @@ void* mlx_new_image(void* mlx, int width, int height);
|
|||||||
* ~ make IMAGES_OPTIMIZED=false
|
* ~ make IMAGES_OPTIMIZED=false
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
int mlx_get_image_pixel(void* mlx, void* img, int x, int y);
|
MLX_API int mlx_get_image_pixel(void* mlx, void* img, int x, int y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set image pixel data
|
* @brief Set image pixel data
|
||||||
@@ -196,7 +211,7 @@ int mlx_get_image_pixel(void* mlx, void* img, int x, int y);
|
|||||||
* ~ make IMAGES_OPTIMIZED=false
|
* ~ make IMAGES_OPTIMIZED=false
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
void mlx_set_image_pixel(void* mlx, void* img, int x, int y, int color);
|
MLX_API void mlx_set_image_pixel(void* mlx, void* img, int x, int y, int color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Put image to the given window
|
* @brief Put image to the given window
|
||||||
@@ -209,7 +224,7 @@ void mlx_set_image_pixel(void* mlx, void* img, int x, int y, int color);
|
|||||||
*
|
*
|
||||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||||
*/
|
*/
|
||||||
int mlx_put_image_to_window(void* mlx, void* win, void* img, int x, int y);
|
MLX_API int mlx_put_image_to_window(void* mlx, void* win, void* img, int x, int y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destroys internal image
|
* @brief Destroys internal image
|
||||||
@@ -219,7 +234,7 @@ int mlx_put_image_to_window(void* mlx, void* win, void* img, int x, int y);
|
|||||||
*
|
*
|
||||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||||
*/
|
*/
|
||||||
int mlx_destroy_image(void* mlx, void* img);
|
MLX_API int mlx_destroy_image(void* mlx, void* img);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -232,7 +247,7 @@ int mlx_destroy_image(void* mlx, void* img);
|
|||||||
*
|
*
|
||||||
* @return (void*) An opaque pointer to the internal image or NULL (0x0) in case of error
|
* @return (void*) An opaque pointer to the internal image or NULL (0x0) in case of error
|
||||||
*/
|
*/
|
||||||
void* mlx_png_file_to_image(void* mlx, char* filename, int* width, int* height);
|
MLX_API void* mlx_png_file_to_image(void* mlx, char* filename, int* width, int* height);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create a new image from a jpg file
|
* @brief Create a new image from a jpg file
|
||||||
@@ -244,7 +259,7 @@ void* mlx_png_file_to_image(void* mlx, char* filename, int* width, int* height);
|
|||||||
*
|
*
|
||||||
* @return (void*) An opaque pointer to the internal image or NULL (0x0) in case of error
|
* @return (void*) An opaque pointer to the internal image or NULL (0x0) in case of error
|
||||||
*/
|
*/
|
||||||
void* mlx_jpg_file_to_image(void* mlx, char* filename, int* width, int* height);
|
MLX_API void* mlx_jpg_file_to_image(void* mlx, char* filename, int* width, int* height);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create a new image from a bmp file
|
* @brief Create a new image from a bmp file
|
||||||
@@ -256,7 +271,7 @@ void* mlx_jpg_file_to_image(void* mlx, char* filename, int* width, int* height);
|
|||||||
*
|
*
|
||||||
* @return (void*) An opaque pointer to the internal image or NULL (0x0) in case of error
|
* @return (void*) An opaque pointer to the internal image or NULL (0x0) in case of error
|
||||||
*/
|
*/
|
||||||
void* mlx_bmp_file_to_image(void* mlx, char* filename, int* width, int* height);
|
MLX_API void* mlx_bmp_file_to_image(void* mlx, char* filename, int* width, int* height);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -271,7 +286,7 @@ void* mlx_bmp_file_to_image(void* mlx, char* filename, int* width, int* height);
|
|||||||
*
|
*
|
||||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||||
*/
|
*/
|
||||||
int mlx_string_put(void* mlx, void* win, int x, int y, int color, char* str);
|
MLX_API int mlx_string_put(void* mlx, void* win, int x, int y, int color, char* str);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -283,7 +298,7 @@ int mlx_string_put(void* mlx, void* win, int x, int y, int color, char* str);
|
|||||||
*
|
*
|
||||||
* @return (void)
|
* @return (void)
|
||||||
*/
|
*/
|
||||||
void mlx_set_font(void* mlx, void* win, char* filepath);
|
MLX_API void mlx_set_font(void* mlx, void* win, char* filepath);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Loads a font to be used by `mlx_string_put` and scales it
|
* @brief Loads a font to be used by `mlx_string_put` and scales it
|
||||||
@@ -295,7 +310,7 @@ void mlx_set_font(void* mlx, void* win, char* filepath);
|
|||||||
*
|
*
|
||||||
* @return (void)
|
* @return (void)
|
||||||
*/
|
*/
|
||||||
void mlx_set_font_scale(void* mlx, void* win, char* filepath, float scale);
|
MLX_API void mlx_set_font_scale(void* mlx, void* win, char* filepath, float scale);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -306,7 +321,7 @@ void mlx_set_font_scale(void* mlx, void* win, char* filepath, float scale);
|
|||||||
*
|
*
|
||||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||||
*/
|
*/
|
||||||
int mlx_clear_window(void* mlx, void* win);
|
MLX_API int mlx_clear_window(void* mlx, void* win);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -317,7 +332,7 @@ int mlx_clear_window(void* mlx, void* win);
|
|||||||
*
|
*
|
||||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||||
*/
|
*/
|
||||||
int mlx_destroy_window(void* mlx, void* win);
|
MLX_API int mlx_destroy_window(void* mlx, void* win);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destroy internal MLX application
|
* @brief Destroy internal MLX application
|
||||||
@@ -326,7 +341,7 @@ int mlx_destroy_window(void* mlx, void* win);
|
|||||||
*
|
*
|
||||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||||
*/
|
*/
|
||||||
int mlx_destroy_display(void* mlx);
|
MLX_API int mlx_destroy_display(void* mlx);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -338,7 +353,7 @@ int mlx_destroy_display(void* mlx);
|
|||||||
*
|
*
|
||||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||||
*/
|
*/
|
||||||
int mlx_get_screens_size(void* mlx, int* w, int* h);
|
MLX_API int mlx_get_screens_size(void* mlx, int* w, int* h);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
res/logo.png
BIN
res/logo.png
Binary file not shown.
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.1 KiB |
BIN
res/screenshot_test_windows.png
git.filemode.normal_file
BIN
res/screenshot_test_windows.png
git.filemode.normal_file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/04 22:10:52 by maldavid #+# #+# */
|
/* Created: 2022/10/04 22:10:52 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/20 07:29:12 by maldavid ### ########.fr */
|
/* Updated: 2023/12/09 17:44:13 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ namespace mlx::core
|
|||||||
|
|
||||||
if(_loop_hook)
|
if(_loop_hook)
|
||||||
_loop_hook(_param);
|
_loop_hook(_param);
|
||||||
|
|
||||||
for(auto& gs : _graphics)
|
for(auto& gs : _graphics)
|
||||||
gs->endRender();
|
gs->endRender();
|
||||||
}
|
}
|
||||||
@@ -66,6 +66,7 @@ namespace mlx::core
|
|||||||
|
|
||||||
Application::~Application()
|
Application::~Application()
|
||||||
{
|
{
|
||||||
|
SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_EVENTS);
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/04 21:49:46 by maldavid #+# #+# */
|
/* Created: 2022/10/04 21:49:46 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/23 14:25:43 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 18:52:47 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include <core/graphics.h>
|
#include <core/graphics.h>
|
||||||
#include <platform/inputs.h>
|
#include <platform/inputs.h>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx::core
|
namespace mlx::core
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/04 17:35:20 by maldavid #+# #+# */
|
/* Created: 2022/10/04 17:35:20 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/25 10:12:36 by maldavid ### ########.fr */
|
/* Updated: 2023/12/07 23:05:05 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include <renderer/core/render_core.h>
|
#include <renderer/core/render_core.h>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#include <mlx.h>
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
@@ -26,34 +27,34 @@ extern "C"
|
|||||||
mlx::core::error::report(e_kind::error, "MLX cannot be initialized multiple times");
|
mlx::core::error::report(e_kind::error, "MLX cannot be initialized multiple times");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
mlx::Render_Core::get().init();
|
|
||||||
mlx::core::Application* app = new mlx::core::Application;
|
mlx::core::Application* app = new mlx::core::Application;
|
||||||
|
mlx::Render_Core::get().init();
|
||||||
if(app == nullptr)
|
if(app == nullptr)
|
||||||
mlx::core::error::report(e_kind::fatal_error, "Tout a pété");
|
mlx::core::error::report(e_kind::fatal_error, "Tout a pété");
|
||||||
init = true;
|
init = true;
|
||||||
return app;
|
return static_cast<void*>(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* mlx_new_window(mlx::core::Application* mlx, int w, int h, const char* title)
|
void* mlx_new_window(void* mlx, int w, int h, const char* title)
|
||||||
{
|
{
|
||||||
return mlx->newGraphicsSuport(w, h, title);
|
return static_cast<mlx::core::Application*>(mlx)->newGraphicsSuport(w, h, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_loop_hook(mlx::core::Application* mlx, int (*f)(void*), void* param)
|
int mlx_loop_hook(void* mlx, int (*f)(void*), void* param)
|
||||||
{
|
{
|
||||||
mlx->loopHook(f, param);
|
static_cast<mlx::core::Application*>(mlx)->loopHook(f, param);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_loop(mlx::core::Application* mlx)
|
int mlx_loop(void* mlx)
|
||||||
{
|
{
|
||||||
mlx->run();
|
static_cast<mlx::core::Application*>(mlx)->run();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_loop_end(mlx::core::Application* mlx)
|
int mlx_loop_end(void* mlx)
|
||||||
{
|
{
|
||||||
mlx->loopEnd();
|
static_cast<mlx::core::Application*>(mlx)->loopEnd();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,57 +68,57 @@ extern "C"
|
|||||||
return SDL_ShowCursor(SDL_DISABLE);
|
return SDL_ShowCursor(SDL_DISABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_mouse_move(mlx::core::Application* mlx, void* win, int x, int y)
|
int mlx_mouse_move(void* mlx, void* win, int x, int y)
|
||||||
{
|
{
|
||||||
mlx->mouseMove(win, x, y);
|
static_cast<mlx::core::Application*>(mlx)->mouseMove(win, x, y);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_mouse_get_pos(mlx::core::Application* mlx, int* x, int* y)
|
int mlx_mouse_get_pos(void* mlx, int* x, int* y)
|
||||||
{
|
{
|
||||||
mlx->getMousePos(x, y);
|
static_cast<mlx::core::Application*>(mlx)->getMousePos(x, y);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_on_event(mlx::core::Application* mlx, void* win, int event, int (*funct_ptr)(int, void*), void* param)
|
int mlx_on_event(void* mlx, void* win, mlx_event_type event, int (*funct_ptr)(int, void*), void* param)
|
||||||
{
|
{
|
||||||
mlx->onEvent(win, event, funct_ptr, param);
|
static_cast<mlx::core::Application*>(mlx)->onEvent(win, static_cast<int>(event), funct_ptr, param);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* mlx_new_image(mlx::core::Application* mlx, int width, int height)
|
void* mlx_new_image(void* mlx, int width, int height)
|
||||||
{
|
{
|
||||||
return mlx->newTexture(width, height);
|
return static_cast<mlx::core::Application*>(mlx)->newTexture(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_get_image_pixel(mlx::core::Application* mlx, void* img, int x, int y)
|
int mlx_get_image_pixel(void* mlx, void* img, int x, int y)
|
||||||
{
|
{
|
||||||
return mlx->getTexturePixel(img, x, y);
|
return static_cast<mlx::core::Application*>(mlx)->getTexturePixel(img, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mlx_set_image_pixel(mlx::core::Application* mlx, void* img, int x, int y, int color)
|
void mlx_set_image_pixel(void* mlx, void* img, int x, int y, int color)
|
||||||
{
|
{
|
||||||
unsigned char color_bits[4];
|
unsigned char color_bits[4];
|
||||||
color_bits[0] = (color & 0x00FF0000) >> 16;
|
color_bits[0] = (color & 0x00FF0000) >> 16;
|
||||||
color_bits[1] = (color & 0x0000FF00) >> 8;
|
color_bits[1] = (color & 0x0000FF00) >> 8;
|
||||||
color_bits[2] = (color & 0x000000FF);
|
color_bits[2] = (color & 0x000000FF);
|
||||||
color_bits[3] = (color & 0xFF000000) >> 24;
|
color_bits[3] = (color & 0xFF000000) >> 24;
|
||||||
mlx->setTexturePixel(img, x, y, *reinterpret_cast<unsigned int*>(color_bits));
|
static_cast<mlx::core::Application*>(mlx)->setTexturePixel(img, x, y, *reinterpret_cast<unsigned int*>(color_bits));
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_put_image_to_window(mlx::core::Application* mlx, void* win, void* img, int x, int y)
|
int mlx_put_image_to_window(void* mlx, void* win, void* img, int x, int y)
|
||||||
{
|
{
|
||||||
mlx->texturePut(win, img, x, y);
|
static_cast<mlx::core::Application*>(mlx)->texturePut(win, img, x, y);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_destroy_image(mlx::core::Application* mlx, void* img)
|
int mlx_destroy_image(void* mlx, void* img)
|
||||||
{
|
{
|
||||||
mlx->destroyTexture(img);
|
static_cast<mlx::core::Application*>(mlx)->destroyTexture(img);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* mlx_png_file_to_image(mlx::core::Application* mlx, char* filename, int* width, int* height)
|
void* mlx_png_file_to_image(void* mlx, char* filename, int* width, int* height)
|
||||||
{
|
{
|
||||||
std::filesystem::path file(filename);
|
std::filesystem::path file(filename);
|
||||||
if(file.extension() != ".png")
|
if(file.extension() != ".png")
|
||||||
@@ -125,10 +126,10 @@ extern "C"
|
|||||||
mlx::core::error::report(e_kind::error, "PNG loader : not a png file '%s'", filename);
|
mlx::core::error::report(e_kind::error, "PNG loader : not a png file '%s'", filename);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return mlx->newStbTexture(filename, width, height);
|
return static_cast<mlx::core::Application*>(mlx)->newStbTexture(filename, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* mlx_jpg_file_to_image(mlx::core::Application* mlx, char* filename, int* width, int* height)
|
void* mlx_jpg_file_to_image(void* mlx, char* filename, int* width, int* height)
|
||||||
{
|
{
|
||||||
std::filesystem::path file(filename);
|
std::filesystem::path file(filename);
|
||||||
if(file.extension() != ".jpg" && file.extension() != ".jpeg")
|
if(file.extension() != ".jpg" && file.extension() != ".jpeg")
|
||||||
@@ -136,10 +137,10 @@ extern "C"
|
|||||||
mlx::core::error::report(e_kind::error, "JPG loader : not a jpg file '%s'", filename);
|
mlx::core::error::report(e_kind::error, "JPG loader : not a jpg file '%s'", filename);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return mlx->newStbTexture(filename, width, height);
|
return static_cast<mlx::core::Application*>(mlx)->newStbTexture(filename, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* mlx_bmp_file_to_image(mlx::core::Application* mlx, char* filename, int* width, int* height)
|
void* mlx_bmp_file_to_image(void* mlx, char* filename, int* width, int* height)
|
||||||
{
|
{
|
||||||
std::filesystem::path file(filename);
|
std::filesystem::path file(filename);
|
||||||
if(file.extension() != ".bmp" && file.extension() != ".dib")
|
if(file.extension() != ".bmp" && file.extension() != ".dib")
|
||||||
@@ -147,32 +148,32 @@ extern "C"
|
|||||||
mlx::core::error::report(e_kind::error, "BMP loader : not a bmp file '%s'", filename);
|
mlx::core::error::report(e_kind::error, "BMP loader : not a bmp file '%s'", filename);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return mlx->newStbTexture(filename, width, height);
|
return static_cast<mlx::core::Application*>(mlx)->newStbTexture(filename, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_pixel_put(mlx::core::Application* mlx, void* win, int x, int y, int color)
|
int mlx_pixel_put(void* mlx, void* win, int x, int y, int color)
|
||||||
{
|
{
|
||||||
unsigned char color_bits[4];
|
unsigned char color_bits[4];
|
||||||
color_bits[0] = (color & 0x00FF0000) >> 16;
|
color_bits[0] = (color & 0x00FF0000) >> 16;
|
||||||
color_bits[1] = (color & 0x0000FF00) >> 8;
|
color_bits[1] = (color & 0x0000FF00) >> 8;
|
||||||
color_bits[2] = color & 0x000000FF;
|
color_bits[2] = color & 0x000000FF;
|
||||||
color_bits[3] = 0xFF;
|
color_bits[3] = 0xFF;
|
||||||
mlx->pixelPut(win, x, y, *reinterpret_cast<unsigned int*>(color_bits));
|
static_cast<mlx::core::Application*>(mlx)->pixelPut(win, x, y, *reinterpret_cast<unsigned int*>(color_bits));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_string_put(mlx::core::Application* mlx, void* win, int x, int y, int color, char* str)
|
int mlx_string_put(void* mlx, void* win, int x, int y, int color, char* str)
|
||||||
{
|
{
|
||||||
unsigned char color_bits[4];
|
unsigned char color_bits[4];
|
||||||
color_bits[0] = (color & 0x00FF0000) >> 16;
|
color_bits[0] = (color & 0x00FF0000) >> 16;
|
||||||
color_bits[1] = (color & 0x0000FF00) >> 8;
|
color_bits[1] = (color & 0x0000FF00) >> 8;
|
||||||
color_bits[2] = color & 0x000000FF;
|
color_bits[2] = color & 0x000000FF;
|
||||||
color_bits[3] = 0xFF;
|
color_bits[3] = 0xFF;
|
||||||
mlx->stringPut(win, x, y, *reinterpret_cast<unsigned int*>(color_bits), str);
|
static_cast<mlx::core::Application*>(mlx)->stringPut(win, x, y, *reinterpret_cast<unsigned int*>(color_bits), str);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mlx_set_font(mlx::core::Application* mlx, void* win, char* filepath)
|
void mlx_set_font(void* mlx, void* win, char* filepath)
|
||||||
{
|
{
|
||||||
std::filesystem::path file(filepath);
|
std::filesystem::path file(filepath);
|
||||||
if(file.extension() != ".ttf" && file.extension() != ".tte")
|
if(file.extension() != ".ttf" && file.extension() != ".tte")
|
||||||
@@ -180,10 +181,10 @@ extern "C"
|
|||||||
mlx::core::error::report(e_kind::error, "TTF loader : not a truetype font file '%s'", filepath);
|
mlx::core::error::report(e_kind::error, "TTF loader : not a truetype font file '%s'", filepath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mlx->loadFont(win, file, 16.f);
|
static_cast<mlx::core::Application*>(mlx)->loadFont(win, file, 16.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mlx_set_font_scale(mlx::core::Application* mlx, void* win, char* filepath, float scale)
|
void mlx_set_font_scale(void* mlx, void* win, char* filepath, float scale)
|
||||||
{
|
{
|
||||||
std::filesystem::path file(filepath);
|
std::filesystem::path file(filepath);
|
||||||
if(file.extension() != ".ttf" && file.extension() != ".tte")
|
if(file.extension() != ".ttf" && file.extension() != ".tte")
|
||||||
@@ -191,31 +192,31 @@ extern "C"
|
|||||||
mlx::core::error::report(e_kind::error, "TTF loader : not a truetype font file '%s'", filepath);
|
mlx::core::error::report(e_kind::error, "TTF loader : not a truetype font file '%s'", filepath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mlx->loadFont(win, file, scale);
|
static_cast<mlx::core::Application*>(mlx)->loadFont(win, file, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_clear_window(mlx::core::Application* mlx, void* win)
|
int mlx_clear_window(void* mlx, void* win)
|
||||||
{
|
{
|
||||||
mlx->clearGraphicsSupport(win);
|
static_cast<mlx::core::Application*>(mlx)->clearGraphicsSupport(win);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_destroy_window(mlx::core::Application* mlx, void* win)
|
int mlx_destroy_window(void* mlx, void* win)
|
||||||
{
|
{
|
||||||
mlx->destroyGraphicsSupport(win);
|
static_cast<mlx::core::Application*>(mlx)->destroyGraphicsSupport(win);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_destroy_display(mlx::core::Application* mlx)
|
int mlx_destroy_display(void* mlx)
|
||||||
{
|
{
|
||||||
delete mlx;
|
delete static_cast<mlx::core::Application*>(mlx);
|
||||||
mlx::Render_Core::get().destroy();
|
mlx::Render_Core::get().destroy();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_get_screens_size(mlx::core::Application* mlx, int* w, int* h)
|
int mlx_get_screens_size(void* mlx, int* w, int* h)
|
||||||
{
|
{
|
||||||
mlx->getScreenSize(w, h);
|
static_cast<mlx::core::Application*>(mlx)->getScreenSize(w, h);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/04 17:42:32 by maldavid #+# #+# */
|
/* Created: 2022/10/04 17:42:32 by maldavid #+# #+# */
|
||||||
/* Updated: 2022/10/08 19:06:41 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 18:53:11 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
#define __MLX_ERRORS__
|
#define __MLX_ERRORS__
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
enum class e_kind
|
enum class e_kind
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/02 15:13:55 by maldavid #+# #+# */
|
/* Created: 2023/04/02 15:13:55 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/24 20:42:15 by maldavid ### ########.fr */
|
/* Updated: 2023/12/09 16:52:08 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -77,5 +77,6 @@ namespace mlx
|
|||||||
_text_put_pipeline->destroy();
|
_text_put_pipeline->destroy();
|
||||||
_pixel_put_pipeline.destroy();
|
_pixel_put_pipeline.destroy();
|
||||||
_renderer->destroy();
|
_renderer->destroy();
|
||||||
|
_window->destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/02 14:49:49 by maldavid #+# #+# */
|
/* Created: 2023/04/02 14:49:49 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/25 09:59:39 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:04:59 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
#include <renderer/text_pipeline.h>
|
#include <renderer/text_pipeline.h>
|
||||||
#include <utils/non_copyable.h>
|
#include <utils/non_copyable.h>
|
||||||
#include <renderer/images/texture.h>
|
#include <renderer/images/texture.h>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
47
src/core/memory.cpp
git.filemode.normal_file
47
src/core/memory.cpp
git.filemode.normal_file
@@ -0,0 +1,47 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* memory.cpp :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/12/07 16:32:01 by kbz_8 #+# #+# */
|
||||||
|
/* Updated: 2023/12/08 12:56:14 by kbz_8 ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <core/memory.h>
|
||||||
|
#include <core/errors.h>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
namespace mlx
|
||||||
|
{
|
||||||
|
void* MemManager::alloc(std::size_t size)
|
||||||
|
{
|
||||||
|
void* ptr = std::malloc(size);
|
||||||
|
if(ptr != nullptr)
|
||||||
|
_blocks.push_back(ptr);
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MemManager::free(void* ptr)
|
||||||
|
{
|
||||||
|
auto it = std::find(_blocks.begin(), _blocks.end(), ptr);
|
||||||
|
if(it == _blocks.end())
|
||||||
|
{
|
||||||
|
core::error::report(e_kind::error, "Memory Manager : trying to free a pointer not allocated by the memory manager");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
std::free(*it);
|
||||||
|
_blocks.erase(it);
|
||||||
|
}
|
||||||
|
|
||||||
|
MemManager::~MemManager()
|
||||||
|
{
|
||||||
|
std::for_each(_blocks.begin(), _blocks.end(), [](void* ptr)
|
||||||
|
{
|
||||||
|
std::free(ptr);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
39
src/core/memory.h
git.filemode.normal_file
39
src/core/memory.h
git.filemode.normal_file
@@ -0,0 +1,39 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* memory.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/12/07 16:31:51 by kbz_8 #+# #+# */
|
||||||
|
/* Updated: 2023/12/08 19:05:15 by kbz_8 ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef __MLX_MEMORY__
|
||||||
|
#define __MLX_MEMORY__
|
||||||
|
|
||||||
|
#include <utils/singleton.h>
|
||||||
|
#include <core/profile.h>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
|
namespace mlx
|
||||||
|
{
|
||||||
|
class MemManager : public Singleton<MemManager>
|
||||||
|
{
|
||||||
|
friend class Singleton<MemManager>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void* alloc(std::size_t size);
|
||||||
|
void free(void* ptr);
|
||||||
|
|
||||||
|
private:
|
||||||
|
MemManager() = default;
|
||||||
|
~MemManager();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::list<void*> _blocks;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/11/10 08:49:17 by maldavid #+# #+# */
|
/* Created: 2023/11/10 08:49:17 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/10 09:05:56 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 18:49:38 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -41,6 +41,19 @@
|
|||||||
#warning "This compiler is not fully supported"
|
#warning "This compiler is not fully supported"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||||
|
#define MLX_PLAT_WINDOWS
|
||||||
|
#elif defined(__linux__)
|
||||||
|
#define MLX_PLAT_LINUX
|
||||||
|
#elif defined(__APPLE__) && defined(__MACH__)
|
||||||
|
#define MLX_PLAT_MACOS
|
||||||
|
#elif defined(unix) || defined(__unix__) || defined(__unix)
|
||||||
|
#define MLX_PLAT_UNIX
|
||||||
|
#else
|
||||||
|
#error "Unknown environment!"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Checking common assumptions
|
// Checking common assumptions
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/05 16:30:19 by maldavid #+# #+# */
|
/* Created: 2022/10/05 16:30:19 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/08/28 10:49:03 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 12:17:40 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -77,6 +77,23 @@ namespace mlx
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case SDL_MOUSEWHEEL:
|
||||||
|
{
|
||||||
|
if(hooks[MLX_MOUSEWHEEL].hook)
|
||||||
|
{
|
||||||
|
if(_event.wheel.y > 0) // scroll up
|
||||||
|
hooks[MLX_MOUSEWHEEL].hook(1, hooks[MLX_MOUSEWHEEL].param);
|
||||||
|
else if(_event.wheel.y < 0) // scroll down
|
||||||
|
hooks[MLX_MOUSEWHEEL].hook(2, hooks[MLX_MOUSEWHEEL].param);
|
||||||
|
|
||||||
|
if(_event.wheel.x > 0) // scroll right
|
||||||
|
hooks[MLX_MOUSEWHEEL].hook(3, hooks[MLX_MOUSEWHEEL].param);
|
||||||
|
else if(_event.wheel.x < 0) // scroll left
|
||||||
|
hooks[MLX_MOUSEWHEEL].hook(4, hooks[MLX_MOUSEWHEEL].param);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case SDL_WINDOWEVENT:
|
case SDL_WINDOWEVENT:
|
||||||
{
|
{
|
||||||
auto& win_hook = hooks[MLX_WINDOW_EVENT];
|
auto& win_hook = hooks[MLX_WINDOW_EVENT];
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/05 16:27:35 by maldavid #+# #+# */
|
/* Created: 2022/10/05 16:27:35 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/04/19 12:14:43 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 18:54:03 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -18,6 +18,8 @@
|
|||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
@@ -68,7 +70,7 @@ namespace mlx
|
|||||||
private:
|
private:
|
||||||
std::array<uint8_t, SDL_NUM_SCANCODES> _keys;
|
std::array<uint8_t, SDL_NUM_SCANCODES> _keys;
|
||||||
std::unordered_map<uint32_t, std::shared_ptr<MLX_Window>> _windows;
|
std::unordered_map<uint32_t, std::shared_ptr<MLX_Window>> _windows;
|
||||||
std::unordered_map<uint32_t, std::array<Hook, 5>> _events_hooks;
|
std::unordered_map<uint32_t, std::array<Hook, 6>> _events_hooks;
|
||||||
SDL_Event _event;
|
SDL_Event _event;
|
||||||
std::array<uint8_t, 8> _mouse;
|
std::array<uint8_t, 8> _mouse;
|
||||||
|
|
||||||
|
|||||||
@@ -6,13 +6,14 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/04 17:36:44 by maldavid #+# #+# */
|
/* Created: 2022/10/04 17:36:44 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/25 11:48:26 by maldavid ### ########.fr */
|
/* Updated: 2023/12/09 16:52:29 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include <platform/window.h>
|
#include <platform/window.h>
|
||||||
#include <core/errors.h>
|
#include <core/errors.h>
|
||||||
#include <utils/icon_mlx.h>
|
#include <utils/icon_mlx.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
@@ -40,14 +41,16 @@ namespace mlx
|
|||||||
|
|
||||||
void MLX_Window::destroy() noexcept
|
void MLX_Window::destroy() noexcept
|
||||||
{
|
{
|
||||||
if(_win)
|
std::cout << "prout" << std::endl;
|
||||||
|
if(_win != nullptr)
|
||||||
|
{
|
||||||
SDL_DestroyWindow(_win);
|
SDL_DestroyWindow(_win);
|
||||||
if(_icon)
|
_win = nullptr;
|
||||||
|
}
|
||||||
|
if(_icon != nullptr)
|
||||||
|
{
|
||||||
SDL_FreeSurface(_icon);
|
SDL_FreeSurface(_icon);
|
||||||
}
|
_icon = nullptr;
|
||||||
|
}
|
||||||
MLX_Window::~MLX_Window()
|
|
||||||
{
|
|
||||||
destroy();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/04 21:53:12 by maldavid #+# #+# */
|
/* Created: 2022/10/04 21:53:12 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/25 11:33:32 by maldavid ### ########.fr */
|
/* Updated: 2023/12/09 16:35:57 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
@@ -30,7 +31,7 @@ namespace mlx
|
|||||||
|
|
||||||
void destroy() noexcept;
|
void destroy() noexcept;
|
||||||
|
|
||||||
~MLX_Window();
|
~MLX_Window() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SDL_Surface* _icon = nullptr;
|
SDL_Surface* _icon = nullptr;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/06 23:18:52 by maldavid #+# #+# */
|
/* Created: 2022/10/06 23:18:52 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/16 13:56:19 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:05:50 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
#include <renderer/core/render_core.h>
|
#include <renderer/core/render_core.h>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/01/25 15:05:05 by maldavid #+# #+# */
|
/* Created: 2023/01/25 15:05:05 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/14 03:25:59 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:06:07 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
#include "vk_buffer.h"
|
#include "vk_buffer.h"
|
||||||
#include <renderer/renderer.h>
|
#include <renderer/renderer.h>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/06 18:45:29 by maldavid #+# #+# */
|
/* Created: 2022/10/06 18:45:29 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/14 03:26:10 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:06:28 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "vk_buffer.h"
|
#include "vk_buffer.h"
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/06 18:27:38 by maldavid #+# #+# */
|
/* Created: 2022/10/06 18:27:38 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/14 04:53:36 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:06:45 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "vk_buffer.h"
|
#include "vk_buffer.h"
|
||||||
#include <renderer/renderer.h>
|
#include <renderer/renderer.h>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/02 17:48:52 by maldavid #+# #+# */
|
/* Created: 2023/04/02 17:48:52 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/04/02 17:50:48 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:07:00 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
|
#include <core/profile.h>
|
||||||
#include <renderer/core/render_core.h>
|
#include <renderer/core/render_core.h>
|
||||||
#include <renderer/command/vk_cmd_pool.h>
|
#include <renderer/command/vk_cmd_pool.h>
|
||||||
#include <renderer/command/vk_cmd_buffer.h>
|
#include <renderer/command/vk_cmd_buffer.h>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/06 18:25:42 by maldavid #+# #+# */
|
/* Created: 2022/10/06 18:25:42 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/04/21 13:20:49 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:07:11 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
#include <renderer/core/vk_fence.h>
|
#include <renderer/core/vk_fence.h>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/06 18:24:12 by maldavid #+# #+# */
|
/* Created: 2022/10/06 18:24:12 by maldavid #+# #+# */
|
||||||
/* Updated: 2022/12/18 01:08:31 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:07:22 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
#define __MLX_VK_CMD_POOL__
|
#define __MLX_VK_CMD_POOL__
|
||||||
|
|
||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/10/20 02:13:03 by maldavid #+# #+# */
|
/* Created: 2023/10/20 02:13:03 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/14 09:46:32 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:07:34 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
#include <vma.h>
|
#include <vma.h>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,7 +24,11 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#warning "MLX is being compiled in debug mode, this activates Vulkan's validation layers and debug messages which may impact rendering performances"
|
#ifndef MLX_COMPILER_MSVC
|
||||||
|
#warning "MLX is being compiled in debug mode, this activates Vulkan's validation layers and debug messages which may impact rendering performances"
|
||||||
|
#else
|
||||||
|
#pragma NOTE("MLX is being compiled in debug mode, this activates Vulkan's validation layers and debug messages which may impact rendering performances")
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/08 19:16:32 by maldavid #+# #+# */
|
/* Created: 2022/10/08 19:16:32 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/20 07:20:43 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 18:53:36 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include <utils/singleton.h>
|
#include <utils/singleton.h>
|
||||||
#include <core/errors.h>
|
#include <core/errors.h>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/08 19:13:42 by maldavid #+# #+# */
|
/* Created: 2022/10/08 19:13:42 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/11 01:51:26 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:07:49 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
#include "vk_queues.h"
|
#include "vk_queues.h"
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/02 17:52:09 by maldavid #+# #+# */
|
/* Created: 2023/04/02 17:52:09 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/04/02 17:52:59 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:08:01 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
#define __MLX_VK_FENCE__
|
#define __MLX_VK_FENCE__
|
||||||
|
|
||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
|
#include <core/profile.h>
|
||||||
#include <renderer/core/render_core.h>
|
#include <renderer/core/render_core.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/08 19:03:04 by maldavid #+# #+# */
|
/* Created: 2022/10/08 19:03:04 by maldavid #+# #+# */
|
||||||
/* Updated: 2022/12/18 17:42:08 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:08:14 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/08 19:01:49 by maldavid #+# #+# */
|
/* Created: 2022/10/08 19:01:49 by maldavid #+# #+# */
|
||||||
/* Updated: 2022/12/18 22:44:37 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:08:25 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/08 18:59:38 by maldavid #+# #+# */
|
/* Created: 2022/10/08 18:59:38 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/04/02 17:55:10 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:08:36 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/08 18:57:55 by maldavid #+# #+# */
|
/* Created: 2022/10/08 18:57:55 by maldavid #+# #+# */
|
||||||
/* Updated: 2022/12/18 19:34:04 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:08:49 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: maldavid <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/12/19 14:04:25 by maldavid #+# #+# */
|
/* Created: 2022/12/19 14:04:25 by maldavid #+# #+# */
|
||||||
/* Updated: 2022/12/19 14:05:19 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:09:02 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
#define __VK_VALIDATION_LAYERS__
|
#define __VK_VALIDATION_LAYERS__
|
||||||
|
|
||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/01/23 18:32:43 by maldavid #+# #+# */
|
/* Created: 2023/01/23 18:32:43 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/01/23 18:44:40 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:09:20 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/01/23 18:40:44 by maldavid #+# #+# */
|
/* Created: 2023/01/23 18:40:44 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/12 01:14:52 by maldavid ### ########.fr */
|
/* Updated: 2023/12/07 20:00:13 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/01/23 18:39:36 by maldavid #+# #+# */
|
/* Created: 2023/01/23 18:39:36 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/03/31 17:28:36 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:09:31 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <core/profile.h>
|
||||||
#include <renderer/core/render_core.h>
|
#include <renderer/core/render_core.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/01/23 18:36:22 by maldavid #+# #+# */
|
/* Created: 2023/01/23 18:36:22 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/03/31 17:54:03 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:09:44 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/03/08 02:24:58 by maldavid #+# #+# */
|
/* Created: 2023/03/08 02:24:58 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/25 10:01:35 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:10:09 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
#include <renderer/descriptors/vk_descriptor_set.h>
|
#include <renderer/descriptors/vk_descriptor_set.h>
|
||||||
#include <renderer/buffers/vk_ibo.h>
|
#include <renderer/buffers/vk_ibo.h>
|
||||||
#include <renderer/buffers/vk_vbo.h>
|
#include <renderer/buffers/vk_vbo.h>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/07 16:36:33 by maldavid #+# #+# */
|
/* Created: 2023/04/07 16:36:33 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/14 05:36:30 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:10:22 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
#include <renderer/images/texture.h>
|
#include <renderer/images/texture.h>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
@@ -28,7 +29,7 @@ namespace mlx
|
|||||||
void render(class Renderer& renderer, int x, int y, uint32_t ibo_size);
|
void render(class Renderer& renderer, int x, int y, uint32_t ibo_size);
|
||||||
void destroy() noexcept override;
|
void destroy() noexcept override;
|
||||||
|
|
||||||
inline void setDescriptor(DescriptorSet set) noexcept { _set = std::move(set); }
|
inline void setDescriptor(DescriptorSet&& set) noexcept { _set = set; }
|
||||||
inline VkDescriptorSet getSet() noexcept { return _set.isInit() ? _set.get() : VK_NULL_HANDLE; }
|
inline VkDescriptorSet getSet() noexcept { return _set.isInit() ? _set.get() : VK_NULL_HANDLE; }
|
||||||
inline void updateSet(int binding) noexcept { _set.writeDescriptor(binding, getImageView(), getSampler()); }
|
inline void updateSet(int binding) noexcept { _set.writeDescriptor(binding, getImageView(), getSampler()); }
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/01/25 11:54:21 by maldavid #+# #+# */
|
/* Created: 2023/01/25 11:54:21 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/18 17:10:05 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:10:38 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <renderer/command/vk_cmd_buffer.h>
|
#include <renderer/command/vk_cmd_buffer.h>
|
||||||
#include <renderer/command/vk_cmd_pool.h>
|
#include <renderer/command/vk_cmd_pool.h>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/12/18 21:23:52 by maldavid #+# #+# */
|
/* Created: 2022/12/18 21:23:52 by maldavid #+# #+# */
|
||||||
/* Updated: 2022/12/19 00:27:29 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:10:51 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
#define __PIPELINE__
|
#define __PIPELINE__
|
||||||
|
|
||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
|
#include <core/profile.h>
|
||||||
#include <renderer/command/vk_cmd_buffer.h>
|
#include <renderer/command/vk_cmd_buffer.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
|
|||||||
@@ -6,13 +6,14 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/03/31 13:18:50 by maldavid #+# #+# */
|
/* Created: 2023/03/31 13:18:50 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/08/02 05:27:27 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:11:43 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef __MLX_PIXEL_PUT__
|
#ifndef __MLX_PIXEL_PUT__
|
||||||
#define __MLX_PIXEL_PUT__
|
#define __MLX_PIXEL_PUT__
|
||||||
|
|
||||||
|
#include <core/profile.h>
|
||||||
#include <renderer/images/texture.h>
|
#include <renderer/images/texture.h>
|
||||||
#include <renderer/descriptors/vk_descriptor_set.h>
|
#include <renderer/descriptors/vk_descriptor_set.h>
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/12/18 17:14:45 by maldavid #+# #+# */
|
/* Created: 2022/12/18 17:14:45 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/20 07:26:12 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:12:06 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
#include <renderer/descriptors/vk_descriptor_set_layout.h>
|
#include <renderer/descriptors/vk_descriptor_set_layout.h>
|
||||||
|
|
||||||
#include <core/errors.h>
|
#include <core/errors.h>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/06 18:19:44 by maldavid #+# #+# */
|
/* Created: 2022/10/06 18:19:44 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/18 16:44:16 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:11:04 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
#define __MLX_VK_FRAMEBUFFER__
|
#define __MLX_VK_FRAMEBUFFER__
|
||||||
|
|
||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/06 18:22:00 by maldavid #+# #+# */
|
/* Created: 2022/10/06 18:22:00 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/20 07:24:48 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:11:14 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
#define __MLX_VK_RENDER_PASS__
|
#define __MLX_VK_RENDER_PASS__
|
||||||
|
|
||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/06 18:23:27 by maldavid #+# #+# */
|
/* Created: 2022/10/06 18:23:27 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/20 07:25:30 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:11:30 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
|
#include <core/profile.h>
|
||||||
#include <renderer/images/vk_image.h>
|
#include <renderer/images/vk_image.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/10 11:52:30 by maldavid #+# #+# */
|
/* Created: 2023/04/10 11:52:30 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/04/12 11:38:57 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:12:24 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/06 16:41:13 by maldavid #+# #+# */
|
/* Created: 2023/04/06 16:41:13 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/25 10:40:39 by maldavid ### ########.fr */
|
/* Updated: 2023/12/07 22:29:45 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -20,7 +20,11 @@
|
|||||||
#define STB_RECT_PACK_IMPLEMENTATION
|
#define STB_RECT_PACK_IMPLEMENTATION
|
||||||
#include <stb_rect_pack.h>
|
#include <stb_rect_pack.h>
|
||||||
|
|
||||||
|
#include <core/memory.h>
|
||||||
|
|
||||||
#define STB_TRUETYPE_IMPLEMENTATION
|
#define STB_TRUETYPE_IMPLEMENTATION
|
||||||
|
#define STB_malloc(x, u) ((void)(u), MemManager::get().alloc(x))
|
||||||
|
#define STB_free(x, u) ((void)(u), MemManager::get().free(x))
|
||||||
#include <stb_truetype.h>
|
#include <stb_truetype.h>
|
||||||
|
|
||||||
constexpr const int RANGE = 1024;
|
constexpr const int RANGE = 1024;
|
||||||
@@ -74,10 +78,10 @@ namespace mlx
|
|||||||
void TextPutPipeline::init(Renderer* renderer) noexcept
|
void TextPutPipeline::init(Renderer* renderer) noexcept
|
||||||
{
|
{
|
||||||
_renderer = renderer;
|
_renderer = renderer;
|
||||||
uint8_t tmp_bitmap[RANGE * RANGE];
|
std::vector<uint8_t> tmp_bitmap(RANGE * RANGE);
|
||||||
uint8_t vulkan_bitmap[RANGE * RANGE * 4];
|
std::vector<uint8_t> vulkan_bitmap(RANGE * RANGE * 4);
|
||||||
stbtt_pack_context pc;
|
stbtt_pack_context pc;
|
||||||
stbtt_PackBegin(&pc, tmp_bitmap, RANGE, RANGE, RANGE, 1, nullptr);
|
stbtt_PackBegin(&pc, tmp_bitmap.data(), RANGE, RANGE, RANGE, 1, nullptr);
|
||||||
stbtt_PackFontRange(&pc, dogica_ttf, 0, 6.0, 32, 96, _cdata.data());
|
stbtt_PackFontRange(&pc, dogica_ttf, 0, 6.0, 32, 96, _cdata.data());
|
||||||
stbtt_PackEnd(&pc);
|
stbtt_PackEnd(&pc);
|
||||||
for(int i = 0, j = 0; i < RANGE * RANGE; i++, j += 4)
|
for(int i = 0, j = 0; i < RANGE * RANGE; i++, j += 4)
|
||||||
@@ -87,14 +91,14 @@ namespace mlx
|
|||||||
vulkan_bitmap[j + 2] = tmp_bitmap[i];
|
vulkan_bitmap[j + 2] = tmp_bitmap[i];
|
||||||
vulkan_bitmap[j + 3] = tmp_bitmap[i];
|
vulkan_bitmap[j + 3] = tmp_bitmap[i];
|
||||||
}
|
}
|
||||||
_atlas.create(vulkan_bitmap, RANGE, RANGE, VK_FORMAT_R8G8B8A8_UNORM, "__mlx_texts_pipeline_texture_atlas", true);
|
_atlas.create(vulkan_bitmap.data(), RANGE, RANGE, VK_FORMAT_R8G8B8A8_UNORM, "__mlx_texts_pipeline_texture_atlas", true);
|
||||||
_atlas.setDescriptor(renderer->getFragDescriptorSet().duplicate());
|
_atlas.setDescriptor(renderer->getFragDescriptorSet().duplicate());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextPutPipeline::loadFont(const std::filesystem::path& filepath, float scale)
|
void TextPutPipeline::loadFont(const std::filesystem::path& filepath, float scale)
|
||||||
{
|
{
|
||||||
uint8_t tmp_bitmap[RANGE * RANGE];
|
std::vector<uint8_t> tmp_bitmap(RANGE * RANGE);
|
||||||
uint8_t vulkan_bitmap[RANGE * RANGE * 4];
|
std::vector<uint8_t> vulkan_bitmap(RANGE * RANGE * 4);
|
||||||
|
|
||||||
std::ifstream file(filepath, std::ios::binary);
|
std::ifstream file(filepath, std::ios::binary);
|
||||||
if(!file.is_open())
|
if(!file.is_open())
|
||||||
@@ -109,7 +113,7 @@ namespace mlx
|
|||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
stbtt_pack_context pc;
|
stbtt_pack_context pc;
|
||||||
stbtt_PackBegin(&pc, tmp_bitmap, RANGE, RANGE, RANGE, 1, nullptr);
|
stbtt_PackBegin(&pc, tmp_bitmap.data(), RANGE, RANGE, RANGE, 1, nullptr);
|
||||||
stbtt_PackFontRange(&pc, bytes.data(), 0, scale, 32, 96, _cdata.data());
|
stbtt_PackFontRange(&pc, bytes.data(), 0, scale, 32, 96, _cdata.data());
|
||||||
stbtt_PackEnd(&pc);
|
stbtt_PackEnd(&pc);
|
||||||
for(int i = 0, j = 0; i < RANGE * RANGE; i++, j += 4)
|
for(int i = 0, j = 0; i < RANGE * RANGE; i++, j += 4)
|
||||||
@@ -120,7 +124,7 @@ namespace mlx
|
|||||||
vulkan_bitmap[j + 3] = tmp_bitmap[i];
|
vulkan_bitmap[j + 3] = tmp_bitmap[i];
|
||||||
}
|
}
|
||||||
destroy();
|
destroy();
|
||||||
_atlas.create(vulkan_bitmap, RANGE, RANGE, VK_FORMAT_R8G8B8A8_UNORM, "__mlx_texts_pipeline_texture_atlas", true);
|
_atlas.create(vulkan_bitmap.data(), RANGE, RANGE, VK_FORMAT_R8G8B8A8_UNORM, "__mlx_texts_pipeline_texture_atlas", true);
|
||||||
_atlas.setDescriptor(_renderer->getFragDescriptorSet().duplicate());
|
_atlas.setDescriptor(_renderer->getFragDescriptorSet().duplicate());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/06 16:24:11 by maldavid #+# #+# */
|
/* Created: 2023/04/06 16:24:11 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/24 19:08:04 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:12:40 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <renderer/text_library.h>
|
#include <renderer/text_library.h>
|
||||||
|
#include <core/profile.h>
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/11 16:20:25 by maldavid #+# #+# */
|
/* Created: 2023/04/11 16:20:25 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/25 10:47:10 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 19:13:00 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|||||||
17
test/main.c
17
test/main.c
@@ -6,7 +6,7 @@
|
|||||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/10/04 17:55:21 by maldavid #+# #+# */
|
/* Created: 2022/10/04 17:55:21 by maldavid #+# #+# */
|
||||||
/* Updated: 2023/11/25 11:57:57 by maldavid ### ########.fr */
|
/* Updated: 2023/12/08 18:08:13 by kbz_8 ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -22,12 +22,14 @@ typedef struct s_mlx
|
|||||||
void *img;
|
void *img;
|
||||||
} t_mlx;
|
} t_mlx;
|
||||||
|
|
||||||
int update(t_mlx *mlx)
|
int update(void *param)
|
||||||
{
|
{
|
||||||
static int i = 0;
|
static int i = 0;
|
||||||
int j;
|
int j;
|
||||||
int k;
|
int k;
|
||||||
|
t_mlx *mlx;
|
||||||
|
|
||||||
|
mlx = (t_mlx *)param;
|
||||||
mlx_put_image_to_window(mlx->mlx, mlx->win, mlx->logo, 100, 100);
|
mlx_put_image_to_window(mlx->mlx, mlx->win, mlx->logo, 100, 100);
|
||||||
mlx_put_image_to_window(mlx->mlx, mlx->win, mlx->img, 150, 60);
|
mlx_put_image_to_window(mlx->mlx, mlx->win, mlx->img, 150, 60);
|
||||||
mlx_string_put(mlx->mlx, mlx->win, 20, 50, 0xFFFFFFFF, "that's a text");
|
mlx_string_put(mlx->mlx, mlx->win, 20, 50, 0xFFFFFFFF, "that's a text");
|
||||||
@@ -41,8 +43,7 @@ int update(t_mlx *mlx)
|
|||||||
k++;
|
k++;
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
i++;
|
if (++i == 5000)
|
||||||
if (i == 5000)
|
|
||||||
{
|
{
|
||||||
mlx_clear_window(mlx->mlx, mlx->win);
|
mlx_clear_window(mlx->mlx, mlx->win);
|
||||||
mlx_set_font_scale(mlx->mlx, mlx->win, "font.ttf", 16.f);
|
mlx_set_font_scale(mlx->mlx, mlx->win, "font.ttf", 16.f);
|
||||||
@@ -79,17 +80,17 @@ void *create_image(t_mlx *mlx)
|
|||||||
return (img);
|
return (img);
|
||||||
}
|
}
|
||||||
|
|
||||||
int key_hook(int key, t_mlx *param)
|
int key_hook(int key, void *param)
|
||||||
{
|
{
|
||||||
if (key == 41)
|
if (key == 41)
|
||||||
mlx_loop_end(param->mlx);
|
mlx_loop_end(((t_mlx *)param)->mlx);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int window_hook(int event, t_mlx *param)
|
int window_hook(int event, void *param)
|
||||||
{
|
{
|
||||||
if (event == 0)
|
if (event == 0)
|
||||||
mlx_loop_end(param->mlx);
|
mlx_loop_end(((t_mlx *)param)->mlx);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
3246
valgrind.supp
git.filemode.normal_file
3246
valgrind.supp
git.filemode.normal_file
File diff suppressed because it is too large
Load Diff
76
xmake.lua
git.filemode.normal_file
76
xmake.lua
git.filemode.normal_file
@@ -0,0 +1,76 @@
|
|||||||
|
--------------------------------------------------------------------------------
|
||||||
|
-- --
|
||||||
|
-- ::: :::::::: --
|
||||||
|
-- xmake.lua :+: :+: :+: --
|
||||||
|
-- +:+ +:+ +:+ --
|
||||||
|
-- By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ --
|
||||||
|
-- +#+#+#+#+#+ +#+ --
|
||||||
|
-- Created: 2023/12/07 15:21:38 by kbz_8 #+# #+# --
|
||||||
|
-- Updated: 2023/12/07 15:21:38 by kbz_8 ### ########.fr --
|
||||||
|
-- --
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Global settings
|
||||||
|
|
||||||
|
add_requires("libsdl", "vulkan-headers")
|
||||||
|
|
||||||
|
add_rules("mode.debug", "mode.release")
|
||||||
|
set_languages("cxx17", "c99")
|
||||||
|
|
||||||
|
set_objectdir("objs/xmake/$(os)_$(arch)")
|
||||||
|
set_targetdir("./")
|
||||||
|
|
||||||
|
set_optimize("fastest")
|
||||||
|
|
||||||
|
-- Options
|
||||||
|
|
||||||
|
option("images_optimized")
|
||||||
|
set_default(true)
|
||||||
|
add_defines("IMAGE_OPTIMIZED")
|
||||||
|
option_end()
|
||||||
|
|
||||||
|
option("force_integrated_gpu")
|
||||||
|
set_default(false)
|
||||||
|
add_defines("FORCE_INTEGRATED_GPU")
|
||||||
|
option_end()
|
||||||
|
|
||||||
|
option("graphics_memory_dump")
|
||||||
|
set_default(false)
|
||||||
|
add_defines("GRAPHICS_MEMORY_DUMP")
|
||||||
|
option_end()
|
||||||
|
|
||||||
|
-- Targets
|
||||||
|
|
||||||
|
target("mlx")
|
||||||
|
set_default(true)
|
||||||
|
set_license("MIT")
|
||||||
|
set_kind("shared")
|
||||||
|
add_options("images_optimized")
|
||||||
|
add_options("force_integrated_gpu")
|
||||||
|
add_options("graphics_memory_dump")
|
||||||
|
add_includedirs("includes", "src", "third_party")
|
||||||
|
|
||||||
|
add_defines("MLX_BUILD")
|
||||||
|
|
||||||
|
add_files("src/**.cpp")
|
||||||
|
|
||||||
|
add_packages("libsdl", "vulkan-headers")
|
||||||
|
|
||||||
|
if is_mode("debug") then
|
||||||
|
add_defines("DEBUG")
|
||||||
|
end
|
||||||
|
target_end() -- optional but I think the code is cleaner with this -- optional but I think the code is cleaner with this
|
||||||
|
|
||||||
|
target("Test")
|
||||||
|
set_default(false)
|
||||||
|
set_kind("binary")
|
||||||
|
set_targetdir("test")
|
||||||
|
|
||||||
|
add_linkdirs("./")
|
||||||
|
|
||||||
|
add_deps("mlx")
|
||||||
|
|
||||||
|
add_files("test/main.c")
|
||||||
|
|
||||||
|
add_packages("libsdl")
|
||||||
|
target_end()
|
||||||
Reference in New Issue
Block a user