int IsTextureVisible( PCOMMON pc, int points, DISPLAYPOINT *pointlist ) { int n; Image image = GetControlSurface( pc ); for( n = 0; n < points; n++ ) { if( pointlist[n][0] >=0 && pointlist[n][0] <= image->width && pointlist[n][1] >=0 && pointlist[n][1] <= image->height ) return TRUE; } return FALSE; }
static int OnDrawCommon( BANNER_NAME )( PCONTROL pc ) { static TEXTCHAR caption[4096]; PBANNER *ppBanner = (PBANNER*)GetCommonUserData( pc ); if( !ppBanner ) return 0; else { PBANNER banner = (*ppBanner); if( banner ) { Image image = GetControlSurface( pc ); if( banner->old_width != image->width || banner->old_height != image->height ) { banner_local.w = banner->old_width = image->width; banner_local.h = banner->old_height = image->height; RerenderFont( banner_local.font , image->width / 18, banner_local.h/10 , NULL, NULL ); // clear bounds-set so a full background is drawn. banner->bit_flags.bounds_set = 0; } banner->bit_flags.drawing = 1; GetControlText( pc, caption, sizeof( caption )/sizeof(TEXTCHAR) ); #ifdef DEBUG_BANNER_DRAW_UPDATE lprintf( WIDE( "--------- BANNER DRAW %s -------------" ), caption ); #endif DrawBannerCaption( pc, banner, image , caption , banner->textcolor , (banner->flags & ( BANNER_OPTION_YESNO|BANNER_OPTION_OKAYCANCEL )) ? ( (image->height * 1 ) / 3 ) : ((image->height)/2) , 0 , banner->flags & BANNER_OPTION_LEFT_JUSTIFY , banner->flags & BANNER_EXPLORER ); banner->bit_flags.drawing = 0; } } return TRUE; }
static int OnDrawCommon( MyName )( PSI_CONTROL pc ) { ClearImageTo( GetControlSurface( pc ), BASE_COLOR_BLACK ); return 1; }
int CPROC DrawGrid( PSI_CONTROL frame ) { int p_r, p_c, p, x, y; Image surface = GetControlSurface( frame ); ClearImageTo( surface, BASE_COLOR_BLACK ); for( p_r = 0; p_r < 3; p_r++ ) { for( p_c = 0; p_c < 4; p_c++ ) { p = p_r*4 + p_c; BlatColor( surface , patch_left(p_c) , patch_top( p_r ) , patch_width(p_c) , patch_height( p_r ) , BASE_COLOR_DARKGREY ); for( x = 0; x < HEX_SIZE; x++ ) for( y = 0; y < HEX_SIZE; y++ ) { // 640 / 4 = 160 // 480 / 3 = 160 //lprintf( WIDE("r_left is %d -> %d r_right is %d"), r_left(x), r_left(x+1), r_width(x) ); if( x == cur_x && y == cur_y && p == cur_s ) { if( bodymap.band[p][x][y] ) { BlatColor( surface, r_left(x), r_top( y ) , r_width(x), r_height( y ) , BASE_COLOR_YELLOW ); } else { BlatColor( surface, r_left(x), r_top( y ) , r_width(x), r_height( y ) , BASE_COLOR_RED ); } } else { if( bodymap.band[p][x][y] ) { BlatColor( surface , r_left(x), r_top( y ) , r_width(x), r_height( y ) , BASE_COLOR_BLUE ); } else { BlatColor( surface , r_left(x), r_top( y ) , r_width(x), r_height( y ) , BASE_COLOR_GREEN ); } } } } } return 1; }
l.system = InterShell_GetSystemName(); l.image = DecodeMemoryToImage( icon_image, sizeof( icon_image ) ); SetTaskLogOutput(); DoRegisterControl( &launchpad ); if( SACK_GetProfileIntEx( GetProgramName(), WIDE("Launchpad/Log Packet Receive"), 0, TRUE ) ) { extern int bLogPacketReceive; bLogPacketReceive = 1; } } //------------------------------------------------------------------------- static int OnDrawCommon( WIDE("Launcher Launchpad") )( PSI_CONTROL pc ) { BlotScaledImageAlpha( GetControlSurface( pc ), l.image, ALPHA_TRANSPARENT ); return 1; } //------------------------------------------------------------------------- static int OnMouseCommon( WIDE("Launcher Launchpad") )( PSI_CONTROL pc, int32_t x, int32_t y, uint32_t b ) { return 1; } //------------------------------------------------------------------------- static uintptr_t OnCreateControl( WIDE("Launcher Launchpad") )( PSI_CONTROL frame, int32_t x, int32_t y, uint32_t w, uint32_t h ) {
PTEXT updateable; SetTextSize( (PTEXT)&tmp, SACK_GetProfileString( GetProgramName(), "Cashball/Background Color", "0", GetText( (PTEXT)&tmp ), 32 ) ); updateable = (PTEXT)&tmp; if( !GetColorVar( &updateable, &cashball_local.background ) ) cashball_local.background = 0xFFFFFFFF; SetTextSize( (PTEXT)&tmp, SACK_GetProfileString( GetProgramName(), "Cashball/Text Color", "$FF000000", GetText( (PTEXT)&tmp ), 32 ) ); updateable = (PTEXT)&tmp; if( !GetColorVar( &updateable, &cashball_local.text ) ) cashball_local.background = 0xFF000000; } AddTimer( 2000, RefreshProc, 0 ); } static int OnDrawCommon( "Cashball" )( PSI_CONTROL pc ) { Image surface = GetControlSurface( pc ); { uint32_t now = GetTickCount(); BlatColorAlpha( surface, 0, 0, surface->width, surface->height, cashball_local.background ); { uint32_t w, h; GetStringSizeFontEx( cashball_local.value, StrLen( cashball_local.value ), &w, &h, *cashball_local.font ); PutStringFontEx( surface, ( surface->width - w ) / 2, (surface->height - h ) / 2, cashball_local.text, 0, cashball_local.value, StrLen( cashball_local.value ), *cashball_local.font ); } } return 1; } static int OnCreateCommon( "Cashball" )( PSI_CONTROL pc )