Files
ci2/include/ci2_window.h
2026-05-11 18:43:11 -05:00

57 lines
2.0 KiB
C

/* - | Copyright | --------------------------------------------------------------
Copyright (c) 2026 Randy Jordan
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
* --------------------------------------------------------------------------*/
#ifndef CI2_WINDOW_H
#define CI2_WINDOW_H
#include "./base/ci2_base.h"
struct CI2_Window_Handle {
ci2_fd fd;
ci2_bool should_close;
};
typedef struct CI2_Window_Handle CI2_Window_Handle;
// Opaque type for a window
typedef struct CI2_Window CI2_Window;
// Initializes the ci2 layer (must be called before creating a window)
ci2_bool ci2_init(void);
// Creates a window, returns NULL on failure
CI2_Window* ci2_create_window(const ci2_sys_char* title, int width, int height);
// Polls ci2 events. Returns false if the window should close
ci2_bool ci2_poll_events(CI2_Window* window);
// Destroys a window
void ci2_destroy_window(CI2_Window* window);
// Shuts down the ci2 layer
void ci2_shutdown(void);
// Non GUI Main
ci2_bool ci2_main(int argc, ci2_sys_char *argv[]);
#endif // ci2_window.h