-
Notifications
You must be signed in to change notification settings - Fork 0
Examples Примеры
Nikita Krapivin edited this page May 8, 2021
·
1 revision
Here's the most basic one, just drawing: Вот самый простой, рисуем в окошке:
///Create
if (!libmulti_present()) {
show_error("libmulti: failed to load the DLL, can't proceed further.", true);
exit;
}
libmulti_init();
window = libmulti_create_window(
-1, // x
-1, // y
800, // width
600, // height
-1, // window style, default style of a regular window
-1, // extended style, don't use
-1, // sw_ show, don't care
800, // min width
600, // min height
-1, // max width, don't care
-1, // max height, don't care
);
// you'll need a buffer and a surface.
surf = -1;
buff = buffer_create(800 * 600 * 4, buffer_fixed, 1);
// Tell libmulti which window is used by GM, usually needs to be done once.
libmulti_set_game_window(window_handle());
///Draw
if (!surface_exists(surf)) surf = surface_create(800, 600);
// very basic surface code.
surface_set_target(surf);
var _cyclecol = make_color_hsv( (get_timer()/100000) mod 255, 255, 255 );
draw_clear(_cyclecol);
draw_set_color(c_black);
draw_text(8, 8, "welcome to libmulti.#we have windows and hugs.##enjoy your stay.");
surface_reset_target();
buffer_get_surface(buff, surf, 0, 0, 0);
libmulti_make_bitmap(window, 800, 600, buffer_get_address(buff));
///Game End
if (libmulti_exists(window)) libmulti_destroy(window);
if (surface_exists(surf)) surface_free(surf);
if (buffer_exists(buff)) buffer_delete(buff);
var ok = libmulti_quit();
if (ok) show_debug_message("libmulti was freed correctly.");
Have questions about the example? Don't be shy to ask! Есть вопросы? Не стесняйтесь!
- Discord (preferred): nik#5351
- VK (только по-русски, пожалуйста): https://vk.com/nkrapivindev
- Reddit: /u/tijesef