Объясните простым языком что такое явное преобразование и для чего оно используется?
int i = 2;
float j = 3.3f;
i = (int)j; // явное
i = j // неявное
Ты сам везде в коде написал "a <= b".Почему в cmd выводит только <= ??
Посмотреть вложение 23122
Как это фиксануть?
Посмотреть вложение 23131
как справиться с этим?
reinterpret_cast<LPCVOID>(addr)
reinterpret_cast<LPVOID>(addr)
#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();
}
В том что переменная не объявлена.Посмотреть вложение 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(); }
mainloop
ImGui, происходит при загрузке игры. Прочитал данный топик на GitHub от ocornut'а, выяснил, что в коде нужно объявлять ImGui::CreateContext() , но не могу догадаться, в какой блок кода его занести. Есть варианты?
Попробовал объявить при загрузке игры в mainloop'е - новая дилема ;( проблема с отображением дисплея, хотя ocornut отмечал что параметры у него необязательныmainloop
https://blast.hk/threads/23083/