Ejemplo n.º 1
0
void Game_DecoratedText::Draw(int _x, int _y, int _n, int _w, BYTE _align) const{
	int color = 0x00ffffff;

	int tmpX = _x; // 現在の描画位置
	// _align値に応じて描画位置を判断する
	int width = GetDrawWidth();
	switch(_align){
	case ALIGN_CENTER:
		tmpX += (_w-width)/2;
		break;
	case ALIGN_RIGHT:
		tmpX += (_w-width);
		break;
	}

	int count = 0;
	if(_n==-1){
		count = GetStrLen();
	}else{
		count = _n;
	}

	for(int n=0; n<min(DECORATEDTEXT_MAX_LENGTH, count); n++){
		// 使われていない文字に出会ったらすぐに終了する
		if(!drawBuf[n].used) return;
		// フラグから文字色を判断する。
		if(drawBuf[n].flags & DECORATEDTEXT_FLAG_ACTIVE){
			color = GetPresetColor(presetColor, COLORSET_COLOR_ACTIVE); 
		}else if(drawBuf[n].flags & DECORATEDTEXT_FLAG_POSITIVE){
			color = GetPresetColor(presetColor, COLORSET_COLOR_POSITIVE); 
		}else if(drawBuf[n].flags & DECORATEDTEXT_FLAG_POSITIVE){
			color = GetPresetColor(presetColor, COLORSET_COLOR_NEGATIVE); 
		}else{
			color = GetPresetColor(presetColor, COLORSET_COLOR_NORMAL); 
		}

		// 文字を描画する
		DrawStringToHandle(tmpX, _y, drawBuf[n].character,
			color, hFont);

		// 描画位置を送る
		if(drawBuf[n].flags & DECORATEDTEXT_FLAG_HALF){
			tmpX += halfCharWidth;
		}else{
			tmpX += charWidth;
		}
	}
}
Ejemplo n.º 2
0
static void InitTypeHandle( imp_image_handle *ii,
                            imp_type_handle  *it,
                            location_context *lc  ) {
    /***********************************************************************/
//Set type handle to the base state
//If array poise at first index
    imp_type_handle sub;
    dr_array_info   info;
    dr_handle       btype;
    dr_array_stat   stat;
    uint_32         base_stride;
    uint_32         n_el;

    if( it->state == DF_NOT ) {
        DRSetDebug( ii->dwarf->handle ); /* must do at each call into dwarf */
        DRGetTypeInfo( it->type, &it->typeinfo );
        it->state = DF_SET;
        it->sub_array = FALSE;
        if( it->typeinfo.kind == DR_TYPEK_ARRAY ) {
            if( it->typeinfo.size == 0 ) {
                btype =  DRSkipTypeChain( it->type ); /* skip modifiers and typedefs */
                stat = DRGetArrayInfo( btype, &info );
                if( stat & DR_ARRAY_STRIDE_SIZE ) {
                    base_stride = info.stride_size/8;
                } else {
                    btype = DRGetTypeAT( btype );    /* get base type */
                    sub.type = btype;
                    sub.im = it->im;
                    sub.state = DF_NOT;
                    InitTypeHandle( ii, &sub, lc );
                    base_stride = sub.typeinfo.size;
                }
                it->array.base_stride = base_stride;
                it->array.column_major = 0; /* 1 for fortran */
                if( stat & DR_ARRAY_ORDERING ) {
                    if( info.ordering == DW_ORD_col_major ) {
                        it->array.column_major = 1;
                    }
                } else if( IMH2MODI( ii, it->im )->lang == DR_LANG_FORTRAN ) {
                    it->array.column_major = 1;
                }
                if( info.child == DR_HANDLE_NUL ) { // set info now
                    it->array.dims = 1;
                    it->array.low = 0;
                    it->array.index = DR_HANDLE_NUL;
                    if( stat & DR_ARRAY_COUNT ) {
                        if( info.count == 0 ) { // ie  char (*x)[]
                            info.count = 1;
                        }
                        it->typeinfo.size = info.count * it->array.base_stride;
                        it->array.num_elts= info.count;
                    } else {
                        it->typeinfo.size =  it->array.base_stride;
                    }
                    if( !it->array.column_major ) {
                        base_stride = it->typeinfo.size;
                        n_el = it->array.num_elts;
                        base_stride = n_el ? base_stride / n_el : 0;
                        it->array.base_stride = base_stride;
                    }
                    it->array.is_set = TRUE;
                    it->array.is_based = FALSE;
                    it->sub_array = FALSE;
                } else {
                    it->sub_array = TRUE;
                    it->array.is_set = FALSE;
                    it->array.index = GetArrayDim( info.child, 0 );
                }
            }
        } else if( it->typeinfo.kind == DR_TYPEK_STRING ) {
            if( DRStringLengthAT( it->type ) ) {
                if( !GetStrLen( ii, it->type, lc, &it->typeinfo ) ) {
                    it->typeinfo.size = 1;
                }
            }
        }
    }
    if( it->typeinfo.kind == DR_TYPEK_ARRAY ) {
        if( !it->array.is_set ) {
            GetArraySize( ii, it, lc );
        } else if( it->array.is_based ) {
            GetArraySubSize( ii, it, lc );
        }
    }
}