blob: 192dbe64809f3f9c2b3164dfdedad81c644f06d4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#include <saffron.h>
#include <saffronwebkit.h>
// store globals because yes
SFWKContext* ctx;
SFWKWebView* webview;
bool hook_callback(SDL_Event* event) {
sfwk_process_event(ctx, webview, event);
return true;
}
int main() {
saffron_init();
SaffronWindow* window = saffron_window_new("SaffronWebKit (SFWK) Test", 1024, 768);
window->root->theme = SF_MACRO_DEFAULT_THEME;
ctx = sfwk_init();
if (!ctx) return 1;
SFWKWebView* webview = sfwk_webview_new(ctx, "https://arslaancodes.com", 900, 600);
saffron_widget_add_child(window->root, (SaffronWidget*)webview);
saffron_hook_sdl_all_events(window, hook_callback, 999);
saffron_window_main(window);
saffron_window_free(window);
saffron_quit();
return 0;
}
|