Join the forum, it's quick and easy

Would you like to react to this message? Create an account in a few clicks or log in to continue.

    [Source Code] Crosshair With D3D

    CYBER
    CYBER
    CO - Admin
    CO - Admin


    Male
    Thread & Post : 215
    Point Forum : 584437
    Thanks Given : 4034
    Join date : 05.08.11
    Age : 34
    Lokasi : S-N-U-T-Z-E-R

    [Source Code] Crosshair With D3D Empty [Source Code] Crosshair With D3D

    Post by CYBER Mon Aug 15, 2011 9:51 am

    Alat : MS Visual Express 2010

    Code : [You must be registered and logged in to see this link.]

    #include <windows.h>
    #include <iostream>
    #include <math.h>
    using namespace std;
    bool crosshairon=false;
    HDC ragedc = NULL;
    int crosshairsize=0;
    int cx=0;
    int cy=0;
    void CrossThread(void)
    {
    while(1)
    {
    if(GetAsyncKeyState(VK_NUMPAD0)&1)//Ganti "NUMPAD0" dengan Hotkey yang kamu Mau
    {
    crosshairon=!crosshairon;
    ragedc = GetDC(HWND_DESKTOP);
    cx=GetSystemMetrics(SM_CXSCREEN)/2-((crosshairsize-1)/2);
    cy=GetSystemMetrics(SM_CYSCREEN)/2-((crosshairsize-1)/2);
    }
    Sleep(1);
    }
    }
    int main()
    {
    cout<<"Crosshair size in pixels:\n";
    cin>>crosshairsize;
    if(crosshairsize%2==0)
    {
    crosshairsize+=1;
    }
    system("cls");
    cout<<"Press numpad0 to toggle the crosshair on and off\n";
    CreateThread(0,0,(LPTHREAD_START_ROUTINE)CrossThread,0,0,0);
    while(1)
    {
    if(crosshairon==true)
    {
    for(int i=0;i<crosshairsize;i++)
    {
    SetPixel(ragedc, cx+i, cy+((crosshairsize-1)/2), RGB(255,0,0));
    SetPixel(ragedc, cx+((crosshairsize-1)/2), cy+i, RGB(0,0,255));
    }
    if(crosshairon==false)

    for(int i=1;i<crosshairsize;i++)
    {
    SetPixel(ragedc, cx+i, cy+((crosshairsize-1)/2), RGB(0,0,0));
    SetPixel(ragedc, cx+((crosshairsize-1)/2), cy+i, RGB(0,0,0));
    }
    }
    Sleep(33);
    }
    }



    NB : SC Work di Semua Game yang make OpenGL ato D3D

    Credit SC : Rizwanda << ME

      Waktu sekarang Thu Nov 21, 2024 8:19 pm