add files
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
<Solution>
|
||||||
|
<Configurations>
|
||||||
|
<Platform Name="x64" />
|
||||||
|
<Platform Name="x86" />
|
||||||
|
</Configurations>
|
||||||
|
<Project Path="bounce_cpp/bounce_cpp.vcxproj" Id="61c6f079-9b1c-4d66-b9c7-4646f87181a6" />
|
||||||
|
</Solution>
|
||||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,147 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>18.0</VCProjectVersion>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectGuid>{61c6f079-9b1c-4d66-b9c7-4646f87181a6}</ProjectGuid>
|
||||||
|
<RootNamespace>bouncecpp</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v145</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v145</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v145</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v145</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="main.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="resource.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="Resource.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="..\..\..\..\Downloads\hyrax.ico" />
|
||||||
|
<Image Include="..\..\..\..\Downloads\hyrax.jpeg" />
|
||||||
|
<Image Include="hyrax.bmp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="main.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="resource.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="Resource.rc">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="..\..\..\..\Downloads\hyrax.jpeg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</Image>
|
||||||
|
<Image Include="hyrax.bmp">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</Image>
|
||||||
|
<Image Include="..\..\..\..\Downloads\hyrax.ico">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</Image>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup />
|
||||||
|
</Project>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 3.0 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
@@ -0,0 +1,275 @@
|
|||||||
|
#include <windows.h>
|
||||||
|
#include <gdiplus.h>
|
||||||
|
#include <cstring>
|
||||||
|
#include <math.h>
|
||||||
|
#include <objidl.h>
|
||||||
|
|
||||||
|
#pragma comment(lib, "gdiplus.lib")
|
||||||
|
|
||||||
|
using namespace Gdiplus;
|
||||||
|
|
||||||
|
Image* LoadImageFromResource(int resId) {
|
||||||
|
HRSRC hRes = FindResource(NULL, MAKEINTRESOURCE(resId), RT_RCDATA);
|
||||||
|
if (!hRes) return NULL;
|
||||||
|
|
||||||
|
DWORD size = SizeofResource(NULL, hRes);
|
||||||
|
if (size == 0) return NULL;
|
||||||
|
|
||||||
|
HGLOBAL hData = LoadResource(NULL, hRes);
|
||||||
|
if (!hData) return NULL;
|
||||||
|
|
||||||
|
void* pData = LockResource(hData);
|
||||||
|
if (!pData) return NULL;
|
||||||
|
|
||||||
|
HGLOBAL hBuffer = GlobalAlloc(GMEM_MOVEABLE, size);
|
||||||
|
if (!hBuffer) return NULL;
|
||||||
|
|
||||||
|
void* pBuffer = GlobalLock(hBuffer);
|
||||||
|
if (!pBuffer) {
|
||||||
|
GlobalFree(hBuffer);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(pBuffer, pData, size);
|
||||||
|
GlobalUnlock(hBuffer);
|
||||||
|
|
||||||
|
IStream* stream = NULL;
|
||||||
|
HRESULT hr = CreateStreamOnHGlobal(hBuffer, TRUE, &stream);
|
||||||
|
if (FAILED(hr) || !stream) {
|
||||||
|
GlobalFree(hBuffer);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Image* img = Image::FromStream(stream);
|
||||||
|
stream->Release();
|
||||||
|
|
||||||
|
if (!img || img->GetLastStatus() != Ok) {
|
||||||
|
if (img) delete img;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
double x = 200.0, y = 50.0;
|
||||||
|
double vx = 0.0, vy = 0.0;
|
||||||
|
|
||||||
|
double gravity = 1200.0;
|
||||||
|
double restitution = 0.6;
|
||||||
|
double air_drag = 0.999;
|
||||||
|
double ground_friction = 0.8;
|
||||||
|
|
||||||
|
int win_w = 640;
|
||||||
|
int win_h = 480;
|
||||||
|
|
||||||
|
int dragging = 0;
|
||||||
|
int offset_x = 0, offset_y = 0;
|
||||||
|
|
||||||
|
POINT last_mouse;
|
||||||
|
double last_mouse_time = 0.0;
|
||||||
|
double last_time = 0.0;
|
||||||
|
|
||||||
|
LARGE_INTEGER freq;
|
||||||
|
|
||||||
|
ULONG_PTR gdiplusToken;
|
||||||
|
Image* img = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
double now_time() {
|
||||||
|
LARGE_INTEGER t;
|
||||||
|
QueryPerformanceCounter(&t);
|
||||||
|
return (double)t.QuadPart / (double)freq.QuadPart;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||||
|
switch (msg) {
|
||||||
|
|
||||||
|
case WM_CREATE: {
|
||||||
|
QueryPerformanceFrequency(&freq);
|
||||||
|
|
||||||
|
GdiplusStartupInput gdiplusStartupInput;
|
||||||
|
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
|
||||||
|
|
||||||
|
img = LoadImageFromResource(111);
|
||||||
|
|
||||||
|
if (!img || img->GetLastStatus() != Ok) {
|
||||||
|
// MessageBoxA(NULL, "Image failed to load", "Error", MB_OK);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
win_w = 640;
|
||||||
|
win_h = 480;
|
||||||
|
SetWindowPos(hwnd, NULL, 0, 0, win_w, win_h, SWP_NOMOVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetTimer(hwnd, 1, 10, NULL);
|
||||||
|
|
||||||
|
last_time = now_time();
|
||||||
|
last_mouse_time = last_time;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_LBUTTONDOWN: {
|
||||||
|
dragging = 1;
|
||||||
|
offset_x = LOWORD(lParam);
|
||||||
|
offset_y = HIWORD(lParam);
|
||||||
|
|
||||||
|
vx = vy = 0;
|
||||||
|
|
||||||
|
GetCursorPos(&last_mouse);
|
||||||
|
last_mouse_time = now_time();
|
||||||
|
|
||||||
|
SetCapture(hwnd);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_SETCURSOR:
|
||||||
|
if (dragging)
|
||||||
|
SetCursor(LoadCursor(NULL, IDC_SIZEALL));
|
||||||
|
else
|
||||||
|
SetCursor(LoadCursor(NULL, IDC_HAND));
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
case WM_MOUSEMOVE:
|
||||||
|
if (dragging) {
|
||||||
|
POINT p;
|
||||||
|
GetCursorPos(&p);
|
||||||
|
|
||||||
|
double now = now_time();
|
||||||
|
double dt = now - last_mouse_time;
|
||||||
|
|
||||||
|
if (dt > 0) {
|
||||||
|
vx = (p.x - last_mouse.x) / dt;
|
||||||
|
vy = (p.y - last_mouse.y) / dt;
|
||||||
|
}
|
||||||
|
|
||||||
|
last_mouse = p;
|
||||||
|
last_mouse_time = now;
|
||||||
|
|
||||||
|
x = p.x - offset_x;
|
||||||
|
y = p.y - offset_y;
|
||||||
|
|
||||||
|
SetWindowPos(hwnd, NULL, (int)x, (int)y, 0, 0,
|
||||||
|
SWP_NOSIZE | SWP_NOZORDER);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_LBUTTONUP:
|
||||||
|
dragging = 0;
|
||||||
|
ReleaseCapture();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_TIMER: {
|
||||||
|
double now = now_time();
|
||||||
|
double dt = now - last_time;
|
||||||
|
last_time = now;
|
||||||
|
|
||||||
|
int screen_w = GetSystemMetrics(SM_CXSCREEN);
|
||||||
|
int screen_h = GetSystemMetrics(SM_CYSCREEN);
|
||||||
|
|
||||||
|
if (!dragging) {
|
||||||
|
vy += gravity * dt;
|
||||||
|
|
||||||
|
vx *= air_drag;
|
||||||
|
vy *= air_drag;
|
||||||
|
|
||||||
|
x += vx * dt;
|
||||||
|
y += vy * dt;
|
||||||
|
|
||||||
|
if (x <= 0) {
|
||||||
|
x = 0;
|
||||||
|
vx = -vx * restitution;
|
||||||
|
}
|
||||||
|
else if (x >= screen_w - win_w) {
|
||||||
|
x = screen_w - win_w;
|
||||||
|
vx = -vx * restitution;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y >= screen_h - win_h) {
|
||||||
|
y = screen_h - win_h;
|
||||||
|
vy = -vy * restitution;
|
||||||
|
vx *= ground_friction;
|
||||||
|
|
||||||
|
if (fabs(vy) < 5)
|
||||||
|
vy = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y <= 0) {
|
||||||
|
y = 0;
|
||||||
|
vy = -vy * restitution;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetWindowPos(hwnd, NULL, (int)x, (int)y, 0, 0,
|
||||||
|
SWP_NOSIZE | SWP_NOZORDER);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_PAINT: {
|
||||||
|
PAINTSTRUCT ps;
|
||||||
|
HDC hdc = BeginPaint(hwnd, &ps);
|
||||||
|
|
||||||
|
Graphics g(hdc);
|
||||||
|
|
||||||
|
if (img)
|
||||||
|
g.DrawImage(img, 0, 0, win_w, win_h);
|
||||||
|
|
||||||
|
EndPaint(hwnd, &ps);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_KEYDOWN:
|
||||||
|
if (wParam == VK_ESCAPE)
|
||||||
|
DestroyWindow(hwnd);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_DESTROY:
|
||||||
|
if (img) delete img;
|
||||||
|
GdiplusShutdown(gdiplusToken);
|
||||||
|
PostQuitMessage(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DefWindowProcW(hwnd, msg, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int WINAPI wWinMain(
|
||||||
|
HINSTANCE hInstance,
|
||||||
|
HINSTANCE,
|
||||||
|
PWSTR,
|
||||||
|
int nCmdShow
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (IsDebuggerPresent())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
WNDCLASSW wc = { 0 };
|
||||||
|
wc.lpfnWndProc = WndProc;
|
||||||
|
wc.hInstance = hInstance;
|
||||||
|
wc.lpszClassName = L"Hyrax";
|
||||||
|
wc.hCursor = LoadCursor(NULL, IDC_HAND);
|
||||||
|
|
||||||
|
RegisterClassW(&wc);
|
||||||
|
|
||||||
|
HWND hwnd = CreateWindowExW(
|
||||||
|
WS_EX_TOPMOST,
|
||||||
|
L"Hyrax",
|
||||||
|
L"",
|
||||||
|
WS_POPUP,
|
||||||
|
(int)x, (int)y,
|
||||||
|
win_w, win_h,
|
||||||
|
NULL, NULL, hInstance, NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
ShowWindow(hwnd, nCmdShow);
|
||||||
|
|
||||||
|
MSG msg;
|
||||||
|
while (GetMessageW(&msg, NULL, 0, 0)) {
|
||||||
|
TranslateMessage(&msg);
|
||||||
|
DispatchMessageW(&msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Visual C++ generated include file.
|
||||||
|
// Used by Resource.rc
|
||||||
|
//
|
||||||
|
#define IDR_RCDATA1 111
|
||||||
|
#define IDI_ICON1 114
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 115
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user