summaryrefslogtreecommitdiff
path: root/screen.f90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeffrey.armstrong@approximatrix.com>2014-08-21 11:21:01 -0400
committerJeffrey Armstrong <jeffrey.armstrong@approximatrix.com>2014-08-21 11:21:01 -0400
commitbcdef9aafc02bd8cd5703d353d105e1fc15b0820 (patch)
treea3f26e87448b0b397e3e36c5067c2457057345e5 /screen.f90
parentcfbab1a4d15174c88e538eb18cfaf43650442319 (diff)
downloadfetris-bcdef9aafc02bd8cd5703d353d105e1fc15b0820.tar.gz
fetris-bcdef9aafc02bd8cd5703d353d105e1fc15b0820.zip
The next piece is now visible under the scoreHEADmaster
Diffstat (limited to 'screen.f90')
-rw-r--r--screen.f9053
1 files changed, 46 insertions, 7 deletions
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