Другое С/С++ Вопрос - Ответ

Cake_

Известный
Проверенный
263
313
Объясните простым языком что такое явное преобразование и для чего оно используется?
 
Последнее редактирование:

-raymond-

Известный
110
9
как хукнуть клавишу на клавиатуре которую я отправляю серверу?
 

MCDXLVIII

Участник
39
9
Как телепортнуться , но при этом не мелькать.Как на видео или подобное.(c++ api)
 

Ranto

Участник
45
1
Есть где-нибудь уроки по d3d(d3d9/x i td), хотелось бы почитать; а то во-всяких видео-уроках недоскажут, пропустят через один шаг
zaranee spasibo :)
 

Ranto

Участник
45
1
upload_2018-12-28_19-40-40.png

попробуй в этом окне вставить путь к своему проекту (типа где находятся твои файлы imgui)

upload_2018-12-28_20-24-47.png

как справиться с этим?
 

Cake_

Известный
Проверенный
263
313
upload_2018-12-28_19-52-15.png

В чём ошибка?
C++:
#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS 1
#include <windows.h>
#include <string>
#include <assert.h>
#include <process.h>

#include "SAMPFUNCS_API.h"
#include "game_api\game_api.h"

#include "imgui.h"
#include "imgui_impl_dx9.h"
#include "imgui_impl_win32.h"
#include <d3d9.h>
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#include <tchar.h>
extern LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);

SAMPFUNCS *SF = new SAMPFUNCS();




bool CALLBACK Present(CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion)
{
    bool activew = true;
    if (SUCCEEDED(SF->getRender()->BeginRender()))
    {
       
   
        if (activew)
        {
            ImGui_ImplDX9_NewFrame();
            ImGui_ImplWin32_NewFrame();
            ImGui::NewFrame();

            ImGui::Begin("ImGui меню", &activew, ImVec2(305, 160), 0.8f, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoResize);
            {
                ImGui::Checkbox("Aimbot", &bAimbot);
                ImGui::Checkbox("WH", &bAimbot);
                ImGui::Checkbox("SpeedHack", &bAimbot);
                ImGui::Checkbox("Что-то крутое", &bAimbot);
            }
            ImGui::End();
        }
        ImGui::EndFrame();
        ImGui::Render();
        ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData());

        SF->getRender()->EndRender();
    }
    return true;
}

HRESULT CALLBACK Reset(D3DPRESENT_PARAMETERS* pPresentationParameters)
{
    return true;
}

bool CALLBACK WndProcHandler(HWND hwd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    ImGui_ImplWin32_WndProcHandler(hwd, msg, wParam, lParam);
    return true;
}

void CALLBACK PluginFree()
{

    ImGui_ImplDX9_Shutdown();
    ImGui_ImplWin32_Shutdown();
    ImGui::DestroyContext();
}


void CALLBACK mainloop()
{

    static bool init = false;
    if (!init)
    {

        if (GAME == nullptr)
            return;
        if (GAME->GetSystemState() != eSystemState::GS_PLAYING_GAME)
            return;
        if (!SF->getSAMP()->IsInitialized())
            return;

        ImGui::CreateContext();
        ImGuiIO& io = ImGui::GetIO(); (void)io;
        ImGui_ImplWin32_Init(GetActiveWindow());
        ImGui_ImplDX9_Init(SF->getRender()->getD3DDevice());

        SF->getSAMP()->getChat()->AddChatMessage( D3DCOLOR_XRGB( 0, 0xAA, 0 ), "SAMPFUNCS Plugin loaded." );
        SF->getRender()->registerD3DCallback(eDirect3DDeviceMethods::D3DMETHOD_PRESENT, Present);
        SF->getRender()->registerD3DCallback(eDirect3DDeviceMethods::D3DMETHOD_RESET, Reset);
        SF->getGame()->registerWndProcCallback(SFGame::MEDIUM_CB_PRIORITY, WndProcHandler);
        SF->getGame()->registerGameDestructorCallback(PluginFree);

       


        init = true;
    }
}


BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReasonForCall, LPVOID lpReserved)
{
    switch (dwReasonForCall)
    {
        case DLL_PROCESS_ATTACH:
            SF->initPlugin(mainloop, hModule);
            break;
        case DLL_THREAD_ATTACH:
        case DLL_THREAD_DETACH:
        case DLL_PROCESS_DETACH:
            break;
    }
    return TRUE;
}

LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    return LRESULT();
}
 

Musaigen

abobusnik
Проверенный
1,583
1,302
Посмотреть вложение 23143
В чём ошибка?
C++:
#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS 1
#include <windows.h>
#include <string>
#include <assert.h>
#include <process.h>

#include "SAMPFUNCS_API.h"
#include "game_api\game_api.h"

#include "imgui.h"
#include "imgui_impl_dx9.h"
#include "imgui_impl_win32.h"
#include <d3d9.h>
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#include <tchar.h>
extern LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);

SAMPFUNCS *SF = new SAMPFUNCS();




bool CALLBACK Present(CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion)
{
    bool activew = true;
    if (SUCCEEDED(SF->getRender()->BeginRender()))
    {
      
  
        if (activew)
        {
            ImGui_ImplDX9_NewFrame();
            ImGui_ImplWin32_NewFrame();
            ImGui::NewFrame();

            ImGui::Begin("ImGui меню", &activew, ImVec2(305, 160), 0.8f, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoResize);
            {
                ImGui::Checkbox("Aimbot", &bAimbot);
                ImGui::Checkbox("WH", &bAimbot);
                ImGui::Checkbox("SpeedHack", &bAimbot);
                ImGui::Checkbox("Что-то крутое", &bAimbot);
            }
            ImGui::End();
        }
        ImGui::EndFrame();
        ImGui::Render();
        ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData());

        SF->getRender()->EndRender();
    }
    return true;
}

HRESULT CALLBACK Reset(D3DPRESENT_PARAMETERS* pPresentationParameters)
{
    return true;
}

bool CALLBACK WndProcHandler(HWND hwd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    ImGui_ImplWin32_WndProcHandler(hwd, msg, wParam, lParam);
    return true;
}

void CALLBACK PluginFree()
{

    ImGui_ImplDX9_Shutdown();
    ImGui_ImplWin32_Shutdown();
    ImGui::DestroyContext();
}


void CALLBACK mainloop()
{

    static bool init = false;
    if (!init)
    {

        if (GAME == nullptr)
            return;
        if (GAME->GetSystemState() != eSystemState::GS_PLAYING_GAME)
            return;
        if (!SF->getSAMP()->IsInitialized())
            return;

        ImGui::CreateContext();
        ImGuiIO& io = ImGui::GetIO(); (void)io;
        ImGui_ImplWin32_Init(GetActiveWindow());
        ImGui_ImplDX9_Init(SF->getRender()->getD3DDevice());

        SF->getSAMP()->getChat()->AddChatMessage( D3DCOLOR_XRGB( 0, 0xAA, 0 ), "SAMPFUNCS Plugin loaded." );
        SF->getRender()->registerD3DCallback(eDirect3DDeviceMethods::D3DMETHOD_PRESENT, Present);
        SF->getRender()->registerD3DCallback(eDirect3DDeviceMethods::D3DMETHOD_RESET, Reset);
        SF->getGame()->registerWndProcCallback(SFGame::MEDIUM_CB_PRIORITY, WndProcHandler);
        SF->getGame()->registerGameDestructorCallback(PluginFree);

      


        init = true;
    }
}


BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReasonForCall, LPVOID lpReserved)
{
    switch (dwReasonForCall)
    {
        case DLL_PROCESS_ATTACH:
            SF->initPlugin(mainloop, hModule);
            break;
        case DLL_THREAD_ATTACH:
        case DLL_THREAD_DETACH:
        case DLL_PROCESS_DETACH:
            break;
    }
    return TRUE;
}

LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    return LRESULT();
}
В том что переменная не объявлена.
 

ALF

Известный
Проверенный
320
537
  • Нравится
Реакции: Harryss

Harryss

Участник
233
26
Попробовал объявить при загрузке игры в mainloop'е - новая дилема ;( проблема с отображением дисплея, хотя ocornut отмечал что параметры у него необязательны


Если просто в mainloop, тогда проблема с шрифтом.


Буду сильно благодарен любому, кто сумеет помочь. На C++ реальные планы, и при этом предоставилась возможность начать знакомство с разработкой под SAMP
 
Последнее редактирование:

ALF

Известный
Проверенный
320
537
  • Нравится
Реакции: Harryss