-- Captures visual commonality among all the pieces used in -- solving a puzzle. deferred class V_GAME_PIECE inherit V_PIECE rename cell as northwest end GAME_PIECE redefine northwest, clear end feature{NONE} make( s : STRING ; vgr : V_GAME_ROOM ; c : V_GAME_CELL ) is -- Initialize myself and occupy 'c'. 'vgr' will be my parent -- widget. require vacant: not c.occupied do wc_make( vgr, s ) get_id init( vgr, c ) get_bitmaps resize( configuration.piece_width, configuration.piece_height ) end make_customized( s : STRING ; vgr : V_GAME_ROOM ; pr : LINKED_LIST[ INTEGER ] ) is -- Initialize myself based on the data in `pr'. 'vgr' will be my parent -- widget. require do wc_make( vgr, s ) get_bitmaps customized_init( vgr, pr ) -- restore( pr ) resize( configuration.piece_width, configuration.piece_height ) end display_occupy is -- Put myself at the correct pixel coordinates based on my cells. do move( northwest.x, northwest.y ) if configuration.is_foreground_piece( id ) then raise end show invalidate end display_vacate is -- Default is do nothing do hide end get_bitmaps is -- Get whatever bitmaps I need. deferred end get_id is -- Get my id code. deferred end feature clear is -- Default is to vacate my cells and 'destroy' myself. do if northeast /= Void then vacate end destroy end northwest : V_GAME_CELL -- My northwest corner. Need visual version as I -- my cell's pixel coordinates. end