njin
Engine 2D gọn nhẹ để tự tay làm game theo ý mình. Vibe coding cũng ổn luôn
Loading...
Searching...
No Matches
njin_window.h
1#pragma once
2#include "_math.h"
3#include "_types.h"
4
5namespace njin {
6struct context;
7
10
14void quit(context &ctx);
15
23void window_set_close_intercept(context &ctx, bool on);
24
28bool window_close_requested(const context &ctx);
29
33void window_set_size(context &ctx, vec2 size);
34
38void window_set_title(context &ctx, const char *title);
39
46void window_set_fullscreen(context &ctx, bool fullscreen);
47
51bool window_fullscreen(const context &ctx);
52
56void window_set_vsync(context &ctx, bool vsync);
57
61bool window_vsync(const context &ctx);
62
67bool window_resized(const context &ctx);
68
72void cursor_set_visible(context &ctx, bool visible);
73
85void screenshot(context &ctx, const char *path = nullptr);
86
100void window_set_virtual_size(context &ctx, vec2 size, bool integer_scale = true);
101
105void window_set_bar_color(context &ctx, rgba color);
106
110vec2 window_size(const context &ctx);
111
116rect window_viewport(const context &ctx);
117
122void cursor_set_locked(context &ctx, bool locked);
124} // namespace njin
void cursor_set_visible(context &ctx, bool visible)
Hiện hoặc ẩn con trỏ chuột khi nó nằm trong cửa sổ.
bool window_close_requested(const context &ctx)
Người chơi vừa đóng cửa sổ trong lúc window_set_close_intercept() đang bật.
void window_set_fullscreen(context &ctx, bool fullscreen)
Bật hoặc tắt toàn màn hình.
void window_set_virtual_size(context &ctx, vec2 size, bool integer_scale=true)
Bật độ phân giải ảo: game vẽ lên một màn hình cố định size pixel (ví dụ 320 x 180),...
bool window_fullscreen(const context &ctx)
Cửa sổ có đang toàn màn hình không.
void window_set_vsync(context &ctx, bool vsync)
Bật hoặc tắt đồng bộ dọc lúc đang chạy, xem config::vsync.
void window_set_size(context &ctx, vec2 size)
Đổi kích thước cửa sổ.
void screenshot(context &ctx, const char *path=nullptr)
Chụp màn hình và lưu ra file ảnh.
bool window_resized(const context &ctx)
Cửa sổ có vừa đổi kích thước ở frame này không (người dùng kéo cửa sổ, hoặc bật tắt toàn màn hình).
void cursor_set_locked(context &ctx, bool locked)
Khóa con trỏ chuột trong cửa sổ và ẩn nó, như game bắn súng góc nhìn thứ nhất.
void window_set_close_intercept(context &ctx, bool on)
Chặn nút đóng cửa sổ: nút [x], Alt+F4, và phím thoát (config::exit_key).
void window_set_title(context &ctx, const char *title)
Đổi tiêu đề cửa sổ.
void quit(context &ctx)
Yêu cầu thoát game.
bool window_vsync(const context &ctx)
Đồng bộ dọc có đang bật không.
vec2 window_size(const context &ctx)
Kích thước thật của cửa sổ, pixel, kể cả khi có độ phân giải ảo.
void window_set_bar_color(context &ctx, rgba color)
Màu viền quanh màn hình ảo.
rect window_viewport(const context &ctx)
Vùng của cửa sổ mà màn hình ảo đang chiếm, pixel cửa sổ.
Hình chữ nhật thẳng trục: pos là góc trên trái, size là rộng và cao.
Definition _math.h:13
Màu gồm đỏ, xanh lá, xanh dương và alpha.
Definition _types.h:64
Vector 2 chiều. Dùng cho vị trí, kích thước, độ dời.
Definition _types.h:39