Created
April 20, 2013 16:03
-
-
Save Dav1dde/5426448 to your computer and use it in GitHub Desktop.
Offscreen rendering, here I come!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module test; | |
private { | |
import std.stdio; | |
import std.string : toStringz; | |
} | |
extern(C) bool surfi_init(); | |
extern(C) bool surfi_poll(); | |
extern(C) void* surfi_client_new(int width, int height); | |
extern(C) void surfi_client_set_callback_load_finished(void* client, void function(void* client, void* frame) bla); | |
extern(C) void gtk_main(void** argc, void** argv); | |
extern(C) void webkit_web_view_load_uri(void* view, const(char)* uri); | |
extern(C) void on_load_finished(void* client, void* frame) { | |
writefln("load finished"); | |
} | |
extern(C) struct Bla { | |
void* window; | |
void *view; | |
} | |
void main() { | |
surfi_init(); | |
surfi_poll(); | |
auto client = surfi_client_new(500, 500); | |
writefln("Returned: %s", client); | |
surfi_client_set_callback_load_finished(client, &on_load_finished); | |
auto clientBla = cast(Bla*)client; | |
webkit_web_view_load_uri(clientBla.view, "http://google.com".toStringz()); | |
gtk_main(null, null); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment