More roadmap, added flag to gui test
This commit is contained in:
@@ -23,13 +23,16 @@ the platform layer prefix.
|
|||||||
## Todos
|
## Todos
|
||||||
- [x] Basic Window
|
- [x] Basic Window
|
||||||
- [ ] Input Handling
|
- [ ] Input Handling
|
||||||
- [ ] Add sys_fd for handle
|
- [x] Add sys_fd for handle
|
||||||
- [ ] Class and Title sys_char*
|
- [ ] Class and Title sys_char*
|
||||||
|
|
||||||
- [ ] Assertions & Testing
|
- [ ] Assertions & Testing
|
||||||
- [ ] Exceptions & Errors
|
- [ ] Exceptions & Errors
|
||||||
- [ ] Memory Allocations
|
- [ ] Memory Allocations
|
||||||
|
- [ ] Arena Allocations
|
||||||
- [ ] Atoms
|
- [ ] Atoms
|
||||||
|
- [ ] String Views
|
||||||
|
- [ ] Serialization & Packing
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,9 @@ SOFTWARE.
|
|||||||
#ifndef CI2_WINDOW_H
|
#ifndef CI2_WINDOW_H
|
||||||
#define CI2_WINDOW_H
|
#define CI2_WINDOW_H
|
||||||
|
|
||||||
#include "./base/ci2_base.h"
|
#include "./base/ci2_base.h" // ci2_platform detection
|
||||||
|
|
||||||
|
// Our ci2_specific handle that depends on platform detection.
|
||||||
struct CI2_Window_Handle {
|
struct CI2_Window_Handle {
|
||||||
ci2_fd fd;
|
ci2_fd fd;
|
||||||
ci2_bool should_close;
|
ci2_bool should_close;
|
||||||
|
|||||||
@@ -59,13 +59,11 @@ CI2_Window* ci2_create_window(const ci2_sys_char* title, int width, int height)
|
|||||||
|
|
||||||
|
|
||||||
CI2_Window* window = malloc(sizeof(CI2_Window));
|
CI2_Window* window = malloc(sizeof(CI2_Window));
|
||||||
// CI2_Window_Handle* h = malloc(sizeof(CI2_Window_Handle));
|
|
||||||
if (!window) {
|
if (!window) {
|
||||||
XDestroyWindow(display, win);
|
XDestroyWindow(display, win);
|
||||||
XCloseDisplay(display);
|
XCloseDisplay(display);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
// window->handle = h;
|
|
||||||
window->display = display;
|
window->display = display;
|
||||||
window->wm_delete_window = wm_delete_window;
|
window->wm_delete_window = wm_delete_window;
|
||||||
window->handle.should_close = ci2_false;
|
window->handle.should_close = ci2_false;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
* --------------------------------------------------------------------------*/
|
* --------------------------------------------------------------------------*/
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
|
#define GUI_DEBUG_CLOSE
|
||||||
#include "../include/ci2.h"
|
#include "../include/ci2.h"
|
||||||
|
|
||||||
#ifdef CI2_WINDOWS
|
#ifdef CI2_WINDOWS
|
||||||
@@ -49,6 +50,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||||||
// Per-frame update/render would go here.
|
// Per-frame update/render would go here.
|
||||||
// Example: simple sleep to avoid busy-looping; adjust to suit your app's timing.
|
// Example: simple sleep to avoid busy-looping; adjust to suit your app's timing.
|
||||||
Sleep(1);
|
Sleep(1);
|
||||||
|
#ifdef GUI_DEBUG_CLOSE
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5) Destroy window and shutdown ci2.
|
// 5) Destroy window and shutdown ci2.
|
||||||
@@ -70,6 +74,9 @@ int main(int argc, ci2_sys_char *argv[])
|
|||||||
|
|
||||||
while (ci2_poll_events(window)) {
|
while (ci2_poll_events(window)) {
|
||||||
// Your rendering / game loop goes here
|
// Your rendering / game loop goes here
|
||||||
|
#ifdef GUI_DEBUG_CLOSE
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ci2_destroy_window(window);
|
ci2_destroy_window(window);
|
||||||
Reference in New Issue
Block a user