viz_pos Subroutine

public subroutine viz_pos(x, y)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: x
integer, intent(in) :: y

Contents

Source Code


Source Code

subroutine viz_pos(x,y)
! position cursor at a given location within screen.
! top left corner is (1,1)
integer, intent(in) :: x,y
integer :: i,n
character(len=1) :: code(7)

    n = 0

    i = y
    if (i < 1) i = 1
    if (i > rows) i = rows
    call add_code(code,'[',n)
    if (i > 9) call add_code(code,achar(48+i/10),n)
    call add_code(code,achar(48+mod(i,10)),n)
    call add_code(code,';',n)

    i = x
    if (i < 1) i = 1
    if (i > cols) i = cols
    if (i > 9) call add_code(code,achar(48+i/10),n)
    call add_code(code,achar(48+mod(i,10)),n)
    call add_code(code,'H',n)
    write(*,fmt=gen,advance='no')esc,code(1:n)
end subroutine viz_pos