Skip to content

Commit d8883b6

Browse files
committed
Add goto website to GUI Plugin.
1 parent c54cb93 commit d8883b6

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

plugins/gui/gui.c

+20
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,25 @@ ctr_object* ctr_gui_dialog(ctr_object* myself, ctr_argument* argumentList) {
656656
return myself;
657657
}
658658

659+
/**
660+
* @def
661+
* [ Gui ] website: [ Text ]
662+
*
663+
* @example
664+
* Gui website: ['https://www.citrine-lang.org'].
665+
*
666+
* @result
667+
* www.citrine-lang.org
668+
*/
669+
ctr_object* ctr_gui_website(ctr_object* myself, ctr_argument* argumentList) {
670+
char* url = ctr_heap_allocate_cstring(
671+
ctr_internal_cast2string(argumentList->object)
672+
);
673+
SDL_OpenURL(url);
674+
ctr_heap_free(url);
675+
return myself;
676+
}
677+
659678
void begin() {
660679
ctr_internal_gui_init();
661680
colorObject = ctr_color_new(CtrStdObject, NULL);
@@ -698,6 +717,7 @@ void begin() {
698717
ctr_internal_create_func(guiObject, ctr_build_string_from_cstring( CTR_DICT_SCREEN ), &ctr_gui_screen );
699718
ctr_internal_create_func(guiObject, ctr_build_string_from_cstring( CTR_DICT_DIALOG_SET ), &ctr_gui_dialog );
700719
ctr_internal_create_func(guiObject, ctr_build_string_from_cstring( "use:" ), &ctr_gui_include );
720+
ctr_internal_create_func(guiObject, ctr_build_string_from_cstring( "website:" ), &ctr_gui_website );
701721
if (strcmp(CTR_DICT_USE_SET,"use:")!=0) {
702722
ctr_internal_create_func(guiObject, ctr_build_string_from_cstring( CTR_DICT_USE_SET ), &ctr_gui_include );
703723
}

0 commit comments

Comments
 (0)