; Chess Images by crossroads 2004-11-10 ; source coded with PB v3.81 If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0 MessageRequester("Error", "DirectX initialization failed", #MB_ICONSTOP) End EndIf Structure figure fig.l clr.l EndStructure Enumeration #playground #figures #shadow #dark = 0 #lite #pawn = 0 #castle #knight #bishop #queen #king EndEnumeration Global ScrOffset.COORD, FigOffset.COORD ScrOffset\x = 60:ScrOffset\y = 160 FigOffset\x = ScrOffset\x + 255:FigOffset\y = ScrOffset\y - 38 Dim board.figure(7, 7) Restore board For clm = 0 To 7 For row = 0 To 7 Read board(clm, row)\fig Read board(clm, row)\clr Next row Next clm If OpenScreen(800, 600, 32, "Chess Images") LoadSprite(#playground, "C:\Programme\PureBasic\Programme\Projekte\Schachcomputer\Pics\chess\images\brett.bmp", 0) LoadSprite(#figures, "C:\Programme\PureBasic\Programme\Projekte\Schachcomputer\Pics\chess\images\figuren.bmp", 0) ClearScreen(0,0,0) DisplaySprite(#playground, ScrOffset\x, ScrOffset\y) For clm = 0 To 7 For row = 0 To 7 If board(clm, row)\fig > -1 ClipSprite(#figures, board(clm, row)\fig * 44, board(clm, row)\clr * 66, 44, 66) DisplayTransparentSprite(#figures, FigOffset\x + row * 51 - clm * 32, FigOffset\y + clm * 32) EndIf Next row Next clm FlipBuffers() Repeat ExamineKeyboard():Delay(40) Until KeyboardPushed(#PB_Key_All) End Else MessageRequester("Error", "Can't open a 800 * 600 - 32 bit screen !", #MB_ICONSTOP) EndIf End ;{ Databox DataSection board: Data.l #castle,#dark,#knight,#dark,#bishop,#dark,#queen,#dark,#king,#dark,#bishop,#dark,#knight,#dark,#castle,#dark Data.l #pawn,#dark,#pawn,#dark,#pawn,#dark,#pawn,#dark,#pawn,#dark,#pawn,#dark,#pawn,#dark,#pawn,#dark Data.l -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 Data.l -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 Data.l -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 Data.l -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 Data.l #pawn,#lite,#pawn,#lite,#pawn,#lite,#pawn,#lite,#pawn,#lite,#pawn,#lite,#pawn,#lite,#pawn,#lite Data.l #castle,#lite,#knight,#lite,#bishop,#lite,#queen,#lite,#king,#lite,#bishop,#lite,#knight,#lite,#castle,#lite EndDataSection ;} ; jaPBe Version=2.4.9.25 ; FoldLines=0009000C000E001C00480054 ; Build=1 ; Working Directory=F:\Development\PB_Sources\Schach\chess_1\ ; Language=0x0000 Language Neutral ; FirstLine=6 ; CursorPosition=46 ; ExecutableFormat=Windows ; Executable=F:\Development\PB_Sources\Schach\chess_1\chess.exe ; SaveDeclare ; EOF