示例#1
0
def _draw_prefab(prefab):
    _X_MAX = PREFAB_CAMERA_POS[0] + PREFAB_WINDOW_SIZE[0]
    _Y_MAX = PREFAB_CAMERA_POS[1] + PREFAB_WINDOW_SIZE[1]

    #DARK_BUFFER[0] = numpy.zeros((MAP_WINDOW_SIZE[1], PREFAB_WINDOW_SIZE[0]))
    #LIGHT_BUFFER[0] = numpy.zeros((MAP_WINDOW_SIZE[1], MAP_WINDOW_SIZE[0]))

    map = prefab['map']

    if _X_MAX > prefab['size'][0]:
        _X_MAX = prefab['size'][0]

    if _Y_MAX > prefab['size'][1]:
        _Y_MAX = prefab['size'][1]

    for x in range(PREFAB_CAMERA_POS[0], _X_MAX):
        _RENDER_X = x - PREFAB_CAMERA_POS[0]

        for y in range(PREFAB_CAMERA_POS[1], _Y_MAX):
            _RENDER_Y = y - PREFAB_CAMERA_POS[1]
            _drawn = False

            for z in range(prefab['size'][2] - 1, -1, -1):
                if map[x][y][z]:
                    gfx.blit_tile(_RENDER_X,
                                  _RENDER_Y,
                                  map[x][y][z],
                                  char_buffer=PREFAB_CHAR_BUFFER,
                                  rgb_fore_buffer=PREFAB_RGB_FORE_BUFFER,
                                  rgb_back_buffer=PREFAB_RGB_BACK_BUFFER)

                    _drawn = True
                    break
                    #if z > PREFAB_CAMERA_POS[2] and SETTINGS['draw z-levels above']:
                    #	gfx.blit_tile(_RENDER_X,_RENDER_Y,map[x][y][z])
                    #	gfx.darken_tile(_RENDER_X,_RENDER_Y,abs((PREFAB_CAMERA_POS[2]-z))*30)
                    #	_drawn = True
                    #elif z == PREFAB_CAMERA_POS[2]:
                    #	if (x,y,z) in SELECTED_TILES[0] and time.time()%1>=0.5:
                    #		gfx.blit_char(_RENDER_X,_RENDER_Y,'X',darker_grey,black)
                    #	else:
                    #		gfx.blit_tile(_RENDER_X,_RENDER_Y,map[x][y][z])
                    #	_drawn = True
                    #elif z < PREFAB_CAMERA_POS[2] and SETTINGS['draw z-levels below']:
                    #	gfx.blit_tile(_RENDER_X,_RENDER_Y,map[x][y][z])
                    #	gfx.darken_tile(_RENDER_X,_RENDER_Y,abs((PREFAB_CAMERA_POS[2]-z))*30)
                    #	_drawn = True

                    #if SETTINGS['draw z-levels above'] and _drawn:
                    #	break

            if not _drawn:
                gfx.blit_tile(_RENDER_X,
                              _RENDER_Y,
                              BLANK_TILE,
                              char_buffer=PREFAB_CHAR_BUFFER,
                              rgb_fore_buffer=PREFAB_RGB_FORE_BUFFER,
                              rgb_back_buffer=PREFAB_RGB_BACK_BUFFER)
示例#2
0
def _draw_prefab(prefab):
	_X_MAX = PREFAB_CAMERA_POS[0]+PREFAB_WINDOW_SIZE[0]
	_Y_MAX = PREFAB_CAMERA_POS[1]+PREFAB_WINDOW_SIZE[1]
	
	#DARK_BUFFER[0] = numpy.zeros((MAP_WINDOW_SIZE[1], PREFAB_WINDOW_SIZE[0]))
	#LIGHT_BUFFER[0] = numpy.zeros((MAP_WINDOW_SIZE[1], MAP_WINDOW_SIZE[0]))
	
	map = prefab['map']

	if _X_MAX>prefab['size'][0]:
		_X_MAX = prefab['size'][0]

	if _Y_MAX>prefab['size'][1]:
		_Y_MAX = prefab['size'][1]

	for x in range(PREFAB_CAMERA_POS[0],_X_MAX):
		_RENDER_X = x-PREFAB_CAMERA_POS[0]
		
		for y in range(PREFAB_CAMERA_POS[1],_Y_MAX):
			_RENDER_Y = y-PREFAB_CAMERA_POS[1]
			_drawn = False
			
			for z in range(prefab['size'][2]-1,-1,-1):
				if map[x][y][z]:
					gfx.blit_tile(_RENDER_X,
						_RENDER_Y,
						map[x][y][z],
						char_buffer=PREFAB_CHAR_BUFFER,
						rgb_fore_buffer=PREFAB_RGB_FORE_BUFFER,
						rgb_back_buffer=PREFAB_RGB_BACK_BUFFER)
					
					_drawn = True
					break
					#if z > PREFAB_CAMERA_POS[2] and SETTINGS['draw z-levels above']:
					#	gfx.blit_tile(_RENDER_X,_RENDER_Y,map[x][y][z])
					#	gfx.darken_tile(_RENDER_X,_RENDER_Y,abs((PREFAB_CAMERA_POS[2]-z))*30)
					#	_drawn = True
					#elif z == PREFAB_CAMERA_POS[2]:
					#	if (x,y,z) in SELECTED_TILES[0] and time.time()%1>=0.5:
					#		gfx.blit_char(_RENDER_X,_RENDER_Y,'X',darker_grey,black)
					#	else:
					#		gfx.blit_tile(_RENDER_X,_RENDER_Y,map[x][y][z])
					#	_drawn = True
					#elif z < PREFAB_CAMERA_POS[2] and SETTINGS['draw z-levels below']:
					#	gfx.blit_tile(_RENDER_X,_RENDER_Y,map[x][y][z])
					#	gfx.darken_tile(_RENDER_X,_RENDER_Y,abs((PREFAB_CAMERA_POS[2]-z))*30)
					#	_drawn = True
				
					#if SETTINGS['draw z-levels above'] and _drawn:
					#	break
			
			if not _drawn:
				gfx.blit_tile(_RENDER_X,
					_RENDER_Y,
					BLANK_TILE,
					char_buffer=PREFAB_CHAR_BUFFER,
					rgb_fore_buffer=PREFAB_RGB_FORE_BUFFER,
					rgb_back_buffer=PREFAB_RGB_BACK_BUFFER)
示例#3
0
def render_x_cutout(map, x_pos, y_pos):
    _X_MAX = x_pos + X_CUTOUT_WINDOW_SIZE[0]
    y = y_pos

    for x in range(x_pos, _X_MAX):
        if x >= MAP_SIZE[0] or x < 0:
            continue

        _RENDER_X = x - x_pos
        for z in range(MAP_SIZE[2] - 3):
            if map[x][y][z]:
                _tile = map[x][y][z]
            else:
                _tile = BLANK_TILE

            gfx.blit_tile(_RENDER_X, (MAP_SIZE[2] - 3) - z, _tile, 'map')
示例#4
0
文件: maps.py 项目: athros/Reactor-3
def render_x_cutout(map,x_pos,y_pos):
	_X_MAX = x_pos+X_CUTOUT_WINDOW_SIZE[0]
	y = y_pos
	
	for x in range(x_pos,_X_MAX):
		if x>=MAP_SIZE[0] or x<0:
			continue
		
		_RENDER_X = x-x_pos
		for z in range(MAP_SIZE[2]-3):
			if map[x][y][z]:
				_tile = map[x][y][z]
			else:
				_tile = BLANK_TILE
			
			gfx.blit_tile(_RENDER_X,
				(MAP_SIZE[2]-3)-z,
				_tile,
				'map')
示例#5
0
def render_y_cutout(map, x_pos, y_pos):
    _Y_MAX = y_pos + Y_CUTOUT_WINDOW_SIZE[1]
    x = x_pos

    for y in range(y_pos, _Y_MAX):
        if y >= MAP_SIZE[1] or y < 0:
            break

        _RENDER_Y = y - y_pos
        for z in range(MAP_SIZE[2]):
            if map[x][y][z]:
                _tile = map[x][y][z]
            else:
                _tile = BLANK_TILE

            gfx.blit_tile(_RENDER_Y,
                          MAP_SIZE[2] - z,
                          _tile,
                          char_buffer=Y_CUTOUT_CHAR_BUFFER,
                          rgb_fore_buffer=Y_CUTOUT_RGB_FORE_BUFFER,
                          rgb_back_buffer=Y_CUTOUT_RGB_BACK_BUFFER)
示例#6
0
文件: maps.py 项目: athros/Reactor-3
def render_y_cutout(map,x_pos,y_pos):
	_Y_MAX = y_pos+Y_CUTOUT_WINDOW_SIZE[1]
	x = x_pos
	
	for y in range(y_pos,_Y_MAX):
		if y>=MAP_SIZE[1] or y<0:
			break
		
		_RENDER_Y = y-y_pos
		for z in range(MAP_SIZE[2]):
			if map[x][y][z]:
				_tile = map[x][y][z]
			else:
				_tile = BLANK_TILE
			
			gfx.blit_tile(_RENDER_Y,
				MAP_SIZE[2]-z,
				_tile,
				char_buffer=Y_CUTOUT_CHAR_BUFFER,
				rgb_fore_buffer=Y_CUTOUT_RGB_FORE_BUFFER,
				rgb_back_buffer=Y_CUTOUT_RGB_BACK_BUFFER)