From bcdef9aafc02bd8cd5703d353d105e1fc15b0820 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Thu, 21 Aug 2014 11:21:01 -0400 Subject: The next piece is now visible under the score --- screen.f90 | 53 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 7 deletions(-) (limited to 'screen.f90') diff --git a/screen.f90 b/screen.f90 index 3be092f..d2cdd39 100644 --- a/screen.f90 +++ b/screen.f90 @@ -7,12 +7,14 @@ implicit none integer::cell_size integer::xoffset, yoffset integer::scorex, scorey + integer::nextx, nexty contains subroutine init() use bgi use m_constants + use iso_c_binding, only: C_NULL_CHAR implicit none winid = initwindow(SCREEN_W, SCREEN_H, "Fetris!") @@ -34,6 +36,12 @@ contains call settextstyle(9, HORIZ_DIR, 2) + nextx = scorex + nexty = scorey+60 + + call setcolor(WHITE) + call outtextxy(nextx, nexty, " Next:"//C_NULL_CHAR) + end subroutine init subroutine shutdown() @@ -44,17 +52,13 @@ contains end subroutine shutdown - subroutine draw_one_cell(r, c, v) + subroutine draw_one_cell_at(x, y, v) use bgi use m_constants implicit none - - integer, intent(in)::r, c, v - integer::x,y - x = xoffset + (c - 1)*cell_size - y = yoffset + (ROWS - r + 1)*cell_size - + integer, intent(in)::x, y, v + if(v .EQ. 0) then call setfillstyle(SOLID_FILL, BLACK) call setcolor(BLACK) @@ -64,6 +68,21 @@ contains end if call bar(x, y, x+cell_size, y+cell_size) + + end subroutine draw_one_cell_at + + subroutine draw_one_cell(r, c, v) + use bgi + use m_constants + implicit none + + integer, intent(in)::r, c, v + integer::x,y + + x = xoffset + (c - 1)*cell_size + y = yoffset + (ROWS - r + 1)*cell_size + + call draw_one_cell_at(x, y, v) end subroutine draw_one_cell @@ -83,6 +102,26 @@ contains end subroutine draw_board + subroutine draw_next(g) + use m_game + use bgi + implicit none + + type(game)::g + integer::x, y, i, j + + x = nextx + do i=0,3 + y = nexty+40 + do j=0,3 + call draw_one_cell_at(x, y, g%waiting%blocks(i,j)) + y = y + cell_size + end do + x = x + cell_size + end do + + end subroutine draw_next + subroutine draw_score(g) use m_game use bgi -- cgit v1.2.3