예제 #1
0
def mainloop():
	global ROWS, COLUMNS, lastROWS, lastCOLS
	while GAME_RUNNING:
		startTime=time.time()
		update()
		ROWS, COLUMNS = os.popen('stty size', 'r').read().split()
		ROWS = int(ROWS)
		COLUMNS = int(COLUMNS)
		if ROWS!=lastROWS or COLUMNS!=lastCOLS: #refresh screen
			for y in range(1, ROWS+1):
				for x in range(1, COLUMNS+1):
					method.printxy(x,y," ")
		lastROWS=ROWS
		lastCOLS=COLUMNS
		if ROWS<24 or COLUMNS<58:
			method.printxy(1,1,method.color("&RXYOUR SCREEN IS TOO SMALL!&XX"))
		else:
			method.refreshBuffer()
			draw()
			method.printBuffer(ROWS,COLUMNS)
		endTime=time.time()
		timeElapsed=endTime-startTime
		sleepTime=1.0/float(FRAMES_PER_SECOND)-float(timeElapsed)
		try:
			time.sleep(sleepTime)
		except Exception:
			pass
예제 #2
0
lastch=' '
try:
	ch = getch.getch()
except KeyboardInterrupt, EOFError:
	GAME_RUNNING=False
	quit(True)
while ch != ' ':
	try:
		ch = getch.getch()
	except KeyboardInterrupt, EOFError:
		GAME_RUNNING=False
		quit(True)

for y in range(1, ROWS+1): #refresh screen
	for x in range(1, COLUMNS+1):
		method.printxy(x,y," ")
#Create first mob	
createMob()

#Main loop
def mainloop():
	global ROWS, COLUMNS, lastROWS, lastCOLS
	while GAME_RUNNING:
		startTime=time.time()
		update()
		ROWS, COLUMNS = os.popen('stty size', 'r').read().split()
		ROWS = int(ROWS)
		COLUMNS = int(COLUMNS)
		if ROWS!=lastROWS or COLUMNS!=lastCOLS: #refresh screen
			for y in range(1, ROWS+1):
				for x in range(1, COLUMNS+1):
예제 #3
0
def drawtitle(rows, columns):
	for i in range(0,len(TITLE_LINES)):
		method.printxy(columns/2 - 29, rows/2-11 + i,TITLE_LINES[i])