[Mu PC] [Main.exe 1.04d] Draw text function

Hôm nay chia sẻ các hàm để draw text cho main 1.04d nhé mọi người. Đầy đủ để chơi luôn.

Mã:
#define pSetTextFont            ((int(__thiscall*)(LPVOID This, HFONT a2)) 0x00420120)

#define pUnknow00420080            ((DWORD(__cdecl*)(LPVOID This, char Arg1)) 0x00420080)
#define pUnknow004200F0            ((DWORD(__cdecl*)(LPVOID This, char Arg1)) 0x004200F0)
#define pSetTextColor            ((void(__thiscall*)(LPVOID This, int r, int g, int b, int h)) 0x00420040)
#define pSetBackgroundTextColor    ((void(__thiscall*)(LPVOID This, int r, int g, int b, int h)) 0x004200B0)
#define pGetTextLine            ((LPCSTR(__thiscall*)(LPVOID This, int LineNumber)) 0x00402320)

#define pDrawText                ((int(__thiscall*)(LPVOID This, int PosX, int PosY, LPCTSTR Text, int Width, int Height, LPINT Align, int unknow)) 0x00420150)

Drawtext:

You must be registered for see images


Code mẫu:

trong ví dụ mình sẽ viết đoạn text
http://clbgameviet.net/ nên không dùng pGetTextLine.


Mã:
//Font tahoma
    //Text cỡ 15, chữ thường, màu đỏ nền đen, căn giữa
    HFONT TextFont = CreateFontA(15, 0, 0, 0, 400, 0, 0, 0, 0x1, 0, 0, 3, 0, "Tahoma");
    pSetTextFont(pTextThis(), TextFont); //set font
    //pUnknow00420080(pTextThis(), -1); //chả biết để làm gì, chưa test. Bỏ qua cũng được.
    //pUnknow004200F0(pTextThis(), 0); //chả biết để làm gì, chưa test. Bỏ qua cũng được.
    pSetTextColor(pTextThis(), 255, 0, 0, 255);
    pSetBackgroundTextColor(pTextThis(), 0, 0, 0, 60);
    pDrawText(pTextThis(), 50, 200, "http://clbgameviet.net/", 150, 0, (LPINT)3, 0);


    //Text cỡ 15, chữ đậm, màu trắng nền xanh, căn giữa
    HFONT TextFontBold = CreateFontA(15, 0, 0, 0, 700, 0, 0, 0, 0x1, 0, 0, 3, 0, "Tahoma");
    pSetTextFont(pTextThis(), TextFontBold); //set font


    pSetTextColor(pTextThis(), 255, 255, 255, 255);
    pSetBackgroundTextColor(pTextThis(), 0, 255, 0, 80);
    pDrawText(pTextThis(), 50, 220, "http://clbgameviet.net/", 150, 0, (LPINT)3, 0);


    //Text cỡ 15, chữ đậm, màu xanh không nền, căn trái
    pSetTextColor(pTextThis(), 0, 0, 255, 255);
    pSetBackgroundTextColor(pTextThis(), 0, 0, 0, 0);
    pDrawText(pTextThis(), 50, 240, "http://clbgameviet.net/", 150, 0, (LPINT)0, 0);

    //Thừa hưởng pTextThis cũ đã config
    pDrawText(pTextThis(), 50, 260, "http://clbgameviet.net/", 150, 0, (LPINT)0, 0);

    //Get và draw dòng 1B4 = 436 trong file text.bmd (text_eng.bmd tùy theo ngôn ngữ)
    pDrawText(pTextThis(), 50, 280, pGetTextLine(pTextLineThis, 0x1B4), 0, 0, (LPINT)0, 0);
    
    //Giải phóng
    DeleteObject(TextFont);
    DeleteObject(TextFontBold);

Demo:

You must be registered for see images


You must be registered for see images


Lưu ý: pTextThis() sẽ thừa hưởng các config đã set từ trước.
 
Chỉnh sửa lần cuối:
^1.04d khác offset mà. Sai tùm lum từ pGetModel(pModelThis(), ItemID) bị treo main rồi.

//------------------------------

Dùng
pGetTextLine để lấy 1 dòng trong text.bmd. Đã cập nhật thêm trong ví dụ.
 
Chỉnh sửa lần cuối:
Bên trên