Question

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.

Was it helpful?

Solution 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 ).

OTHER TIPS

Consider checking Visual Prolog web-site

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top