mirror of
https://github.com/Karaka-Management/cOMS.git
synced 2026-01-10 19:08:39 +00:00
optimized build script and started to split shaders. not yet working, opengl only handles one asset file and vulkan and directx still need the remaining code impl.
This commit is contained in:
parent
c1d0f65b84
commit
8c034c4a26
|
|
@ -13,7 +13,6 @@
|
|||
#include "../utils/StringUtils.h"
|
||||
#include "../utils/EndianUtils.h"
|
||||
#include "../utils/Utils.h"
|
||||
#include "../stdlib/simd/SIMD_I32.h"
|
||||
#include "../memory/RingMemory.h"
|
||||
#include "../memory/BufferMemory.h"
|
||||
#include "../image/Image.cpp"
|
||||
|
|
@ -25,6 +24,12 @@
|
|||
#include "../ui/UITheme.h"
|
||||
#include "AssetManagementSystem.h"
|
||||
|
||||
#if __aarch64__
|
||||
#include "../stdlib/sve/SVE_I32.h"
|
||||
#else
|
||||
#include "../stdlib/simd/SIMD_I32.h"
|
||||
#endif
|
||||
|
||||
#if _WIN32
|
||||
#include <windows.h>
|
||||
#include "../platform/win32/FileUtils.cpp"
|
||||
|
|
@ -277,6 +282,7 @@ Asset* asset_archive_asset_load(const AssetArchive* archive, int32 id, AssetMana
|
|||
theme_from_data(file.content, theme);
|
||||
} break;
|
||||
default: {
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,7 +144,9 @@ void camera_movement(Camera* camera, CameraMovement* movement, f32 dt, bool rela
|
|||
case CAMERA_MOVEMENT_ZOOM_OUT: {
|
||||
camera->zoom -= velocity;
|
||||
} break;
|
||||
default: {}
|
||||
default: {
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -215,7 +217,9 @@ void camera_movement(Camera* camera, CameraMovement* movement, f32 dt, bool rela
|
|||
case CAMERA_MOVEMENT_ZOOM_OUT: {
|
||||
camera->zoom -= velocity;
|
||||
} break;
|
||||
default: {}
|
||||
default: {
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,12 @@
|
|||
#include "../memory/BufferMemory.h"
|
||||
#include "../utils/EndianUtils.h"
|
||||
#include "../utils/Utils.h"
|
||||
#include "../stdlib/simd/SIMD_I32.h"
|
||||
|
||||
#if __aarch64__
|
||||
#include "../stdlib/sve/SVE_I32.h"
|
||||
#else
|
||||
#include "../stdlib/simd/SIMD_I32.h"
|
||||
#endif
|
||||
|
||||
#if _WIN32
|
||||
#include "../platform/win32/FileUtils.cpp"
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
#include "../ui/UIElement.h"
|
||||
#include "../ui/UIAlignment.h"
|
||||
|
||||
// @performance Create improved vertice generation for components (input + button, chat, ...) where we don't use as many
|
||||
// degenerate triangled
|
||||
// @performance Create improved vertex generation for components (input + button, chat, ...) where we don't use as many
|
||||
// degenerate triangle
|
||||
|
||||
// @todo in many places we use ->value_int. We should load it as a value_float and also define it as float in the theme.
|
||||
// This way we wouldn't have to convert the value
|
||||
|
|
|
|||
33
gpuapi/direct3d/GpuApiContainer.h
Normal file
33
gpuapi/direct3d/GpuApiContainer.h
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* @copyright Jingga
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
#ifndef TOS_GPUAPI_DIRECTX_GPU_API_CONTAINER
|
||||
#define TOS_GPUAPI_DIRECTX_GPU_API_CONTAINER
|
||||
|
||||
#include <windows.h>
|
||||
#include <d3d12.h>
|
||||
#include <dxgi1_6.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <wrl.h>
|
||||
|
||||
struct GpuApiContainer {
|
||||
Microsoft::WRL::ComPtr<ID3D12Device> device;
|
||||
Microsoft::WRL::ComPtr<IDXGISwapChain3> swapChain;
|
||||
|
||||
Microsoft::WRL::ComPtr<ID3D12CommandQueue> commandQueue;
|
||||
Microsoft::WRL::ComPtr<ID3D12DescriptorHeap> rtvHeap;
|
||||
Microsoft::WRL::ComPtr<ID3D12Resource> renderTargets[2];
|
||||
Microsoft::WRL::ComPtr<ID3D12CommandAllocator> commandAllocator;
|
||||
Microsoft::WRL::ComPtr<ID3D12GraphicsCommandList> commandList;
|
||||
Microsoft::WRL::ComPtr<ID3D12PipelineState> pipelineState;
|
||||
Microsoft::WRL::ComPtr<ID3D12RootSignature> rootSignature;
|
||||
Microsoft::WRL::ComPtr<ID3D12Fence> fence;
|
||||
UINT64 fenceValue = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
15
gpuapi/opengl/GpuApiContainer.h
Normal file
15
gpuapi/opengl/GpuApiContainer.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* @copyright Jingga
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
#ifndef TOS_GPUAPI_OPENGL_GPU_API_CONTAINER
|
||||
#define TOS_GPUAPI_OPENGL_GPU_API_CONTAINER
|
||||
|
||||
struct GpuApiContainer {
|
||||
};
|
||||
|
||||
#endif
|
||||
28
gpuapi/vulkan/GpuApiContainer.h
Normal file
28
gpuapi/vulkan/GpuApiContainer.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* @copyright Jingga
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
#ifndef TOS_GPUAPI_VULKAN_GPU_API_CONTAINER
|
||||
#define TOS_GPUAPI_VULKAN_GPU_API_CONTAINER
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
struct GpuApiContainer {
|
||||
VkInstance instance;
|
||||
VkSurfaceKHR surface;
|
||||
VkDevice device;
|
||||
VkSwapchainKHR swapchain;
|
||||
VkPipelineLayout pipelineLayout;
|
||||
VkFramebuffer framebuffer;
|
||||
VkQueue graphicsQueue;
|
||||
VkRenderPass renderPass;
|
||||
VkPipeline pipeline;
|
||||
VkCommandPool commandPool;
|
||||
VkCommandBuffer commandBuffer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -87,7 +87,7 @@ int32 image_pixel_size_from_type(byte type)
|
|||
return 4;
|
||||
} break;
|
||||
default: {
|
||||
return 0;
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -411,7 +411,9 @@ void log(const char* format, LogDataType data_type, void* data, bool should_log,
|
|||
case LOG_DATA_FLOAT64: {
|
||||
sprintf(temp, format, *((f64 *) data));
|
||||
} break;
|
||||
default: {}
|
||||
default: {
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
if (save || debug_container->log_memory.size - debug_container->log_memory.pos < MAX_LOG_LENGTH) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,12 @@
|
|||
#define TOS_MATH_MATRIX_VECTOR_FLOAT32_H
|
||||
|
||||
#include "../../utils/MathUtils.h"
|
||||
#include "../../stdlib/simd/SIMD_F32.h"
|
||||
|
||||
#if __aarch64__
|
||||
#include "../../../GameEngine/stdlib/sve/SVE_F32.h"
|
||||
#else
|
||||
#include "../../../GameEngine/stdlib/simd/SIMD_F32.h"
|
||||
#endif
|
||||
|
||||
struct v3_f32_4 {
|
||||
union {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@
|
|||
#define TOS_MATH_MATRIX_VECTOR_FLOAT64_H
|
||||
|
||||
#include "../../utils/MathUtils.h"
|
||||
#include "../../stdlib/simd/SIMD_F64.h"
|
||||
|
||||
#if __aarch64__
|
||||
#include "../../../GameEngine/stdlib/sve/SVE_F64.h"
|
||||
#else
|
||||
#include "../../../GameEngine/stdlib/simd/SIMD_F64.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -13,7 +13,12 @@
|
|||
#include <xmmintrin.h>
|
||||
|
||||
#include "../../utils/MathUtils.h"
|
||||
#include "../../stdlib/simd/SIMD_I32.h"
|
||||
|
||||
#if __aarch64__
|
||||
#include "../../../GameEngine/stdlib/sve/SVE_I32.h"
|
||||
#else
|
||||
#include "../../../GameEngine/stdlib/simd/SIMD_I32.h"
|
||||
#endif
|
||||
|
||||
struct v3_int32_4 {
|
||||
union {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,12 @@
|
|||
#include <xmmintrin.h>
|
||||
|
||||
#include "../../utils/MathUtils.h"
|
||||
#include "../../stdlib/simd/SIMD_I64.h"
|
||||
|
||||
#if __aarch64__
|
||||
#include "../../../GameEngine/stdlib/sve/SVE_I64.h"
|
||||
#else
|
||||
#include "../../../GameEngine/stdlib/simd/SIMD_I64.h"
|
||||
#endif
|
||||
|
||||
struct v3_int64_2 {
|
||||
union {
|
||||
|
|
|
|||
|
|
@ -14,21 +14,26 @@
|
|||
|
||||
typedef RingMemory Queue;
|
||||
|
||||
// @question Consider to add the element size into the Queue struct -> we don't need to pass it after initialization as parameter
|
||||
|
||||
inline
|
||||
void queue_alloc(Queue* queue, uint64 element_count, uint32 element_size, int32 alignment = 64)
|
||||
{
|
||||
// @bug The alignment needs to be included in EVERY element
|
||||
ring_alloc(queue, element_count * element_size, alignment);
|
||||
}
|
||||
|
||||
inline
|
||||
void queue_init(Queue* queue, BufferMemory* buf, uint64 element_count, uint32 element_size, int32 alignment = 64)
|
||||
{
|
||||
// @bug The alignment needs to be included in EVERY element
|
||||
ring_init(queue, buf, element_count * element_size, alignment);
|
||||
}
|
||||
|
||||
inline
|
||||
void queue_init(Queue* queue, byte* buf, uint64 element_count, uint32 element_size, int32 alignment = 64)
|
||||
{
|
||||
// @bug The alignment needs to be included in EVERY element
|
||||
ring_init(queue, buf, element_count * element_size, alignment);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,9 +48,12 @@ struct ThreadedQueue {
|
|||
sem_t full;
|
||||
};
|
||||
|
||||
// @question Consider to add the element size into the Queue struct -> we don't need to pass it after initialization as parameter
|
||||
|
||||
inline
|
||||
void thrd_queue_alloc(ThreadedQueue* queue, uint32 element_count, uint64 element_size, int32 alignment = 64)
|
||||
{
|
||||
// @bug The alignment needs to be included in EVERY element
|
||||
ring_alloc((RingMemory *) queue, element_count * element_size, alignment);
|
||||
|
||||
pthread_mutex_init(&queue->mutex, NULL);
|
||||
|
|
@ -63,6 +66,7 @@ void thrd_queue_alloc(ThreadedQueue* queue, uint32 element_count, uint64 element
|
|||
inline
|
||||
void thrd_queue_init(ThreadedQueue* queue, BufferMemory* buf, uint32 element_count, uint64 element_size, int32 alignment = 64)
|
||||
{
|
||||
// @bug The alignment needs to be included in EVERY element
|
||||
ring_init((RingMemory *) queue, buf, element_count * element_size, alignment);
|
||||
|
||||
pthread_mutex_init(&queue->mutex, NULL);
|
||||
|
|
@ -75,6 +79,7 @@ void thrd_queue_init(ThreadedQueue* queue, BufferMemory* buf, uint32 element_cou
|
|||
inline
|
||||
void thrd_queue_init(ThreadedQueue* queue, byte* buf, uint32 element_count, uint64 element_size, int32 alignment = 64)
|
||||
{
|
||||
// @bug The alignment needs to be included in EVERY element
|
||||
ring_init((RingMemory *) queue, buf, element_count * element_size, alignment);
|
||||
|
||||
pthread_mutex_init(&queue->mutex, NULL);
|
||||
|
|
|
|||
|
|
@ -10,11 +10,6 @@
|
|||
#define SETTING_TYPE_GPU_ULTRA 0x6
|
||||
#define SETTING_TYPE_GPU_NEXTGEN 0x7
|
||||
|
||||
#define SETTING_TYPE_GPU_API_NONE 0x0
|
||||
#define SETTING_TYPE_GPU_API_DIRECTX11 0x1
|
||||
#define SETTING_TYPE_GPU_API_DIRECTX12 0x2
|
||||
#define SETTING_TYPE_GPU_API_OPENGL 0x3
|
||||
|
||||
#define SETTING_TYPE_PERSPECTIVE_FIRST 0x00
|
||||
#define SETTING_TYPE_PERSPECTIVE_THIRD 0x01
|
||||
#define SETTING_TYPE_PERSPECTIVE_ISOMETRIC 0x02
|
||||
|
|
|
|||
|
|
@ -19,10 +19,15 @@
|
|||
#endif
|
||||
|
||||
#include "../memory/RingMemory.h"
|
||||
#include "../stdlib/simd/SIMD_I32.h"
|
||||
#include "../utils/EndianUtils.h"
|
||||
#include "../utils/StringUtils.h"
|
||||
|
||||
#if __aarch64__
|
||||
#include "../../../GameEngine/stdlib/sve/SVE_I32.h"
|
||||
#else
|
||||
#include "../../../GameEngine/stdlib/simd/SIMD_I32.h"
|
||||
#endif
|
||||
|
||||
#define MESH_VERSION 1
|
||||
|
||||
// @todo how to handle different objects and groups?
|
||||
|
|
@ -378,6 +383,9 @@ void mesh_from_file_txt(
|
|||
}
|
||||
text[i] = '\0';
|
||||
} break;
|
||||
default: {
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,12 +12,17 @@
|
|||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include "../../stdlib/Types.h"
|
||||
#include "../../stdlib/simd/SIMD_Helper.h"
|
||||
#include "../SystemInfo.h"
|
||||
#include "../../system/SystemInfo.h"
|
||||
|
||||
#include <locale.h>
|
||||
#include <cpuid.h>
|
||||
|
||||
#if __aarch64__
|
||||
#include "../../stdlib/simd/SIMD_Helper.h"
|
||||
#else
|
||||
#include "../../stdlib/sve/SVE_Helper.h"
|
||||
#endif
|
||||
|
||||
// @todo implement for arm?
|
||||
|
||||
uint16 system_language_code()
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include "../../stdlib/Types.h"
|
||||
#include "FileUtils.cpp"
|
||||
#include "../../utils/StringUtils.h"
|
||||
#include "../Library.h"
|
||||
#include "../../system/Library.h"
|
||||
|
||||
// @todo Rename file to Library.cpp
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include "../../stdlib/Types.h"
|
||||
#include "../../stdlib/simd/SIMD_Helper.h"
|
||||
#include "../SystemInfo.h"
|
||||
#include "../../system/SystemInfo.h"
|
||||
|
||||
#include <psapi.h>
|
||||
#include <winsock2.h>
|
||||
|
|
@ -27,6 +26,12 @@
|
|||
#include <winnls.h>
|
||||
#include <hidsdi.h>
|
||||
|
||||
#if __aarch64__
|
||||
#include "../../stdlib/sve/SVE_Helper.h"
|
||||
#else
|
||||
#include "../../stdlib/simd/SIMD_Helper.h"
|
||||
#endif
|
||||
|
||||
// @performance Do we really need all these libs, can't we simplify that?!
|
||||
#include <intrin.h>
|
||||
#pragma comment(lib, "Advapi32.lib")
|
||||
|
|
|
|||
|
|
@ -85,12 +85,15 @@ void window_create(Window* __restrict window, void* proc)
|
|||
|
||||
WNDPROC wndproc = (WNDPROC) proc;
|
||||
WNDCLASSEXA wc = {};
|
||||
HINSTANCE hinstance = GetModuleHandle(0);
|
||||
|
||||
if (!window->hInstance) {
|
||||
window->hInstance = GetModuleHandle(0);
|
||||
}
|
||||
|
||||
wc.cbSize = sizeof(WNDCLASSEXA);
|
||||
wc.style = CS_OWNDC;
|
||||
wc.lpfnWndProc = wndproc;
|
||||
wc.hInstance = hinstance;
|
||||
wc.hInstance = window->hInstance;
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.lpszClassName = (LPCSTR) window->name;
|
||||
|
||||
|
|
@ -123,7 +126,7 @@ void window_create(Window* __restrict window, void* proc)
|
|||
window->x, window->y,
|
||||
window->width,
|
||||
window->height,
|
||||
NULL, NULL, hinstance, window
|
||||
NULL, NULL, window->hInstance, window
|
||||
);
|
||||
|
||||
ASSERT_SIMPLE(window->hwnd);
|
||||
|
|
|
|||
|
|
@ -11,24 +11,9 @@
|
|||
|
||||
#include <windows.h>
|
||||
#include "../../stdlib/Types.h"
|
||||
#include "../../system/Window.h"
|
||||
|
||||
struct WindowState {
|
||||
uint16 width;
|
||||
uint16 height;
|
||||
|
||||
uint16 x;
|
||||
uint16 y;
|
||||
uint64 style;
|
||||
};
|
||||
|
||||
enum WindowStateChanges : byte {
|
||||
WINDOW_STATE_CHANGE_NONE = 0,
|
||||
WINDOW_STATE_CHANGE_SIZE = 1,
|
||||
WINDOW_STATE_CHANGE_POS = 2,
|
||||
WINDOW_STATE_CHANGE_FOCUS = 4,
|
||||
WINDOW_STATE_CHANGE_FULLSCREEN = 8,
|
||||
WINDOW_STATE_CHANGE_ALL = 16,
|
||||
};
|
||||
typedef HINSTANCE WindowInstance;
|
||||
|
||||
struct Window {
|
||||
uint16 width;
|
||||
|
|
@ -48,6 +33,7 @@ struct Window {
|
|||
HWND hwnd;
|
||||
HDC hdc;
|
||||
HGLRC openGLRC;
|
||||
HINSTANCE hInstance;
|
||||
|
||||
char name[32];
|
||||
WindowState state_old;
|
||||
|
|
|
|||
|
|
@ -197,9 +197,7 @@ int rawinput_init_controllers(HWND hwnd, Input* __restrict states, RingMemory* r
|
|||
}
|
||||
}
|
||||
} break;
|
||||
default: {
|
||||
|
||||
}
|
||||
default: {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,10 @@ struct HashMap {
|
|||
ChunkMemory buf;
|
||||
};
|
||||
|
||||
// @performance Implement more like gperf, our implementation is slow. However, keep it around since it is very general purpose
|
||||
// Alternatively, also create a version that creates perfect hashes (input requires a hash function and a seed for that hash function)
|
||||
// Both would be saved in the hash impl.
|
||||
|
||||
// WARNING: element_size = element size + remaining HashEntry data size
|
||||
void hashmap_create(HashMap* hm, int32 count, int32 element_size, RingMemory* ring)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -67,20 +67,4 @@ inline float oms_ceil(float a) {
|
|||
return svget1_f32(result);
|
||||
}
|
||||
|
||||
inline void atomic_increment(int32_t* a, int32_t b) {
|
||||
__atomic_add_fetch(a, b, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
|
||||
inline void atomic_increment(int64_t* a, int64_t b) {
|
||||
__atomic_add_fetch(a, b, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
|
||||
inline void atomic_decrement(int32_t* a, int32_t b) {
|
||||
__atomic_sub_fetch(a, b, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
|
||||
inline void atomic_decrement(int64_t* a, int64_t b) {
|
||||
__atomic_sub_fetch(a, b, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
|
||||
#endif
|
||||
0
stdlib/PerfectHashMap.h
Normal file
0
stdlib/PerfectHashMap.h
Normal file
|
|
@ -17,9 +17,13 @@
|
|||
#define PACKED_STRUCT __pragma(pack(push, 1))
|
||||
#define UNPACKED_STRUCT __pragma(pack(pop))
|
||||
typedef SSIZE_T ssize_t;
|
||||
|
||||
#define UNREACHABLE() __assume(0)
|
||||
#else
|
||||
#define PACKED_STRUCT __attribute__((__packed__))
|
||||
#define UNPACKED_STRUCT ((void) 0)
|
||||
|
||||
#define UNREACHABLE() __builtin_unreachable()
|
||||
#endif
|
||||
|
||||
#define ARRAY_COUNT(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
#ifndef TOS_PLATFORM_LIBRARY_H
|
||||
#define TOS_PLATFORM_LIBRARY_H
|
||||
#ifndef TOS_SYSTEM_LIBRARY_H
|
||||
#define TOS_SYSTEM_LIBRARY_H
|
||||
|
||||
#include "../stdlib/Types.h"
|
||||
|
||||
|
|
@ -6,8 +6,8 @@
|
|||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
#ifndef TOS_PLATFORM_SYSTEM_INFO_H
|
||||
#define TOS_PLATFORM_SYSTEM_INFO_H
|
||||
#ifndef TOS_SYSTEM_INFO_H
|
||||
#define TOS_SYSTEM_INFO_H
|
||||
|
||||
#include "../stdlib/Types.h"
|
||||
|
||||
32
system/Window.h
Normal file
32
system/Window.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* @copyright Jingga
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
#ifndef TOS_SYSTEM_WINDOW_H
|
||||
#define TOS_SYSTEM_WINDOW_H
|
||||
|
||||
#include "../stdlib/Types.h"
|
||||
|
||||
struct WindowState {
|
||||
uint16 width;
|
||||
uint16 height;
|
||||
|
||||
uint16 x;
|
||||
uint16 y;
|
||||
uint64 style;
|
||||
};
|
||||
|
||||
enum WindowStateChanges : byte {
|
||||
WINDOW_STATE_CHANGE_NONE = 0,
|
||||
WINDOW_STATE_CHANGE_SIZE = 1,
|
||||
WINDOW_STATE_CHANGE_POS = 2,
|
||||
WINDOW_STATE_CHANGE_FOCUS = 4,
|
||||
WINDOW_STATE_CHANGE_FULLSCREEN = 8,
|
||||
WINDOW_STATE_CHANGE_ALL = 16,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -282,6 +282,42 @@ str_concat(
|
|||
return len_total + len;
|
||||
}
|
||||
|
||||
inline void
|
||||
str_add(char* base, const char* src)
|
||||
{
|
||||
while (*base) {
|
||||
++base;
|
||||
}
|
||||
|
||||
strcpy(base, src);
|
||||
}
|
||||
|
||||
inline void
|
||||
str_add(char* base, const char* src, size_t src_length)
|
||||
{
|
||||
while (*base) {
|
||||
++base;
|
||||
}
|
||||
|
||||
memcpy(base, src, src_length);
|
||||
base[src_length] = '\0';
|
||||
}
|
||||
|
||||
inline int64
|
||||
str_add(char* base, size_t base_length, const char* src, size_t src_length)
|
||||
{
|
||||
memcpy(&base[base_length], src, src_length);
|
||||
base[base_length + src_length] = '\0';
|
||||
|
||||
return base_length + src_length;
|
||||
}
|
||||
|
||||
inline void
|
||||
str_add(char* base, size_t base_length, const char* src)
|
||||
{
|
||||
strcpy(&base[base_length], src);
|
||||
}
|
||||
|
||||
inline int64
|
||||
str_concat(
|
||||
const char* src1, size_t src1_length,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user