i tries this
CODE
#include <stdio.h>
#include <windows.h>
#include <process.h>
#include "ChatBox.h"
#include <d3d9.h>
#include <d3dx9.h>
#include <time.h>
#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")
LPDIRECT3D9 d3d;
LPDIRECT3DDEVICE9 d3ddev;
LPD3DXBUFFER Buf;
LPD3DXMESH Mesh;
LPDIRECT3DTEXTURE9 Texture;
HWND hWnd;
ID3DXSprite *Sprite;
ID3DXFont *Font;
void ChatBox::Create()
{
hWnd = FindWindow(NULL, "GTA: San Andreas");
if(hWnd == NULL)
{
printf("Error");
Sleep(5000);
}
//SetWindowText(hWnd, "PES:MP");
initD3D(hWnd);
Run(hWnd);
//d9dx->render_frame(d3d, d3ddev);
}
void ChatBox::Draw()
{
RECT rect;
rect.top = 9;
rect.left = 9;
rect.bottom = 110;
rect.right = 550;
if(FAILED(D3DXCreateFont(d3ddev, 100, 100, FW_BOLD, 1, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &Font)))
{
MessageBox(NULL, "An Error has been occured when creating the ChatBox\n the error may come from your DirectX\n try to reinstall it or re-try to open again.1", "Error", MB_OK | MB_ICONSTOP);
return;
}
if(FAILED(D3DXCreateSprite(d3ddev,&Sprite)))
{
MessageBox(NULL, "An Error has been occured when creating the ChatBox\n the error may come from your DirectX\n try to reinstall it or re-try to open again.1", "Error", MB_OK | MB_ICONSTOP);
return;
}
if(FAILED(Sprite->Begin( D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE )))
{
MessageBox(NULL, "An Error has been occured when creating the ChatBox\n the error may come from your DirectX\n try to reinstall it or re-try to open again.", "Error", MB_OK | MB_ICONSTOP);
return;
}
Font->DrawTextA(Sprite, "teest", -1, &rect, DT_NOCLIP|DT_SINGLELINE|DT_LEFT,0xFF000000);
Font->Release();
Sprite->End();
}
int ChatBox::AddMessage(const char *Msg, ...)
{
char buf[512];
memset(buf,0,512);
va_list ap;
va_start(ap, Msg);
vsprintf(buf, Msg, ap);
va_end(ap);
return 1;
}
int initD3D(HWND hwnd)
{
d3d = Direct3DCreate9(D3D_SDK_VERSION);
if (d3d == NULL)
{
MessageBox(hwnd, "An Error has been occured when creating the ChatBox\n the error may come from your DirectX\n try to reinstall it or re-try to open again.", "Error", MB_OK | MB_ICONSTOP);
return 0;
}
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory(&d3dpp, sizeof(d3dpp));
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &d3ddev);
if (d3ddev == NULL)
{
MessageBox(hwnd, "An Error has been occured when creating the ChatBox\n the error may come from your DirectX\n try to reinstall it or re-try to open again.", "Error", MB_OK | MB_ICONSTOP);
return 0;
}
srand(time(NULL));
return 1;
}
void Run(HWND hwnd)
{
if (d3ddev == NULL)
{
MessageBox(hwnd, "An Error has been occured when creating the ChatBox\n the error may come from your DirectX\n try to reinstall it or re-try to open again.", "Error", MB_OK | MB_ICONSTOP);
return;
}
d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,255,0), 1.0f, 0);
if(FAILED(d3ddev->BeginScene()))
{
MessageBox(hwnd, "An Error has been occured when creating the ChatBox\n the error may come from your DirectX\n try to reinstall it or re-try to open again.", "Error", MB_OK | MB_ICONSTOP);
return;
}
else
{
d3ddev->EndScene();
}
d3ddev->Present(NULL, NULL, NULL, NULL);
}
void render_frame(LPDIRECT3D9 d3d, LPDIRECT3DDEVICE9 d3ddev)
{
d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 40, 100), 1.0f, 0);
d3ddev->BeginScene();
d3ddev->EndScene();
d3ddev->Present(NULL, NULL, NULL, NULL);
}
void cleanD3D(LPDIRECT3D9 d3d, LPDIRECT3DDEVICE9 d3ddev)
{
d3ddev->Release();
d3d->Release();
}
and i like to show the teest word in the GTA San Andreas screen
no errors or warnings for it and not even a probleme
but after loading it with a console nothing happens
can u help me please ?