سؤال

Recently I had been told that prolog can create a graphical display, and told that by using the predicate generatedInitialize().

Can I ask for some tutorial for this?

For example, how to display a rectangle?

rectangle(2, 1, 2, 1).    %rectangle(length, width, length width).

I'm using Win-Prolog 4.920.

هل كانت مفيدة؟

المحلول 2

I'm using gfx to draw out the display.

display :-
    create_display,
    window_handler( display, display_handler ),
    show_dialog( display ).
create_display :-
    wdcreate( display,`Graphics Example`, 70, 50, 1200,510,[ws_sysmenu, ws_caption, ws_popup] ),
    wccreate( (display,2),grafix, ``, 10, 10, 1050, 457,[ws_child, ws_border, ws_visible, ws_tabstop] ),
    gfx_brush_create(red, 255, 0, 0, solid).
display_handler( _, msg_close, _, close ):-
    wclose(display).
display_handler( Win, msg_paint, grafix, _ ) :-
    gfx_paint( Win ),
    gfx( ( brush = red -> rectangle( 280, 212, 0, 12 ))),
    gfx_end( Win ).

نصائح أخرى

Consider checking Visual Prolog web-site

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top