diff options
| author | Jeffrey Armstrong <jeffrey.armstrong@approximatrix.com> | 2014-08-21 11:21:01 -0400 |
|---|---|---|
| committer | Jeffrey Armstrong <jeffrey.armstrong@approximatrix.com> | 2014-08-21 11:21:01 -0400 |
| commit | bcdef9aafc02bd8cd5703d353d105e1fc15b0820 (patch) | |
| tree | a3f26e87448b0b397e3e36c5067c2457057345e5 /screen.f90 | |
| parent | cfbab1a4d15174c88e538eb18cfaf43650442319 (diff) | |
| download | fetris-master.tar.gz fetris-master.zip | |
Diffstat (limited to 'screen.f90')
| -rw-r--r-- | screen.f90 | 53 |
1 files changed, 46 insertions, 7 deletions
@@ -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 |
