Тема: Speed Text
Показать сообщение отдельно
Старый 11.04.2009, 14:49   #15
Venom2
 
Сообщений: n/a
Ответ: Speed Text

Да это элементарная GDI обертка
Примерно так на PureBasic будет
Global target.IDIRECTDRAWSURFACE7
Global context.l
Global screen.RECT
Global color.l
Global font.l

ProcedureDLL ST_Initialize(*buffer.LONG)
    *buffer + 3
    target = *buffer\l
    color = $FFFFFF
EndProcedure

ProcedureDLL ST_LoadFont(name.s, height, bold, italic, underline, strikeout, quality)
    ProcedureReturn CreateFont_(height, 0, 0, 0, (bold & 1) * #FW_NORMAL, italic & 1, underline & 1, strikeout & 1, #DEFAULT_CHARSET, #OUT_DEFAULT_PRECIS, #CLIP_DEFAULT_PRECIS, quality, #DEFAULT_PITCH, name)
EndProcedure

ProcedureDLL ST_FreeFont(handle)
    DeleteObject_(handle)
EndProcedure

ProcedureDLL ST_SetFont(handle)
    font = handle
EndProcedure

ProcedureDLL ST_TextColor(red, green, blue)
    color = (red << 16) | (green << 8) | blue
EndProcedure

ProcedureDLL ST_LockBuffer()
    ProcedureReturn target\GetDC(@context)
EndProcedure

ProcedureDLL ST_UnlockBuffer()
    ProcedureReturn target\ReleaseDC(context)
EndProcedure

ProcedureDLL ST_DrawTextFast(xpos, ypos, text, xalign, yalign)
    Static length.l, bound.RECT, size.RECT
    If (context)
        length = lstrlen_(text)
        GetTextExtentPoint32_(context, text, length, size)
        With bound
            \left = xpos
            \top = ypos
            \right = xpos + size\cx
            \bottom = ypos + size\cy
        EndWith
        SetBkMode_(context, #TRANSPARENT)
        SetTextColor_(context, color)
        SelectObject_(context, font)
        DrawText_(context, text, length, bound, xalign | yalign)
    EndIf
EndProcedure
потому не стоит ее юзать
 
Ответить с цитированием