当前位置: 首页>>代码示例>>Python>>正文


Python EbGraphicTileset.tiles[0]方法代码示例

本文整理汇总了Python中coilsnake.model.eb.graphics.EbGraphicTileset.tiles[0]方法的典型用法代码示例。如果您正苦于以下问题:Python EbGraphicTileset.tiles[0]方法的具体用法?Python EbGraphicTileset.tiles[0]怎么用?Python EbGraphicTileset.tiles[0]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在coilsnake.model.eb.graphics.EbGraphicTileset的用法示例。


在下文中一共展示了EbGraphicTileset.tiles[0]方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_to_block_4bpp

# 需要导入模块: from coilsnake.model.eb.graphics import EbGraphicTileset [as 别名]
# 或者: from coilsnake.model.eb.graphics.EbGraphicTileset import tiles[0] [as 别名]
 def test_to_block_4bpp(self):
     tileset = EbGraphicTileset(num_tiles=1, tile_width=8, tile_height=8)
     tileset.tiles = [None]
     tileset.tiles[0] = [
         [8, 1, 12, 9, 6, 5, 3, 2],
         [11, 5, 8, 14, 1, 7, 15, 0],
         [8, 13, 3, 7, 2, 0, 2, 3],
         [10, 0, 4, 14, 7, 10, 11, 9],
         [8, 8, 12, 9, 13, 12, 2, 6],
         [11, 14, 14, 4, 14, 4, 10, 7],
         [12, 2, 12, 8, 4, 15, 12, 14],
         [10, 13, 12, 1, 10, 11, 11, 2],
     ]
     block = Block()
     block.from_list([0] * 32)
     tileset.to_block(block, 0, 4)
     assert_list_equal(
         block.to_list(),
         [
             0b01010110,
             0b00001011,
             0b11001110,
             0b10010110,
             0b01110001,
             0b00111011,
             0b00001011,
             0b10011110,
             0b00011000,
             0b00000011,
             0b10000001,
             0b11101011,
             0b00000100,
             0b01000101,
             0b01010110,
             0b10001111,
             0b00101100,
             0b10110000,
             0b01010110,
             0b10110010,
             0b01010000,
             0b11000000,
             0b00111000,
             0b10010111,
             0b00101101,
             0b11111100,
             0b01111101,
             0b11101010,
             0b10101111,
             0b10110111,
             0b01100000,
             0b11101110,
         ],
     )
开发者ID:,项目名称:,代码行数:55,代码来源:

示例2: test_to_block_1bpp

# 需要导入模块: from coilsnake.model.eb.graphics import EbGraphicTileset [as 别名]
# 或者: from coilsnake.model.eb.graphics.EbGraphicTileset import tiles[0] [as 别名]
 def test_to_block_1bpp(self):
     tileset = EbGraphicTileset(num_tiles=2, tile_width=8, tile_height=8)
     tileset.tiles = [None, None]
     tileset.tiles[0] = [
         [0, 0, 0, 0, 0, 0, 1, 1],
         [0, 1, 1, 1, 0, 0, 0, 0],
         [0, 1, 0, 0, 1, 0, 0, 1],
         [1, 1, 1, 1, 0, 0, 0, 0],
         [0, 1, 0, 0, 1, 0, 1, 0],
         [1, 1, 0, 0, 1, 0, 0, 0],
         [0, 1, 1, 1, 0, 0, 0, 1],
         [0, 0, 0, 0, 0, 0, 0, 1],
     ]
     tileset.tiles[1] = [
         [0, 0, 1, 0, 0, 0, 0, 0],
         [0, 0, 1, 1, 0, 0, 0, 0],
         [0, 0, 1, 0, 1, 0, 0, 0],
         [0, 0, 1, 0, 1, 0, 0, 0],
         [0, 1, 1, 0, 0, 0, 0, 0],
         [1, 1, 1, 0, 0, 0, 0, 0],
         [1, 1, 0, 0, 0, 0, 0, 0],
         [0, 0, 0, 0, 0, 0, 0, 1],
     ]
     block = Block()
     block.from_list([0] * 16)
     tileset.to_block(block, 0, 1)
     assert_list_equal(
         block.to_list(),
         [
             0b00000011,
             0b01110000,
             0b01001001,
             0b11110000,
             0b01001010,
             0b11001000,
             0b01110001,
             0b00000001,
             0b00100000,
             0b00110000,
             0b00101000,
             0b00101000,
             0b01100000,
             0b11100000,
             0b11000000,
             0b00000001,
         ],
     )
开发者ID:,项目名称:,代码行数:49,代码来源:

示例3: test_to_block_2bpp

# 需要导入模块: from coilsnake.model.eb.graphics import EbGraphicTileset [as 别名]
# 或者: from coilsnake.model.eb.graphics.EbGraphicTileset import tiles[0] [as 别名]
 def test_to_block_2bpp(self):
     tileset = EbGraphicTileset(num_tiles=2, tile_width=8, tile_height=8)
     tileset.tiles = [None, None]
     tileset.tiles[0] = [
         [2, 1, 2, 3, 2, 1, 2, 1],
         [2, 3, 1, 0, 2, 3, 2, 2],
         [3, 0, 3, 2, 2, 2, 0, 2],
         [1, 3, 3, 0, 2, 0, 2, 3],
         [1, 0, 1, 1, 0, 3, 3, 3],
         [1, 3, 3, 3, 3, 2, 1, 2],
         [2, 2, 3, 1, 2, 2, 1, 0],
         [2, 0, 3, 3, 2, 3, 1, 0],
     ]
     tileset.tiles[1] = [
         [1, 3, 3, 1, 3, 0, 2, 1],
         [3, 2, 2, 3, 3, 2, 2, 2],
         [1, 1, 2, 2, 3, 0, 1, 1],
         [0, 3, 2, 2, 0, 0, 0, 3],
         [3, 3, 0, 0, 1, 0, 1, 0],
         [2, 3, 1, 3, 3, 2, 1, 2],
         [0, 0, 0, 1, 3, 2, 3, 3],
         [2, 2, 3, 2, 0, 0, 0, 1],
     ]
     block = Block()
     block.from_list([0] * 32)
     tileset.to_block(block, 0, 2)
     assert_list_equal(
         block.to_list(),
         [
             0b01010101,  # Tile 1
             0b10111010,
             0b01100100,
             0b11001111,
             0b10100000,
             0b10111101,
             0b11100001,
             0b01101011,
             0b10110111,
             0b00000111,
             0b11111010,
             0b01111101,
             0b00110010,
             0b11101100,
             0b00110110,
             0b10111100,
             0b11111001,  # Tile 2
             0b01101010,
             0b10011000,
             0b11111111,
             0b11001011,
             0b00111000,
             0b01000001,
             0b01110001,
             0b11001010,
             0b11000000,
             0b01111010,
             0b11011101,
             0b00011011,
             0b00001111,
             0b00100001,
             0b11110000,
         ],
     )
开发者ID:,项目名称:,代码行数:65,代码来源:


注:本文中的coilsnake.model.eb.graphics.EbGraphicTileset.tiles[0]方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。