![]() |
GL CHOCO ENGINE
|
プラットフォームシステムのStrategy Contextモジュールの実装 More...
#include <stdbool.h>#include <stdalign.h>#include <string.h>#include "engine/base/choco_macros.h"#include "engine/base/choco_message.h"#include "engine/core/event/keyboard_event.h"#include "engine/core/event/mouse_event.h"#include "engine/core/event/window_event.h"#include "engine/core/memory/linear_allocator.h"#include "engine/platform/platform_context.h"#include "engine/platform/platform_interface.h"#include "engine/platform/platform_concretes/platform_glfw.h"#include "engine/platform/platform_core/platform_types.h"#include "engine/platform/platform_core/platform_err_utils.h"
Data Structures | |
| struct | platform_context |
| プラットフォームコンテキスト構造体 More... | |
Functions | |
| platform_result_t | platform_initialize (linear_alloc_t *allocator_, platform_type_t platform_type_, platform_context_t **out_platform_context_) |
| プラットフォームStrategyパターンを初期化する | |
| void | platform_destroy (platform_context_t *platform_context_) |
| プラットフォームStrategyパターンのContext構造体インスタンスの内部データをクリアする | |
| platform_result_t | platform_window_create (platform_context_t *platform_context_, const char *window_label_, int window_width_, int window_height_, int *framebuffer_width_, int *framebuffer_height_) |
| プラットフォームに応じたウィンドウ生成処理を行う | |
| platform_result_t | platform_pump_messages (platform_context_t *platform_context_, void(*window_event_callback)(const window_event_t *event_), void(*keyboard_event_callback)(const keyboard_event_t *event_), void(*mouse_event_callback)(const mouse_event_t *event_)) |
| OSレイヤーからキーボード、マウス、ウィンドウイベントを吸い上げ、各コールバック関数へイベントを渡す | |
| platform_result_t | platform_swap_buffers (platform_context_t *platform_context_) |
| 描画サーフェイスのフロント/バックバッファをスワップする | |
プラットフォームシステムのStrategy Contextモジュールの実装
| void platform_destroy | ( | platform_context_t * | platform_context_ | ) |
プラットフォームStrategyパターンのContext構造体インスタンスの内部データをクリアする
使用例:
| [in,out] | platform_context_ | クリア対象構造体インスタンス |
| platform_result_t platform_initialize | ( | linear_alloc_t * | allocator_, |
| platform_type_t | platform_type_, | ||
| platform_context_t ** | out_platform_context_ | ||
| ) |
プラットフォームStrategyパターンを初期化する
使用例:
| [in,out] | allocator_ | メモリ確保用リニアアロケータ |
| [in] | platform_type_ | プラットフォーム種別 |
| [out] | out_platform_context_ | プラットフォームコンテキスト構造体インスタンス |
| PLATFORM_INVALID_ARGUMENT | 以下のいずれか
|
| PLATFORM_RUNTIME_ERROR | vtable取得失敗 |
| PLATFORM_SUCCESS | 初期化およびメモリ確保に成功し、正常終了 |
| 上記以外 | リニアアロケータによるメモリ確保失敗( linear_allocator_allocate ) |
| platform_result_t platform_pump_messages | ( | platform_context_t * | platform_context_, |
| void(*)(const window_event_t *event_) | window_event_callback, | ||
| void(*)(const keyboard_event_t *event_) | keyboard_event_callback, | ||
| void(*)(const mouse_event_t *event_) | mouse_event_callback | ||
| ) |
OSレイヤーからキーボード、マウス、ウィンドウイベントを吸い上げ、各コールバック関数へイベントを渡す
使用例:
| platform_context_ | プラットフォームstrategy contextオブジェクト |
| window_event_callback | ウィンドウイベントコールバック |
| keyboard_event_callback | キーボードイベントコールバック |
| mouse_event_callback | マウスイベントコールバック |
| PLATFORM_INVALID_ARGUMENT | 以下のいずれか
|
| PLATFORM_WINDOW_CLOSE | ウィンドウクローズイベント発生(これは絶対に補足しなくてはいけないため、コールバックとは別に処理する) |
| PLATFORM_SUCCESS | イベントの吸い上げに成功し、正常終了 |
| platform_result_t platform_swap_buffers | ( | platform_context_t * | platform_context_ | ) |
描画サーフェイスのフロント/バックバッファをスワップする
| platform_context_ | プラットフォームstrategy context構造体インスタンスへのポインタ |
| PLATFORM_INVALID_ARGUMENT | platform_context_ == NULL |
| PLATFORM_BAD_OPERATION | 以下のいずれか
|
| その他 | プラットフォーム実装依存 |
| platform_result_t platform_window_create | ( | platform_context_t * | platform_context_, |
| const char * | window_label_, | ||
| int | window_width_, | ||
| int | window_height_, | ||
| int * | framebuffer_width_, | ||
| int * | framebuffer_height_ | ||
| ) |
プラットフォームに応じたウィンドウ生成処理を行う
使用例:
| [in,out] | platform_context_ | プラットフォームStrategy Context構造体インスタンス |
| [in] | window_label_ | ウィンドウラベル |
| [in] | window_width_ | ウィンドウ幅 |
| [in] | window_height_ | ウィンドウ高さ |
| [out] | framebuffer_width_ | フレームバッファサイズ(幅)格納先ポインタ |
| [out] | framebuffer_height_ | フレームバッファサイズ(高さ)格納先ポインタ |
| PLATFORM_INVALID_ARGUMENT | 以下のいずれか
|
| PLATFORM_SUCCESS | ウィンドウ生成に成功し、正常終了 |