├── .gitmodules ├── BuildNetwork ├── BuildNetwork.cpp ├── BuildNetwork.h ├── BuildNetworkPacket.cpp ├── BuildNetworkPacket.h ├── PingPacket.cpp ├── PingPacket.h ├── SingleBlockUpdatePacket.cpp ├── SingleBlockUpdatePacket.h ├── ZoneLoadPacket.cpp ├── ZoneLoadPacket.h ├── ZoneUpdatePacket.cpp └── ZoneUpdatePacket.h ├── BuildWindow.cpp ├── BuildWindow.h ├── BuildingMod.cpp ├── BuildingMod.h ├── CMakeLists.txt ├── CMakeSettings.json ├── ChunkUpdate.cpp ├── ChunkUpdate.h ├── DButton.cpp ├── DButton.h ├── GenerateProjectCMake.py ├── README-imagery └── GUI.png ├── README.md ├── ZoneSaver ├── WorldContainer.cpp ├── WorldContainer.h ├── ZoneBlock.cpp ├── ZoneBlock.h ├── ZoneContainer.cpp ├── ZoneContainer.h ├── ZoneSaver.cpp └── ZoneSaver.h ├── imgui-1.73 ├── .editorconfig ├── .travis.yml ├── CMakeLists.txt ├── LICENSE.txt ├── MakeCWModsCMake.py ├── docs │ ├── CHANGELOG.txt │ ├── README.md │ ├── TODO.txt │ ├── issue_template.md │ └── pull_request_template.md ├── examples │ ├── .gitignore │ ├── README.txt │ ├── example_allegro5 │ │ ├── README.md │ │ ├── example_allegro5.vcxproj │ │ ├── example_allegro5.vcxproj.filters │ │ ├── imconfig_allegro5.h │ │ └── main.cpp │ ├── example_apple_metal │ │ ├── README.md │ │ ├── Shared │ │ │ ├── AppDelegate.h │ │ │ ├── AppDelegate.m │ │ │ ├── Renderer.h │ │ │ ├── Renderer.mm │ │ │ ├── ViewController.h │ │ │ ├── ViewController.mm │ │ │ └── main.m │ │ ├── example_apple_metal.xcodeproj │ │ │ └── project.pbxproj │ │ ├── iOS │ │ │ ├── Base.lproj │ │ │ │ └── Main.storyboard │ │ │ ├── Default-568h@2x.png │ │ │ ├── Info-iOS.plist │ │ │ └── Launch Screen.storyboard │ │ └── macOS │ │ │ ├── Base.lproj │ │ │ └── Main.storyboard │ │ │ └── Info-macOS.plist │ ├── example_apple_opengl2 │ │ ├── example_apple_opengl2.xcodeproj │ │ │ └── project.pbxproj │ │ └── main.mm │ ├── example_emscripten │ │ ├── Makefile │ │ ├── README.md │ │ ├── main.cpp │ │ └── shell_minimal.html │ ├── example_glfw_metal │ │ ├── Makefile │ │ └── main.mm │ ├── example_glfw_opengl2 │ │ ├── Makefile │ │ ├── build_win32.bat │ │ ├── example_glfw_opengl2.vcxproj │ │ ├── example_glfw_opengl2.vcxproj.filters │ │ └── main.cpp │ ├── example_glfw_opengl3 │ │ ├── Makefile │ │ ├── build_win32.bat │ │ ├── example_glfw_opengl3.vcxproj │ │ ├── example_glfw_opengl3.vcxproj.filters │ │ └── main.cpp │ ├── example_glfw_vulkan │ │ ├── CMakeLists.txt │ │ ├── build_win32.bat │ │ ├── build_win64.bat │ │ ├── example_glfw_vulkan.vcxproj │ │ ├── example_glfw_vulkan.vcxproj.filters │ │ ├── gen_spv.sh │ │ ├── glsl_shader.frag │ │ ├── glsl_shader.vert │ │ └── main.cpp │ ├── example_glut_opengl2 │ │ ├── Makefile │ │ ├── example_glut_opengl2.vcxproj │ │ ├── example_glut_opengl2.vcxproj.filters │ │ └── main.cpp │ ├── example_marmalade │ │ ├── data │ │ │ └── app.icf │ │ ├── main.cpp │ │ └── marmalade_example.mkb │ ├── example_null │ │ ├── Makefile │ │ ├── build_win32.bat │ │ └── main.cpp │ ├── example_sdl_directx11 │ │ ├── build_win32.bat │ │ ├── example_sdl_directx11.vcxproj │ │ ├── example_sdl_directx11.vcxproj.filters │ │ └── main.cpp │ ├── example_sdl_opengl2 │ │ ├── Makefile │ │ ├── README.md │ │ ├── build_win32.bat │ │ ├── example_sdl_opengl2.vcxproj │ │ ├── example_sdl_opengl2.vcxproj.filters │ │ └── main.cpp │ ├── example_sdl_opengl3 │ │ ├── Makefile │ │ ├── README.md │ │ ├── build_win32.bat │ │ ├── example_sdl_opengl3.vcxproj │ │ ├── example_sdl_opengl3.vcxproj.filters │ │ └── main.cpp │ ├── example_sdl_vulkan │ │ ├── example_sdl_vulkan.vcxproj │ │ ├── example_sdl_vulkan.vcxproj.filters │ │ └── main.cpp │ ├── example_win32_directx10 │ │ ├── build_win32.bat │ │ ├── example_win32_directx10.vcxproj │ │ ├── example_win32_directx10.vcxproj.filters │ │ └── main.cpp │ ├── example_win32_directx11 │ │ ├── build_win32.bat │ │ ├── example_win32_directx11.vcxproj │ │ ├── example_win32_directx11.vcxproj.filters │ │ └── main.cpp │ ├── example_win32_directx12 │ │ ├── build_win32.bat │ │ ├── example_win32_directx12.vcxproj │ │ ├── example_win32_directx12.vcxproj.filters │ │ └── main.cpp │ ├── example_win32_directx9 │ │ ├── build_win32.bat │ │ ├── example_win32_directx9.vcxproj │ │ ├── example_win32_directx9.vcxproj.filters │ │ └── main.cpp │ ├── imgui_examples.sln │ ├── imgui_impl_allegro5.cpp │ ├── imgui_impl_allegro5.h │ ├── imgui_impl_dx10.cpp │ ├── imgui_impl_dx10.h │ ├── imgui_impl_dx11.cpp │ ├── imgui_impl_dx11.h │ ├── imgui_impl_dx12.cpp │ ├── imgui_impl_dx12.h │ ├── imgui_impl_dx9.cpp │ ├── imgui_impl_dx9.h │ ├── imgui_impl_glfw.cpp │ ├── imgui_impl_glfw.h │ ├── imgui_impl_glut.cpp │ ├── imgui_impl_glut.h │ ├── imgui_impl_marmalade.cpp │ ├── imgui_impl_marmalade.h │ ├── imgui_impl_metal.h │ ├── imgui_impl_metal.mm │ ├── imgui_impl_opengl2.cpp │ ├── imgui_impl_opengl2.h │ ├── imgui_impl_opengl3.cpp │ ├── imgui_impl_opengl3.h │ ├── imgui_impl_osx.h │ ├── imgui_impl_osx.mm │ ├── imgui_impl_sdl.cpp │ ├── imgui_impl_sdl.h │ ├── imgui_impl_vulkan.cpp │ ├── imgui_impl_vulkan.h │ ├── imgui_impl_win32.cpp │ ├── imgui_impl_win32.h │ └── libs │ │ ├── gl3w │ │ └── GL │ │ │ ├── gl3w.c │ │ │ ├── gl3w.h │ │ │ └── glcorearb.h │ │ ├── glfw │ │ ├── COPYING.txt │ │ ├── include │ │ │ └── GLFW │ │ │ │ ├── glfw3.h │ │ │ │ └── glfw3native.h │ │ ├── lib-vc2010-32 │ │ │ └── glfw3.lib │ │ └── lib-vc2010-64 │ │ │ └── glfw3.lib │ │ └── usynergy │ │ ├── README.txt │ │ ├── uSynergy.c │ │ └── uSynergy.h ├── imconfig.h ├── imgui.cpp ├── imgui.h ├── imgui_demo.cpp ├── imgui_draw.cpp ├── imgui_internal.h ├── imgui_widgets.cpp ├── imstb_rectpack.h ├── imstb_textedit.h ├── imstb_truetype.h └── misc │ ├── README.txt │ ├── cpp │ ├── README.txt │ ├── imgui_stdlib.cpp │ └── imgui_stdlib.h │ ├── fonts │ ├── Cousine-Regular.ttf │ ├── DroidSans.ttf │ ├── Karla-Regular.ttf │ ├── ProggyClean.ttf │ ├── ProggyTiny.ttf │ ├── README.txt │ ├── Roboto-Medium.ttf │ └── binary_to_compressed_c.cpp │ ├── freetype │ ├── README.md │ ├── imgui_freetype.cpp │ └── imgui_freetype.h │ └── natvis │ ├── README.txt │ └── imgui.natvis └── main.cpp /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "CWSDK"] 2 | path = CWSDK 3 | url = https://github.com/ChrisMiuchiz/CWSDK.git 4 | -------------------------------------------------------------------------------- /BuildNetwork/BuildNetwork.cpp: -------------------------------------------------------------------------------- 1 | #include "BuildNetwork.h" 2 | #include "../BuildingMod.h" 3 | #include "../ZoneSaver/ZoneSaver.h" 4 | 5 | BuildNetwork::BuildNetwork(BuildingMod* mod) { 6 | this->mod = mod; 7 | this->CSChannel = *(int*)"BLK0"; 8 | this->SCChannel = *(int*)"BLK1"; 9 | UpdatePingTime(); 10 | } 11 | 12 | void BuildNetwork::SendSingleBlockUpdate(CSteamID steamID, LongVector3& position, cube::Block& block, bool toClient) { 13 | int channel = toClient ? SCChannel : CSChannel; 14 | SingleBlockUpdatePacket packet(position, block); 15 | packet.Send(steamID, channel); 16 | } 17 | 18 | void BuildNetwork::SendPing(CSteamID steamID, bool toClient) { 19 | int channel = toClient ? SCChannel : CSChannel; 20 | PingPacket packet; 21 | packet.Send(steamID, channel); 22 | } 23 | 24 | void BuildNetwork::SendZoneLoad(CSteamID steamID, IntVector2 position) { 25 | int channel = CSChannel; 26 | ZoneLoadPacket packet(position); 27 | packet.Send(steamID, channel); 28 | } 29 | 30 | u32 BuildNetwork::GetPingTime() { 31 | return timeGetTime() - lastPing; 32 | } 33 | 34 | void BuildNetwork::UpdatePingTime() { 35 | this->lastPing = timeGetTime(); 36 | } 37 | 38 | void BuildNetwork::Process() { 39 | ProcessCS(); 40 | ProcessSC(); 41 | DoPings(); 42 | } 43 | 44 | void BuildNetwork::DoPings() { 45 | // If you don't periodically send data over a channel, it will be torn down. 46 | // If it is torn down, it will take longer for the next packet to be transmitted. 47 | if (GetPingTime() > 10000) { 48 | cube::Game* game = cube::GetGame(); 49 | for (auto pair : game->host.connections) { 50 | CSteamID id = pair.first; 51 | SendPing(id, true); 52 | } 53 | SendPing(game->client.host_steam_id, false); 54 | UpdatePingTime(); 55 | } 56 | } 57 | 58 | void BuildNetwork::ProcessCS() { 59 | cube::Game* game = cube::GetGame(); 60 | u32 size; 61 | while (cube::SteamNetworking()->IsP2PPacketAvailable(&size, CSChannel)) { 62 | // Receive packet from client 63 | auto buffer = std::unique_ptr(new u8[size]); 64 | u32 receivedSize; 65 | CSteamID steamID; 66 | cube::SteamNetworking()->ReadP2PPacket(buffer.get(), size, &receivedSize, &steamID, CSChannel); 67 | 68 | // Ignore it if they aren't connected to us, fuck you 69 | if (!game->host.connections.count(steamID)) { 70 | continue; 71 | } 72 | BuildNetworkPacket* basePacket = (BuildNetworkPacket*)buffer.get(); 73 | if (size < sizeof(*basePacket)) continue; 74 | 75 | switch (basePacket->id) { 76 | case BuildNetworkPacket::Ping: { 77 | //game->PrintMessage(L"PING\n"); 78 | break; 79 | } 80 | case BuildNetworkPacket::SingleBlockUpdate: { 81 | SingleBlockUpdatePacket* packet = (SingleBlockUpdatePacket*)basePacket; 82 | if (size != sizeof(*packet)) break; 83 | EnterCriticalSection(&game->host.world.zones_critical_section); 84 | EnterCriticalSection(&game->host.world.zones_mesh_critical_section); 85 | game->host.world.SetBlock(packet->position, packet->block, false); 86 | LeaveCriticalSection(&game->host.world.zones_mesh_critical_section); 87 | LeaveCriticalSection(&game->host.world.zones_critical_section); 88 | mod->GetWorldContainer()->SetBlock(packet->position, packet->block.red, packet->block.green, packet->block.blue, packet->block.type); 89 | mod->GetWorldContainer()->OutputFiles(); 90 | // Update all connected clients 91 | for (auto connection : game->host.connections) { 92 | SendSingleBlockUpdate(connection.first, packet->position, packet->block, true); 93 | } 94 | break; 95 | } 96 | case BuildNetworkPacket::ZoneLoad: { 97 | ZoneLoadPacket* packet = (ZoneLoadPacket*)basePacket; 98 | if (size != sizeof(*packet)) break; 99 | std::vector blocks = mod->GetWorldContainer()->LoadZoneBlocks(packet->position.x, packet->position.y); 100 | 101 | ZoneUpdatePacket responsePacket(packet->position); 102 | cube::Block cubeBlock; 103 | cubeBlock.breakable = 0; 104 | cubeBlock.field_3 = 0; 105 | for (auto zoneBlock : blocks) { 106 | cubeBlock.red = zoneBlock->r; 107 | cubeBlock.green = zoneBlock->g; 108 | cubeBlock.blue = zoneBlock->b; 109 | cubeBlock.type = (cube::Block::Type)zoneBlock->type; 110 | responsePacket.entries.push_back(ZoneUpdatePacket::Entry(zoneBlock->x, zoneBlock->y, zoneBlock->z, cubeBlock)); 111 | } 112 | responsePacket.Send(steamID, SCChannel); 113 | 114 | } 115 | } 116 | } 117 | } 118 | 119 | void BuildNetwork::ProcessSC() { 120 | cube::Game* game = cube::GetGame(); 121 | u32 size; 122 | while (cube::SteamNetworking()->IsP2PPacketAvailable(&size, SCChannel)) { 123 | // Receive packet from server 124 | auto buffer = std::unique_ptr(new u8[size]); 125 | u32 receivedSize; 126 | CSteamID steamID; 127 | cube::SteamNetworking()->ReadP2PPacket(buffer.get(), size, &receivedSize, &steamID, SCChannel); 128 | 129 | // If this packet is not from the host we are supposed to be connected to, ignore it. 130 | if (steamID != game->client.host_steam_id) { 131 | continue; 132 | } 133 | 134 | BuildNetworkPacket* basePacket = (BuildNetworkPacket*)buffer.get(); 135 | if (size < sizeof(*basePacket)) continue; 136 | 137 | switch (basePacket->id) { 138 | case BuildNetworkPacket::Ping: 139 | //game->PrintMessage(L"PING\n"); 140 | break; 141 | case BuildNetworkPacket::SingleBlockUpdate: { 142 | SingleBlockUpdatePacket* packet = (SingleBlockUpdatePacket*)basePacket; 143 | if (size != sizeof(*packet)) break; 144 | mod->PlaceSingleBlock(packet->block, packet->position); 145 | break; 146 | } 147 | case BuildNetworkPacket::ZoneUpdate: { 148 | ZoneUpdatePacket packet((u8*)basePacket, size); 149 | std::vector> blocks; 150 | blocks.reserve(packet.entries.size()); 151 | for (ZoneUpdatePacket::Entry& entry : packet.entries) { 152 | LongVector3 position( entry.x + packet.position.x * cube::BLOCKS_PER_ZONE, 153 | entry.y + packet.position.y * cube::BLOCKS_PER_ZONE, 154 | entry.z); 155 | blocks.push_back(std::pair(entry.block, position)); 156 | } 157 | mod->QueueBlocks(blocks); 158 | } 159 | } 160 | } 161 | } 162 | 163 | -------------------------------------------------------------------------------- /BuildNetwork/BuildNetwork.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../CWSDK/cwsdk.h" 4 | #include "BuildNetworkPacket.h" 5 | #include "SingleBlockUpdatePacket.h" 6 | #include "PingPacket.h" 7 | #include "ZoneUpdatePacket.h" 8 | #include "ZoneLoadPacket.h" 9 | 10 | class BuildingMod; 11 | class BuildNetwork { 12 | BuildingMod* mod; 13 | int CSChannel; 14 | int SCChannel; 15 | u32 lastPing; 16 | u32 GetPingTime(); 17 | void UpdatePingTime(); 18 | void DoPings(); 19 | public: 20 | BuildNetwork(BuildingMod* mod); 21 | void SendSingleBlockUpdate(CSteamID steamID, LongVector3& position, cube::Block& block, bool toClient); 22 | void SendPing(CSteamID steamID, bool toClient); 23 | void SendZoneLoad(CSteamID steamID, IntVector2 position); 24 | void Process(); 25 | void ProcessSC(); 26 | void ProcessCS(); 27 | 28 | }; 29 | 30 | -------------------------------------------------------------------------------- /BuildNetwork/BuildNetworkPacket.cpp: -------------------------------------------------------------------------------- 1 | #include "BuildNetworkPacket.h" 2 | -------------------------------------------------------------------------------- /BuildNetwork/BuildNetworkPacket.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../CWSDK/cwsdk.h" 4 | 5 | #pragma pack(push, 1) 6 | class BuildNetworkPacket { 7 | public: 8 | enum PacketType : u8 { 9 | None = 0, 10 | Ping, 11 | ZoneLoad, 12 | SingleBlockUpdate, 13 | ZoneUpdate, 14 | }; 15 | PacketType id; 16 | }; 17 | #pragma pack(pop) -------------------------------------------------------------------------------- /BuildNetwork/PingPacket.cpp: -------------------------------------------------------------------------------- 1 | #include "PingPacket.h" 2 | #include "../CWSDK/cwsdk.h" 3 | 4 | void PingPacket::Send(CSteamID steamID, i32 channel) { 5 | cube::SteamNetworking()->SendP2PPacket(steamID, (const void*)this, sizeof(*this), k_EP2PSendReliable, channel); 6 | } 7 | 8 | PingPacket::PingPacket() { 9 | this->id = Ping; 10 | } -------------------------------------------------------------------------------- /BuildNetwork/PingPacket.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "BuildNetworkPacket.h" 3 | #include "../CWSDK/cwsdk.h" 4 | 5 | #pragma pack(push, 1) 6 | class PingPacket : public BuildNetworkPacket { 7 | public: 8 | void Send(CSteamID steamID, i32 channel); 9 | PingPacket(); 10 | }; 11 | #pragma pack(pop) -------------------------------------------------------------------------------- /BuildNetwork/SingleBlockUpdatePacket.cpp: -------------------------------------------------------------------------------- 1 | #include "SingleBlockUpdatePacket.h" 2 | #include "../CWSDK/cwsdk.h" 3 | 4 | void SingleBlockUpdatePacket::Send(CSteamID steamID, i32 channel) { 5 | cube::SteamNetworking()->SendP2PPacket(steamID, (const void*)this, sizeof(*this), k_EP2PSendReliable, channel); 6 | } 7 | 8 | SingleBlockUpdatePacket::SingleBlockUpdatePacket(LongVector3& position, cube::Block& block) { 9 | this->id = SingleBlockUpdate; 10 | this->position = position; 11 | this->block = block; 12 | } -------------------------------------------------------------------------------- /BuildNetwork/SingleBlockUpdatePacket.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "BuildNetworkPacket.h" 3 | #include "../CWSDK/cwsdk.h" 4 | 5 | #pragma pack(push, 1) 6 | class SingleBlockUpdatePacket : public BuildNetworkPacket { 7 | public: 8 | LongVector3 position; 9 | cube::Block block; 10 | 11 | void Send(CSteamID steamID, i32 channel); 12 | SingleBlockUpdatePacket(LongVector3& position, cube::Block& block); 13 | 14 | }; 15 | #pragma pack(pop) -------------------------------------------------------------------------------- /BuildNetwork/ZoneLoadPacket.cpp: -------------------------------------------------------------------------------- 1 | #include "ZoneLoadPacket.h" 2 | #include "../CWSDK/cwsdk.h" 3 | 4 | void ZoneLoadPacket::Send(CSteamID steamID, i32 channel) { 5 | cube::SteamNetworking()->SendP2PPacket(steamID, (const void*)this, sizeof(*this), k_EP2PSendReliable, channel); 6 | } 7 | 8 | ZoneLoadPacket::ZoneLoadPacket(IntVector2& position) { 9 | this->id = ZoneLoad; 10 | this->position = position; 11 | } -------------------------------------------------------------------------------- /BuildNetwork/ZoneLoadPacket.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "BuildNetworkPacket.h" 3 | #include "../CWSDK/cwsdk.h" 4 | 5 | #pragma pack(push, 1) 6 | class ZoneLoadPacket : public BuildNetworkPacket { 7 | public: 8 | IntVector2 position; 9 | 10 | void Send(CSteamID steamID, i32 channel); 11 | ZoneLoadPacket(IntVector2& position); 12 | }; 13 | #pragma pack(pop) -------------------------------------------------------------------------------- /BuildNetwork/ZoneUpdatePacket.cpp: -------------------------------------------------------------------------------- 1 | #include "ZoneUpdatePacket.h" 2 | #include "../CWSDK/cwsdk.h" 3 | 4 | void ZoneUpdatePacket::Send(CSteamID steamID, i32 channel) { 5 | BytesIO bytesio; 6 | bytesio.Write(this->id); 7 | bytesio.Write(this->position); 8 | bytesio.Write(entries.size()); 9 | for (Entry& entry : entries) { 10 | bytesio.Write(entry); 11 | } 12 | 13 | const void* buffer = (const void*)bytesio.Data(); 14 | i32 size = bytesio.Size(); 15 | cube::SteamNetworking()->SendP2PPacket(steamID, buffer, size, k_EP2PSendReliable, channel); 16 | } 17 | 18 | ZoneUpdatePacket::ZoneUpdatePacket(IntVector2& position) { 19 | this->id = ZoneUpdate; 20 | this->position = position; 21 | } 22 | 23 | ZoneUpdatePacket::ZoneUpdatePacket(u8* buffer, u32 size) { 24 | BytesIO bytesio(buffer, size); 25 | this->id = bytesio.Read(); 26 | this->position = bytesio.Read(); 27 | u32 count = bytesio.Read(); 28 | this->entries.clear(); 29 | this->entries.reserve(count); 30 | for (int i = 0; i < count; i++) { 31 | this->entries.push_back(bytesio.Read()); 32 | } 33 | } 34 | 35 | ZoneUpdatePacket::Entry::Entry(u8 x, u8 y, i32 z, cube::Block& block) { 36 | this->x = x; 37 | this->y = y; 38 | this->z = z; 39 | this->block = block; 40 | } -------------------------------------------------------------------------------- /BuildNetwork/ZoneUpdatePacket.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "BuildNetworkPacket.h" 3 | #include "../CWSDK/cwsdk.h" 4 | 5 | #pragma pack(push, 1) 6 | class ZoneUpdatePacket : public BuildNetworkPacket { 7 | public: 8 | class Entry { 9 | public: 10 | u8 x, y; 11 | i32 z; 12 | cube::Block block; 13 | Entry(u8 x, u8 y, i32 z, cube::Block& block); 14 | }; 15 | IntVector2 position; 16 | std::vector entries; 17 | 18 | void Send(CSteamID steamID, i32 channel); 19 | ZoneUpdatePacket(IntVector2& position); 20 | ZoneUpdatePacket(u8* buffer, u32 size); 21 | 22 | }; 23 | #pragma pack(pop) -------------------------------------------------------------------------------- /BuildWindow.h: -------------------------------------------------------------------------------- 1 | #ifndef BUILDWINDOW_H 2 | #define BUILDWINDOW_H 3 | 4 | #include "CWSDK/cwsdk.h" 5 | #include "imgui-1.73/imgui.h" 6 | #include "imgui-1.73/examples/imgui_impl_dx11.h" 7 | #include "imgui-1.73/examples/imgui_impl_win32.h" 8 | 9 | 10 | class BuildingMod; 11 | class BuildWindow { 12 | bool buildModeEnabled = false; 13 | 14 | bool waterBlock = false; 15 | bool wetBlock = false; 16 | bool lavaBlock = false; 17 | bool poisonBlock = false; 18 | bool underwater = false; 19 | 20 | bool wantMouse = false; 21 | bool wantKeyboard = false; 22 | bool initialized = false; 23 | bool awaitingKeyRemap = false; 24 | bool keyRemapComplete = false; 25 | 26 | cube::Game* game; 27 | BuildingMod* mod; 28 | public: 29 | BuildWindow(BuildingMod* mod); 30 | void Present(); 31 | bool Initialize(); 32 | void Update(); 33 | int WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 34 | void SetBuildMode(bool mode); 35 | void OnGetMouseState(DIMOUSESTATE* diMouse); 36 | void OnGetKeyboardState(BYTE* diKeys); 37 | void UpdateBlockState(cube::Block block); 38 | void DeselectSpecialTypesExcept(bool& option); 39 | bool IsSpecialTypeSelected(); 40 | 41 | }; 42 | 43 | #endif // BUILDWINDOW_H -------------------------------------------------------------------------------- /BuildingMod.h: -------------------------------------------------------------------------------- 1 | #ifndef BUILDINGMOD_H 2 | #define BUILDINGMOD_H 3 | #include "CWSDK/cwsdk.h" 4 | #include "DButton.h" 5 | #include "BuildWindow.h" 6 | #include "ChunkUpdate.h" 7 | #include 8 | #include 9 | #include 10 | #include "ZoneSaver/ZoneSaver.h" 11 | 12 | class BuildNetwork; 13 | class BuildingMod : GenericMod { 14 | private: 15 | DButton buildButton = DButton(DIK_GRAVE); 16 | SYSTEMTIME lastPlacementTime; 17 | SYSTEMTIME lastBreakTime; 18 | SYSTEMTIME lastPickTime; 19 | bool buildMode = false; 20 | cube::Game* game; 21 | f32 reachRange = 40.0; 22 | cube::Block currentBlock; 23 | bool buildUnderwater = false; 24 | CSteamID oldHostSteamID; 25 | BuildWindow* buildWindow; 26 | BuildNetwork* buildNetwork; 27 | std::list chunkUpdates; 28 | std::mutex chunkUpdatesMtx; 29 | 30 | ZoneSaver::WorldContainer worldContainer; 31 | 32 | public: 33 | bool InBuildMode(); 34 | void ToggleBuildMode(); 35 | cube::Block GetCurrentBlock(); 36 | void SelectBlock(cube::Block block, bool verbose = true); 37 | void SetBlockColor(cube::Block block, bool verbose = true); 38 | bool CanBuildUnderwater(); 39 | void ToggleUnderwaterBuilding(); 40 | void QueueBlock(cube::Block& block, LongVector3& position); 41 | void PlaceSingleBlock(cube::Block& block, LongVector3& position); 42 | void QueueBlocks(std::vector> blocks); 43 | ZoneSaver::WorldContainer* GetWorldContainer(); 44 | void PlayGUISelectNoise(); 45 | DButton* GetBuildButton(); 46 | void LoadButtonConfig(); 47 | void SaveButtonConfig(); 48 | 49 | private: 50 | void PrintMessagePrefix(); 51 | bool ReadyToBreak(); 52 | void BreakAction(); 53 | bool ReadyToPlace(); 54 | void PlaceAction(); 55 | bool ReadyToPick(); 56 | void PickAction(); 57 | bool InOtherGUI(); 58 | void PrintBlockInfo(); 59 | void ReloadZonesIfNeeded(); 60 | 61 | // Event handlers 62 | virtual void Initialize() override; 63 | virtual void OnGameTick(cube::Game* game) override; 64 | virtual void OnGetKeyboardState(BYTE* diKeys) override; 65 | virtual void OnGetMouseState(DIMOUSESTATE* diMouse) override; 66 | virtual void OnPresent(IDXGISwapChain* SwapChain, UINT SyncInterval, UINT Flags) override; 67 | virtual int OnWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) override; 68 | virtual int OnChat(std::wstring* msg) override; 69 | virtual void OnZoneGenerated(cube::Zone* zone) override; 70 | virtual void OnChunkRemesh(cube::Zone* zone) override; 71 | }; 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.8) 2 | project(project_BuildingMod) 3 | add_subdirectory(CWSDK) 4 | add_subdirectory(imgui-1.73) 5 | add_library (BuildingMod SHARED 6 | "main.cpp" 7 | "BuildingMod.cpp" 8 | "BuildWindow.cpp" 9 | "ChunkUpdate.cpp" 10 | "DButton.cpp" 11 | "BuildNetwork/BuildNetwork.cpp" 12 | "BuildNetwork/BuildNetworkPacket.cpp" 13 | "BuildNetwork/SingleBlockUpdatePacket.cpp" 14 | "BuildNetwork/ZoneUpdatePacket.cpp" 15 | "BuildNetwork/ZoneLoadPacket.cpp" 16 | "BuildNetwork/PingPacket.cpp" 17 | "ZoneSaver/ZoneBlock.cpp" 18 | "ZoneSaver/ZoneContainer.cpp" 19 | "ZoneSaver/WorldContainer.cpp" 20 | "ZoneSaver/ZoneSaver.cpp" 21 | ) 22 | target_link_libraries (BuildingMod LINK_PUBLIC CWSDK) 23 | target_link_libraries (BuildingMod LINK_PUBLIC IMGUI) -------------------------------------------------------------------------------- /CMakeSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "x64-Debug", 5 | "generator": "Ninja", 6 | "configurationType": "Debug", 7 | "inheritEnvironments": [ "msvc_x64_x64" ], 8 | "buildRoot": "${projectDir}\\out\\build\\${name}", 9 | "installRoot": "${projectDir}\\out\\install\\${name}", 10 | "cmakeCommandArgs": "", 11 | "buildCommandArgs": "-v", 12 | "ctestCommandArgs": "", 13 | "variables": [] 14 | }, 15 | { 16 | "name": "x64-Clang-Release", 17 | "generator": "Ninja", 18 | "configurationType": "RelWithDebInfo", 19 | "buildRoot": "${projectDir}\\out\\build\\${name}", 20 | "installRoot": "${projectDir}\\out\\install\\${name}", 21 | "cmakeCommandArgs": "", 22 | "buildCommandArgs": "-v", 23 | "ctestCommandArgs": "", 24 | "inheritEnvironments": [ "clang_cl_x64" ], 25 | "variables": [] 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /ChunkUpdate.cpp: -------------------------------------------------------------------------------- 1 | #include "ChunkUpdate.h" 2 | 3 | ChunkUpdate::ChunkUpdate(cube::Block block, LongVector3 position) { 4 | this->block = block; 5 | this->position = position; 6 | } -------------------------------------------------------------------------------- /ChunkUpdate.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "CWSDK/cwsdk.h" 3 | class ChunkUpdate { 4 | public: 5 | cube::Block block; 6 | LongVector3 position; 7 | ChunkUpdate(cube::Block block, LongVector3 position); 8 | }; 9 | -------------------------------------------------------------------------------- /DButton.cpp: -------------------------------------------------------------------------------- 1 | #include "DButton.h" 2 | 3 | DButton::DButton(int diKey) { 4 | oldState = 0; 5 | currentState = 0; 6 | SetKey(diKey); 7 | } 8 | 9 | void DButton::Update(BYTE* diKeys) { 10 | oldState = currentState; 11 | currentState = diKeys[diKey]; 12 | } 13 | 14 | bool DButton::Pressed() { 15 | return ((oldState & 0x80) == 0) && ((currentState & 0x80) != 0); 16 | } 17 | 18 | void DButton::SetKey(int dikey) { 19 | this->diKey = dikey; 20 | } 21 | 22 | const char* DButton::GetKeyName() { 23 | static const char* keys[] = { 24 | "KEY 0x00", 25 | "ESC", 26 | "1", 27 | "2", 28 | "3", 29 | "4", 30 | "5", 31 | "6", 32 | "7", 33 | "8", 34 | "9", 35 | "0", 36 | "-", 37 | "=", 38 | "BACK", 39 | "TAB", 40 | "Q", 41 | "W", 42 | "E", 43 | "R", 44 | "T", 45 | "Y", 46 | "U", 47 | "I", 48 | "O", 49 | "P", 50 | "[", 51 | "]", 52 | "RETURN", 53 | "LCTRL", 54 | "A", 55 | "S", 56 | "D", 57 | "F", 58 | "G", 59 | "H", 60 | "J", 61 | "K", 62 | "L", 63 | ";", 64 | "'", 65 | "`", 66 | "LSHIFT", 67 | "\\", 68 | "Z", 69 | "X", 70 | "C", 71 | "V", 72 | "B", 73 | "N", 74 | "M", 75 | ",", 76 | ".", 77 | "/", 78 | "RSHIFT", 79 | "MULTIPLY", 80 | "LMENU", 81 | "SPACE", 82 | "CAPITAL", 83 | "F1", 84 | "F2", 85 | "F3", 86 | "F4", 87 | "F5", 88 | "F6", 89 | "F7", 90 | "F8", 91 | "F9", 92 | "F10", 93 | "NUMLOCK", 94 | "SCROLL", 95 | "NUM7", 96 | "NUM8", 97 | "NUM9", 98 | "SUBTRACT", 99 | "NUM4", 100 | "NUM5", 101 | "NUM6", 102 | "ADD", 103 | "NUM1", 104 | "NUM2", 105 | "NUM3", 106 | "NUM0", 107 | "DECIMAL", 108 | "KEY 0x54", 109 | "KEY 0x55", 110 | "OEM_102", 111 | "F11", 112 | "F12", 113 | "KEY 0x59", 114 | "KEY 0x5A", 115 | "KEY 0x5B", 116 | "KEY 0x5C", 117 | "KEY 0x5D", 118 | "KEY 0x5E", 119 | "KEY 0x5F", 120 | "KEY 0x60", 121 | "KEY 0x61", 122 | "KEY 0x62", 123 | "KEY 0x63", 124 | "F13", 125 | "F14", 126 | "F15", 127 | "KEY 0x67", 128 | "KEY 0x68", 129 | "KEY 0x69", 130 | "KEY 0x6A", 131 | "KEY 0x6B", 132 | "KEY 0x6C", 133 | "KEY 0x6D", 134 | "KEY 0x6E", 135 | "KEY 0x6F", 136 | "KANA", 137 | "KEY 0x71", 138 | "KEY 0x72", 139 | "ABNT_C1", 140 | "KEY 0x74", 141 | "KEY 0x75", 142 | "KEY 0x76", 143 | "KEY 0x77", 144 | "KEY 0x78", 145 | "CONVERT", 146 | "KEY 0x7A", 147 | "NOCONVERT", 148 | "KEY 0x7C", 149 | "YEN", 150 | "ABNT_C2", 151 | "KEY 0x7F", 152 | "KEY 0x80", 153 | "KEY 0x81", 154 | "KEY 0x82", 155 | "KEY 0x83", 156 | "KEY 0x84", 157 | "KEY 0x85", 158 | "KEY 0x86", 159 | "KEY 0x87", 160 | "KEY 0x88", 161 | "KEY 0x89", 162 | "KEY 0x8A", 163 | "KEY 0x8B", 164 | "KEY 0x8C", 165 | "NUMEQUALS", 166 | "KEY 0x8E", 167 | "KEY 0x8F", 168 | "PREVTRACK", 169 | "AT", 170 | ":", 171 | "UNDERLINE", 172 | "KANJI", 173 | "STOP", 174 | "AX", 175 | "UNLABELED", 176 | "KEY 0x98", 177 | "NEXTTRACK", 178 | "KEY 0x9A", 179 | "KEY 0x9B", 180 | "NUMPADENTER", 181 | "RCTRL", 182 | "KEY 0x9E", 183 | "KEY 0x9F", 184 | "MUTE", 185 | "CALCULATOR", 186 | "PLAYPAUSE", 187 | "KEY 0xA3", 188 | "MEDIASTOP", 189 | "KEY 0xA5", 190 | "KEY 0xA6", 191 | "KEY 0xA7", 192 | "KEY 0xA8", 193 | "KEY 0xA9", 194 | "KEY 0xAA", 195 | "KEY 0xAB", 196 | "KEY 0xAC", 197 | "KEY 0xAD", 198 | "VOLDOWN", 199 | "KEY 0xAF", 200 | "VOLUP", 201 | "KEY 0xB1", 202 | "WEBHOME", 203 | "NUM,", 204 | "KEY 0xB4", 205 | "DIVIDE", 206 | "KEY 0xB6", 207 | "SYSRQ", 208 | "RMENU", 209 | "KEY 0xB9", 210 | "KEY 0xBA", 211 | "KEY 0xBB", 212 | "KEY 0xBC", 213 | "KEY 0xBD", 214 | "KEY 0xBE", 215 | "KEY 0xBF", 216 | "KEY 0xC0", 217 | "KEY 0xC1", 218 | "KEY 0xC2", 219 | "KEY 0xC3", 220 | "KEY 0xC4", 221 | "PAUSE", 222 | "KEY 0xC6", 223 | "HOME", 224 | "UP", 225 | "PRIOR", 226 | "KEY 0xCA", 227 | "LEFT", 228 | "KEY 0xCC", 229 | "RIGHT", 230 | "KEY 0xCE", 231 | "END", 232 | "DOWN", 233 | "NEXT", 234 | "INSERT", 235 | "DELETE", 236 | "KEY 0xD4", 237 | "KEY 0xD5", 238 | "KEY 0xD6", 239 | "KEY 0xD7", 240 | "KEY 0xD8", 241 | "KEY 0xD9", 242 | "KEY 0xDA", 243 | "LWIN", 244 | "RWIN", 245 | "APPS", 246 | "POWER", 247 | "SLEEP", 248 | "KEY 0xE0", 249 | "KEY 0xE1", 250 | "KEY 0xE2", 251 | "WAKE", 252 | "KEY 0xE4", 253 | "WEBSEARCH", 254 | "WEBFAVORITES", 255 | "WEBREFRESH", 256 | "WEBSTOP", 257 | "WEBFORWARD", 258 | "WEBBACK", 259 | "MYCOMPUTER", 260 | "MAIL", 261 | "MEDIASELECT", 262 | "KEY 0xEE", 263 | "KEY 0xEF", 264 | "KEY 0xF0", 265 | "KEY 0xF1", 266 | "KEY 0xF2", 267 | "KEY 0xF3", 268 | "KEY 0xF4", 269 | "KEY 0xF5", 270 | "KEY 0xF6", 271 | "KEY 0xF7", 272 | "KEY 0xF8", 273 | "KEY 0xF9", 274 | "KEY 0xFA", 275 | "KEY 0xFB", 276 | "KEY 0xFC", 277 | "KEY 0xFD", 278 | "KEY 0xFE", 279 | "KEY 0xFF"}; 280 | return keys[diKey]; 281 | } -------------------------------------------------------------------------------- /DButton.h: -------------------------------------------------------------------------------- 1 | #ifndef DBUTTON_H 2 | #define DBUTTON_H 3 | #include "CWSDK/cwsdk.h" 4 | 5 | class DButton { 6 | private: 7 | BYTE oldState; 8 | BYTE currentState; 9 | 10 | public: 11 | int diKey; 12 | DButton(int diKey); 13 | void Update(BYTE* diKeys); 14 | bool Pressed(); 15 | void SetKey(int dikey); 16 | const char* GetKeyName(); 17 | 18 | }; 19 | #endif // DBUTTON_H -------------------------------------------------------------------------------- /GenerateProjectCMake.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | path = os.path.dirname(os.path.realpath(__file__)) 4 | _, folderName = os.path.split(path) 5 | 6 | lines = [ 7 | 'cmake_minimum_required (VERSION 3.8)', 8 | 'project(project_%s)' % folderName, 9 | 10 | 'add_subdirectory(CWSDK)', 11 | 12 | 'add_library (%s SHARED "main.cpp")' % folderName, 13 | 14 | 'target_link_libraries (%s LINK_PUBLIC CWSDK)' % folderName, 15 | 16 | ] 17 | 18 | with open(os.path.join(path, 'CMakeLists.txt'), 'w') as f: 19 | f.write('\n'.join(lines)) 20 | -------------------------------------------------------------------------------- /README-imagery/GUI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coremaze/Cube-World-Building-Mod/3515d8d1a564f754b3763edb13b2295581988206/README-imagery/GUI.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Cube-World-Building-Mod 2 | 3 | For use with the Cube World Mod Launcher: https://github.com/ChrisMiuchiz/Cube-World-Mod-Launcher 4 | 5 | ## Controls 6 | Left Click - Break block. 7 | 8 | Right Click - Place block. 9 | 10 | Middle Click - Copy block from environment. This is the primary method of switching blocks. 11 | 12 | ## Screenshots 13 | 14 | ![Building Mod GUI](README-imagery/GUI.png?raw=true) 15 | 16 | ![Building Mod](https://puu.sh/BSrwg/7c1c3aa890.jpg) 17 | -------------------------------------------------------------------------------- /ZoneSaver/WorldContainer.cpp: -------------------------------------------------------------------------------- 1 | #include "ZoneSaver.h" 2 | 3 | ZoneSaver::ZoneContainer* ZoneSaver::WorldContainer::SetBlock(LongVector3& position, u8 r, u8 g, u8 b, u8 type) { 4 | 5 | u8 x = pymod(position.x, cube::BLOCKS_PER_ZONE); 6 | u8 y = pymod(position.y, cube::BLOCKS_PER_ZONE); 7 | i32 z = position.z; 8 | 9 | IntVector2 zonePos(pydiv(position.x, cube::BLOCKS_PER_ZONE), pydiv(position.y, cube::BLOCKS_PER_ZONE)); 10 | 11 | //check to see if there is already a zone for this block 12 | for (ZoneContainer* zc : zones) { 13 | if ((zc->zone_x == zonePos.x) && (zc->zone_y == zonePos.y)) { 14 | zc->SetZoneBlock(x, y, z, r, g, b, type); 15 | return zc; 16 | } 17 | } 18 | 19 | //No zone created yet 20 | ZoneContainer* zc = new ZoneContainer(zonePos.x, zonePos.y); 21 | zc->SetZoneBlock(x, y, z, r, g, b, type); 22 | this->zones.push_back(zc); 23 | return zc; 24 | } 25 | 26 | void ZoneSaver::WorldContainer::OutputFiles() { 27 | for (ZoneContainer* zc : zones) { 28 | zc->OutputFile(); 29 | } 30 | } 31 | 32 | std::vector ZoneSaver::WorldContainer::LoadZoneBlocks(i32 zone_x, i32 zone_y) { 33 | char* blocks; 34 | std::streampos fsize; 35 | std::vector emptyBlocks; 36 | 37 | //First, check to see if the zone is already in memory. 38 | for (ZoneContainer* zc : zones) { 39 | if ((zc->zone_x == zone_x) && (zc->zone_y == zone_y)) { 40 | return zc->blocks; 41 | } 42 | } 43 | 44 | //If not, look for the zone file, and try to make the zone from that. 45 | char fileName[256] = { 0 }; 46 | const char* folderName = GetFolderName(); 47 | 48 | //Ensure this directory is made 49 | CreateDirectory(folderName, NULL); 50 | 51 | //File for this Zone 52 | ZoneContainer* zc = nullptr; 53 | sprintf(fileName, "%s\\%d.%d.cwb", folderName, zone_x, zone_y); 54 | std::ifstream file(fileName, std::ios::in | std::ios::binary | std::ios::ate); 55 | if (file.is_open()) { 56 | //File exists, read it 57 | fsize = file.tellg(); 58 | blocks = new char[fsize]; 59 | file.seekg(0, std::ios::beg); 60 | file.read(blocks, fsize); 61 | file.close(); 62 | 63 | //SetBlock for every block found in the save file. 64 | //This also causes a cube::Zone to be created if it is not. 65 | for (int i = 0; i < fsize; i += sizeof(ZoneBlock)) { 66 | ZoneBlock* zoneBlock = (ZoneBlock*)&blocks[i]; 67 | LongVector3 position( zoneBlock->x + zone_x * cube::BLOCKS_PER_ZONE, 68 | zoneBlock->y + zone_y * cube::BLOCKS_PER_ZONE, 69 | zoneBlock->z); 70 | zc = this->SetBlock(position, zoneBlock->r, zoneBlock->g, zoneBlock->b, zoneBlock->type); 71 | } 72 | 73 | delete[] blocks; 74 | 75 | if (zc != nullptr) { 76 | return zc->blocks; 77 | } 78 | else { 79 | //This will only happen if a blocks file was somehow empty. 80 | return emptyBlocks; 81 | } 82 | 83 | 84 | 85 | } 86 | else { 87 | //The zone file does not exist. We don't need to make 88 | //one until the user places a block, so return an empty vector. 89 | return emptyBlocks; 90 | } 91 | } 92 | 93 | //Deletes the first ZoneContainer with the specified coordinate, returns whether it found one to delete. 94 | bool ZoneSaver::WorldContainer::DeleteZoneContainer(unsigned int zone_x, unsigned int zone_y) { 95 | for (ZoneContainer* zone : this->zones) { 96 | if (zone->zone_x == zone_x && zone->zone_y == zone_y) { 97 | std::vector::iterator position = std::find(this->zones.begin(), this->zones.end(), zone); 98 | if (position != this->zones.end()) { 99 | this->zones.erase(position); 100 | delete zone; 101 | return true; 102 | } 103 | 104 | } 105 | } 106 | return false; 107 | } -------------------------------------------------------------------------------- /ZoneSaver/WorldContainer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../CWSDK/cwsdk.h" 3 | #include "ZoneSaver.h" 4 | namespace ZoneSaver { 5 | class WorldContainer { 6 | public: 7 | std::vector zones; 8 | 9 | ZoneContainer* SetBlock(LongVector3& position, unsigned char r, unsigned char g, unsigned char b, unsigned char type); 10 | void OutputFiles(); 11 | std::vector LoadZoneBlocks(i32 zone_x, i32 zone_y); 12 | bool DeleteZoneContainer(unsigned int zone_x, unsigned int zone_y); 13 | }; 14 | } -------------------------------------------------------------------------------- /ZoneSaver/ZoneBlock.cpp: -------------------------------------------------------------------------------- 1 | #include "ZoneBlock.h" 2 | 3 | ZoneSaver::ZoneBlock::ZoneBlock() { 4 | this->x = 0; 5 | this->y = 0; 6 | this->z = 0; 7 | this->r = 0; 8 | this->g = 0; 9 | this->b = 0; 10 | this->type = 0; 11 | } 12 | 13 | ZoneSaver::ZoneBlock::ZoneBlock(u8 x, u8 y, i32 z, u8 r, u8 g, u8 b, u8 type) { 14 | this->x = x; 15 | this->y = y; 16 | this->z = z; 17 | this->r = r; 18 | this->g = g; 19 | this->b = b; 20 | this->type = type; 21 | } 22 | -------------------------------------------------------------------------------- /ZoneSaver/ZoneBlock.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../CWSDK/cwsdk.h" 4 | 5 | #pragma pack(push, 1) 6 | namespace ZoneSaver { 7 | class ZoneBlock { 8 | public: 9 | u8 x, y; 10 | i32 z; 11 | u8 r, g, b, type; 12 | ZoneBlock(); 13 | ZoneBlock(u8 x, u8 y, i32 z, u8 r, u8 g, u8 b, u8 type); 14 | }; 15 | } 16 | #pragma pack(pop) -------------------------------------------------------------------------------- /ZoneSaver/ZoneContainer.cpp: -------------------------------------------------------------------------------- 1 | #include "ZoneSaver.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | ZoneSaver::ZoneContainer::ZoneContainer(i32 zonex, i32 zoney) { 9 | this->zone_x = zonex; 10 | this->zone_y = zoney; 11 | } 12 | 13 | void ZoneSaver::ZoneContainer::SetZoneBlock(u8 x, u8 y, u8 z, u8 r, u8 g, u8 b, u8 type) { 14 | //Update existing block if it exists. 15 | for (ZoneBlock* block : this->blocks) { 16 | if (block->x == x && block->y == y && block->z == z) { 17 | block->r = r; 18 | block->g = g; 19 | block->b = b; 20 | block->type = type; 21 | return; 22 | } 23 | } 24 | 25 | //Add a new block if does not exist 26 | ZoneBlock* block = new ZoneBlock(x, y, z, r, g, b, type); 27 | this->blocks.push_back(block); 28 | } 29 | 30 | void ZoneSaver::ZoneContainer::OutputFile() { 31 | char fileName[256] = { 0 }; 32 | const char* folderName = GetFolderName(); 33 | 34 | CreateDirectory(folderName, NULL); 35 | 36 | //File for this Zone 37 | sprintf(fileName, "%s\\%d.%d.cwb", folderName, this->zone_x, this->zone_y); 38 | std::ofstream file; 39 | file.open(fileName, std::ios::out | std::ios::binary); 40 | 41 | //Write each block to file 42 | for (ZoneBlock* block : this->blocks) { 43 | file.write((char*)block, sizeof(*block)); 44 | } 45 | file.close(); 46 | } -------------------------------------------------------------------------------- /ZoneSaver/ZoneContainer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../CWSDK/cwsdk.h" 4 | 5 | namespace ZoneSaver { 6 | class ZoneContainer { 7 | public: 8 | std::vector blocks; 9 | i32 zone_x, zone_y; 10 | 11 | ZoneContainer(i32 zonex, i32 zoney); 12 | 13 | void SetZoneBlock(u8 x, u8 y, u8 z, u8 r, u8 g, u8 b, u8 type); 14 | 15 | void OutputFile(); 16 | }; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /ZoneSaver/ZoneSaver.cpp: -------------------------------------------------------------------------------- 1 | #include "ZoneSaver.h" 2 | const char* ZoneSaver::GetFolderName() { 3 | return "Mods\\BuildingMod\\saves"; 4 | } -------------------------------------------------------------------------------- /ZoneSaver/ZoneSaver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace ZoneSaver { 4 | const char* GetFolderName(); 5 | } 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "ZoneBlock.h" 14 | #include "ZoneContainer.h" 15 | #include "WorldContainer.h" 16 | 17 | -------------------------------------------------------------------------------- /imgui-1.73/.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Default settings: 7 | # Use 4 spaces as indentation 8 | [*] 9 | indent_style = space 10 | indent_size = 4 11 | insert_final_newline = true 12 | trim_trailing_whitespace = true 13 | 14 | [imstb_*] 15 | indent_size = 3 16 | trim_trailing_whitespace = false 17 | 18 | [Makefile] 19 | indent_style = tab 20 | indent_size = 4 21 | -------------------------------------------------------------------------------- /imgui-1.73/.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | sudo: required 3 | dist: trusty 4 | 5 | os: 6 | - linux 7 | - osx 8 | 9 | compiler: 10 | - gcc 11 | - clang 12 | 13 | before_install: 14 | - if [ $TRAVIS_OS_NAME == linux ]; then 15 | sudo apt-get update -qq; 16 | sudo apt-get install -y --no-install-recommends libxrandr-dev libxi-dev libxxf86vm-dev libsdl2-dev; 17 | wget https://github.com/glfw/glfw/releases/download/3.2.1/glfw-3.2.1.zip; 18 | unzip glfw-3.2.1.zip && cd glfw-3.2.1; 19 | cmake -DBUILD_SHARED_LIBS=true -DGLFW_BUILD_EXAMPLES=false -DGLFW_BUILD_TESTS=false -DGLFW_BUILD_DOCS=false .; 20 | sudo make -j $CPU_NUM install && cd ..; 21 | fi 22 | - if [ $TRAVIS_OS_NAME == osx ]; then 23 | brew update; 24 | brew install glfw3; 25 | brew install sdl2; 26 | fi 27 | 28 | script: 29 | - make -C examples/example_glfw_opengl2 30 | - make -C examples/example_glfw_opengl3 31 | - make -C examples/example_sdl_opengl3 32 | - if [ $TRAVIS_OS_NAME == osx ]; then 33 | xcodebuild -project examples/example_apple_metal/example_apple_metal.xcodeproj -target example_apple_metal_macos; 34 | fi 35 | -------------------------------------------------------------------------------- /imgui-1.73/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.8) 2 | if(NOT CMAKE_CL_64) 3 | message(FATAL_ERROR "CWSDK REQUIRES clang-cl x64 to build. " ) 4 | endif() 5 | if(CMAKE_BUILD_TYPE MATCHES "Debug") 6 | message(FATAL_ERROR "CWSDK cannot be built debug mode due to MSVC binary compatibility issues." ) 7 | endif() 8 | project("IMGUI" VERSION "1.0.0") 9 | add_library (IMGUI 10 | imgui.cpp 11 | imgui_demo.cpp 12 | imgui_draw.cpp 13 | imgui_widgets.cpp 14 | examples/imgui_impl_dx11.cpp 15 | examples/imgui_impl_win32.cpp) 16 | target_include_directories (IMGUI PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) -------------------------------------------------------------------------------- /imgui-1.73/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2019 Omar Cornut 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /imgui-1.73/MakeCWModsCMake.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | import os 3 | 4 | path = os.path.dirname(os.path.realpath(__file__)) 5 | 6 | files = list(Path(path).glob('**/*.cpp')) 7 | 8 | for filename in files: 9 | print(filename) 10 | 11 | 12 | lines = [ 13 | 14 | 'cmake_minimum_required (VERSION 3.8)', 15 | 16 | 'if(NOT CMAKE_CL_64)', 17 | ' message(FATAL_ERROR "CWSDK REQUIRES clang-cl x64 to build. " )', 18 | 'endif()', 19 | 20 | 'if(CMAKE_BUILD_TYPE MATCHES "Debug")', 21 | ' message(FATAL_ERROR "CWSDK cannot be built debug mode due to MSVC binary compatibility issues." )', 22 | 'endif()', 23 | 24 | 'project("IMGUI" VERSION "1.0.0")', 25 | 26 | 'add_library (IMGUI \n %s)' % '\n '.join([str(x)[len(path)+1:].replace('\\', '/') for x in files]), 27 | 28 | 'target_include_directories (IMGUI PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})', 29 | 30 | ] 31 | 32 | with open(os.path.join(path, 'CMakeLists.txt'), 'w') as f: 33 | f.write('\n'.join(lines)) 34 | -------------------------------------------------------------------------------- /imgui-1.73/docs/issue_template.md: -------------------------------------------------------------------------------- 1 | (Click "Preview" to turn any http URL into a clickable link) 2 | 3 | 1. PLEASE CAREFULLY READ: 4 | https://github.com/ocornut/imgui/issues/2261 5 | 6 | 2. IF YOU ARE HAVING AN ISSUE COMPILING/LINKING/RUNNING/LOADING FONTS, please post on the "Getting Started" Discourse forum: 7 | https://discourse.dearimgui.org 8 | 9 | 3. PLEASE MAKE SURE that you have: read the FAQ in imgui.cpp; explored the contents of `ShowDemoWindow()` including the Examples menu; searched among Issues; used your IDE to search for keywords in all sources and text files; and read the link provided in (1). 10 | 11 | 4. Be mindful that messages are being sent to the e-mail box of "Watching" users. Try to proof-read your messages before sending them. Edits are not seen by those users. 12 | 13 | 5. Delete points 1-5 and PLEASE FILL THE TEMPLATE BELOW before submitting your issue. 14 | 15 | Thank you! 16 | 17 | ---- 18 | 19 | _(you may also go to Demo>About Window, and click "Config/Build Information" to obtain a bunch of detailed information that you can paste here)_ 20 | 21 | **Version/Branch of Dear ImGui:** 22 | 23 | Version: XXX 24 | Branch: XXX _(master/viewport/docking/etc.)_ 25 | 26 | **Back-end/Renderer/Compiler/OS** 27 | 28 | Back-ends: imgui_impl_XXX.cpp + imgui_impl_XXX.cpp _(or specify if using a custom engine/back-end)_ 29 | Compiler: XXX _(if the question is related to building or platform specific features)_ 30 | Operating System: XXX 31 | 32 | **My Issue/Question:** 33 | 34 | XXX _(please provide as much context as possible)_ 35 | 36 | **Screenshots/Video** 37 | 38 | XXX _(you can drag files here)_ 39 | 40 | **Standalone, minimal, complete and verifiable example:** _(see https://github.com/ocornut/imgui/issues/2261)_ 41 | ``` 42 | // Please do not forget this! 43 | ImGui::Begin("Example Bug"); 44 | MoreCodeToExplainMyIssue(); 45 | ImGui::End(); 46 | ``` 47 | -------------------------------------------------------------------------------- /imgui-1.73/docs/pull_request_template.md: -------------------------------------------------------------------------------- 1 | (Click "Preview" to turn any http URL into a clickable link) 2 | 3 | PLEASE CAREFULLY READ: 4 | https://github.com/ocornut/imgui/issues/2261 5 | 6 | (Clear this template before submitting your PR) 7 | -------------------------------------------------------------------------------- /imgui-1.73/examples/.gitignore: -------------------------------------------------------------------------------- 1 | build/* 2 | */Debug/* 3 | */Release/* 4 | */x64/* 5 | *.o 6 | *.obj 7 | *.exe 8 | 9 | ## Visual Studio cruft 10 | .vs/* 11 | */ipch/* 12 | *.opensdf 13 | *.log 14 | *.pdb 15 | *.ilk 16 | *.user 17 | *.sdf 18 | *.suo 19 | *.VC.db 20 | *.VC.VC.opendb 21 | 22 | ## Xcode cruft 23 | .DS_Store 24 | project.xcworkspace 25 | xcuserdata 26 | 27 | ## Emscripten output 28 | *.o.tmp 29 | *.out.js 30 | *.out.wasm 31 | example_emscripten/example_emscripten.* 32 | 33 | ## Unix executables 34 | example_glfw_opengl2/example_glfw_opengl2 35 | example_glfw_opengl3/example_glfw_opengl3 36 | example_glut_opengl2/example_glut_opengl2 37 | example_null/example_null 38 | example_sdl_opengl2/example_sdl_opengl2 39 | example_sdl_opengl3/example_sdl_opengl3 40 | 41 | ## Dear ImGui Ini files 42 | imgui.ini 43 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_allegro5/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Configuration 3 | 4 | Dear ImGui outputs 16-bit vertex indices by default. 5 | Allegro doesn't support them natively, so we have two solutions: convert the indices manually in imgui_impl_allegro5.cpp, or compile dear imgui with 32-bit indices. 6 | You can either modify imconfig.h that comes with Dear ImGui (easier), or set a C++ preprocessor option IMGUI_USER_CONFIG to find to a filename. 7 | We are providing `imconfig_allegro5.h` that enables 32-bit indices. 8 | Note that the back-end supports _BOTH_ 16-bit and 32-bit indices, but 32-bit indices will be slightly faster as they won't require a manual conversion. 9 | 10 | # How to Build 11 | 12 | ### On Ubuntu 14.04+ 13 | 14 | ```bash 15 | g++ -DIMGUI_USER_CONFIG=\"examples/example_allegro5/imconfig_allegro5.h\" -I .. -I ../.. main.cpp ../imgui_impl_allegro5.cpp ../../imgui*.cpp -lallegro -lallegro_primitives -o allegro5_example 16 | ``` 17 | 18 | ### On Windows with Visual Studio's CLI 19 | 20 | You may install Allegro using vcpkg: 21 | ``` 22 | git clone https://github.com/Microsoft/vcpkg 23 | cd vcpkg 24 | .\bootstrap-vcpkg.bat 25 | .\vcpkg install allegro5 26 | .\vcpkg integrate install ; optional, automatically register include/libs in Visual Studio 27 | ``` 28 | 29 | Build: 30 | ``` 31 | set ALLEGRODIR=path_to_your_allegro5_folder 32 | cl /Zi /MD /I %ALLEGRODIR%\include /DIMGUI_USER_CONFIG=\"examples/example_allegro5/imconfig_allegro5.h\" /I .. /I ..\.. main.cpp ..\imgui_impl_allegro5.cpp ..\..\imgui*.cpp /link /LIBPATH:%ALLEGRODIR%\lib allegro-5.0.10-monolith-md.lib user32.lib 33 | ``` 34 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_allegro5/example_allegro5.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {20b90ce4-7fcb-4731-b9a0-075f875de82d} 6 | 7 | 8 | {f18ab499-84e1-499f-8eff-9754361e0e52} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | 13 | 14 | imgui 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | sources 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | imgui 33 | 34 | 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | sources 47 | 48 | 49 | 50 | 51 | 52 | sources 53 | 54 | 55 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_allegro5/imconfig_allegro5.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // COMPILE-TIME OPTIONS FOR DEAR IMGUI ALLEGRO 5 EXAMPLE 3 | // See imconfig.h for the full template 4 | // Because Allegro doesn't support 16-bit vertex indices, we enable the compile-time option of imgui to use 32-bit indices 5 | //----------------------------------------------------------------------------- 6 | 7 | #pragma once 8 | 9 | // Use 32-bit vertex indices because Allegro doesn't support 16-bit ones 10 | // This allows us to avoid converting vertices format at runtime 11 | #define ImDrawIdx int 12 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_allegro5/main.cpp: -------------------------------------------------------------------------------- 1 | // dear imgui: standalone example application for Allegro 5 2 | // If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp. 3 | 4 | #include 5 | #include 6 | #include 7 | #include "imgui.h" 8 | #include "imgui_impl_allegro5.h" 9 | 10 | int main(int, char**) 11 | { 12 | // Setup Allegro 13 | al_init(); 14 | al_install_keyboard(); 15 | al_install_mouse(); 16 | al_init_primitives_addon(); 17 | al_set_new_display_flags(ALLEGRO_RESIZABLE); 18 | ALLEGRO_DISPLAY* display = al_create_display(1280, 720); 19 | al_set_window_title(display, "Dear ImGui Allegro 5 example"); 20 | ALLEGRO_EVENT_QUEUE* queue = al_create_event_queue(); 21 | al_register_event_source(queue, al_get_display_event_source(display)); 22 | al_register_event_source(queue, al_get_keyboard_event_source()); 23 | al_register_event_source(queue, al_get_mouse_event_source()); 24 | 25 | // Setup Dear ImGui context 26 | IMGUI_CHECKVERSION(); 27 | ImGui::CreateContext(); 28 | ImGuiIO& io = ImGui::GetIO(); (void)io; 29 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls 30 | 31 | // Setup Dear ImGui style 32 | ImGui::StyleColorsDark(); 33 | //ImGui::StyleColorsClassic(); 34 | 35 | // Setup Platform/Renderer bindings 36 | ImGui_ImplAllegro5_Init(display); 37 | 38 | // Load Fonts 39 | // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. 40 | // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. 41 | // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit). 42 | // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call. 43 | // - Read 'misc/fonts/README.txt' for more instructions and details. 44 | // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! 45 | //io.Fonts->AddFontDefault(); 46 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f); 47 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f); 48 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f); 49 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f); 50 | //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); 51 | //IM_ASSERT(font != NULL); 52 | 53 | bool show_demo_window = true; 54 | bool show_another_window = false; 55 | ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); 56 | 57 | // Main loop 58 | bool running = true; 59 | while (running) 60 | { 61 | // Poll and handle events (inputs, window resize, etc.) 62 | // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. 63 | // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. 64 | // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. 65 | // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. 66 | ALLEGRO_EVENT ev; 67 | while (al_get_next_event(queue, &ev)) 68 | { 69 | ImGui_ImplAllegro5_ProcessEvent(&ev); 70 | if (ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) 71 | running = false; 72 | if (ev.type == ALLEGRO_EVENT_DISPLAY_RESIZE) 73 | { 74 | ImGui_ImplAllegro5_InvalidateDeviceObjects(); 75 | al_acknowledge_resize(display); 76 | ImGui_ImplAllegro5_CreateDeviceObjects(); 77 | } 78 | } 79 | 80 | // Start the Dear ImGui frame 81 | ImGui_ImplAllegro5_NewFrame(); 82 | ImGui::NewFrame(); 83 | 84 | // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!). 85 | if (show_demo_window) 86 | ImGui::ShowDemoWindow(&show_demo_window); 87 | 88 | // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window. 89 | { 90 | static float f = 0.0f; 91 | static int counter = 0; 92 | 93 | ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it. 94 | 95 | ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too) 96 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state 97 | ImGui::Checkbox("Another Window", &show_another_window); 98 | 99 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 100 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 101 | 102 | if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) 103 | counter++; 104 | ImGui::SameLine(); 105 | ImGui::Text("counter = %d", counter); 106 | 107 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 108 | ImGui::End(); 109 | } 110 | 111 | // 3. Show another simple window. 112 | if (show_another_window) 113 | { 114 | ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked) 115 | ImGui::Text("Hello from another window!"); 116 | if (ImGui::Button("Close Me")) 117 | show_another_window = false; 118 | ImGui::End(); 119 | } 120 | 121 | // Rendering 122 | ImGui::Render(); 123 | al_clear_to_color(al_map_rgba_f(clear_color.x, clear_color.y, clear_color.z, clear_color.w)); 124 | ImGui_ImplAllegro5_RenderDrawData(ImGui::GetDrawData()); 125 | al_flip_display(); 126 | } 127 | 128 | // Cleanup 129 | ImGui_ImplAllegro5_Shutdown(); 130 | ImGui::DestroyContext(); 131 | al_destroy_event_queue(queue); 132 | al_destroy_display(display); 133 | 134 | return 0; 135 | } 136 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_apple_metal/README.md: -------------------------------------------------------------------------------- 1 | # iOS / OSX Metal example 2 | 3 | ## Introduction 4 | 5 | This example shows how to integrate Dear ImGui with Metal. It is based on the "cross-platform" game template provided with Xcode as of Xcode 9. 6 | 7 | (NB: you may still want to use GLFW or SDL which will also support Windows, Linux along with OSX.) 8 | 9 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_apple_metal/Shared/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #if TARGET_OS_IPHONE 4 | 5 | #import 6 | 7 | @interface AppDelegate : UIResponder 8 | @property (strong, nonatomic) UIWindow *window; 9 | @end 10 | 11 | #else 12 | 13 | #import 14 | 15 | @interface AppDelegate : NSObject 16 | @end 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_apple_metal/Shared/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | @implementation AppDelegate 4 | 5 | #if TARGET_OS_OSX 6 | - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender { 7 | return YES; 8 | } 9 | #endif 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_apple_metal/Shared/Renderer.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface Renderer : NSObject 4 | 5 | -(nonnull instancetype)initWithView:(nonnull MTKView *)view; 6 | 7 | @end 8 | 9 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_apple_metal/Shared/Renderer.mm: -------------------------------------------------------------------------------- 1 | #import "Renderer.h" 2 | #import 3 | 4 | #include "imgui.h" 5 | #include "imgui_impl_metal.h" 6 | 7 | #if TARGET_OS_OSX 8 | #include "imgui_impl_osx.h" 9 | #endif 10 | 11 | @interface Renderer () 12 | @property (nonatomic, strong) id device; 13 | @property (nonatomic, strong) id commandQueue; 14 | @end 15 | 16 | @implementation Renderer 17 | 18 | -(nonnull instancetype)initWithView:(nonnull MTKView *)view; 19 | { 20 | self = [super init]; 21 | if(self) 22 | { 23 | _device = view.device; 24 | _commandQueue = [_device newCommandQueue]; 25 | 26 | IMGUI_CHECKVERSION(); 27 | ImGui::CreateContext(); 28 | ImGui::StyleColorsDark(); 29 | 30 | ImGui_ImplMetal_Init(_device); 31 | } 32 | 33 | return self; 34 | } 35 | 36 | - (void)drawInMTKView:(MTKView *)view 37 | { 38 | ImGuiIO &io = ImGui::GetIO(); 39 | io.DisplaySize.x = view.bounds.size.width; 40 | io.DisplaySize.y = view.bounds.size.height; 41 | 42 | #if TARGET_OS_OSX 43 | CGFloat framebufferScale = view.window.screen.backingScaleFactor ?: NSScreen.mainScreen.backingScaleFactor; 44 | #else 45 | CGFloat framebufferScale = view.window.screen.scale ?: UIScreen.mainScreen.scale; 46 | #endif 47 | io.DisplayFramebufferScale = ImVec2(framebufferScale, framebufferScale); 48 | 49 | io.DeltaTime = 1 / float(view.preferredFramesPerSecond ?: 60); 50 | 51 | id commandBuffer = [self.commandQueue commandBuffer]; 52 | 53 | static bool show_demo_window = true; 54 | static bool show_another_window = false; 55 | static float clear_color[4] = { 0.28f, 0.36f, 0.5f, 1.0f }; 56 | 57 | MTLRenderPassDescriptor *renderPassDescriptor = view.currentRenderPassDescriptor; 58 | if (renderPassDescriptor != nil) 59 | { 60 | renderPassDescriptor.colorAttachments[0].clearColor = MTLClearColorMake(clear_color[0], clear_color[1], clear_color[2], clear_color[3]); 61 | 62 | // Here, you could do additional rendering work, including other passes as necessary. 63 | 64 | id renderEncoder = [commandBuffer renderCommandEncoderWithDescriptor:renderPassDescriptor]; 65 | [renderEncoder pushDebugGroup:@"ImGui demo"]; 66 | 67 | // Start the Dear ImGui frame 68 | ImGui_ImplMetal_NewFrame(renderPassDescriptor); 69 | #if TARGET_OS_OSX 70 | ImGui_ImplOSX_NewFrame(view); 71 | #endif 72 | ImGui::NewFrame(); 73 | 74 | // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!). 75 | if (show_demo_window) 76 | ImGui::ShowDemoWindow(&show_demo_window); 77 | 78 | // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window. 79 | { 80 | static float f = 0.0f; 81 | static int counter = 0; 82 | 83 | ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it. 84 | 85 | ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too) 86 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state 87 | ImGui::Checkbox("Another Window", &show_another_window); 88 | 89 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 90 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 91 | 92 | if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) 93 | counter++; 94 | ImGui::SameLine(); 95 | ImGui::Text("counter = %d", counter); 96 | 97 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 98 | ImGui::End(); 99 | } 100 | 101 | // 3. Show another simple window. 102 | if (show_another_window) 103 | { 104 | ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked) 105 | ImGui::Text("Hello from another window!"); 106 | if (ImGui::Button("Close Me")) 107 | show_another_window = false; 108 | ImGui::End(); 109 | } 110 | 111 | // Rendering 112 | ImGui::Render(); 113 | ImDrawData *drawData = ImGui::GetDrawData(); 114 | ImGui_ImplMetal_RenderDrawData(drawData, commandBuffer, renderEncoder); 115 | 116 | [renderEncoder popDebugGroup]; 117 | [renderEncoder endEncoding]; 118 | 119 | [commandBuffer presentDrawable:view.currentDrawable]; 120 | } 121 | 122 | [commandBuffer commit]; 123 | } 124 | 125 | - (void)mtkView:(MTKView *)view drawableSizeWillChange:(CGSize)size 126 | { 127 | } 128 | 129 | @end 130 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_apple_metal/Shared/ViewController.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "Renderer.h" 4 | 5 | #if TARGET_OS_IPHONE 6 | 7 | #import 8 | 9 | @interface ViewController : UIViewController 10 | @end 11 | 12 | #else 13 | 14 | #import 15 | 16 | @interface ViewController : NSViewController 17 | @end 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_apple_metal/Shared/ViewController.mm: -------------------------------------------------------------------------------- 1 | #import "ViewController.h" 2 | #import "Renderer.h" 3 | #include "imgui.h" 4 | 5 | #if TARGET_OS_OSX 6 | #include "imgui_impl_osx.h" 7 | #endif 8 | 9 | @interface ViewController () 10 | @property (nonatomic, readonly) MTKView *mtkView; 11 | @property (nonatomic, strong) Renderer *renderer; 12 | @end 13 | 14 | @implementation ViewController 15 | 16 | - (MTKView *)mtkView { 17 | return (MTKView *)self.view; 18 | } 19 | 20 | - (void)viewDidLoad 21 | { 22 | [super viewDidLoad]; 23 | 24 | self.mtkView.device = MTLCreateSystemDefaultDevice(); 25 | 26 | if (!self.mtkView.device) { 27 | NSLog(@"Metal is not supported"); 28 | abort(); 29 | } 30 | 31 | self.renderer = [[Renderer alloc] initWithView:self.mtkView]; 32 | 33 | [self.renderer mtkView:self.mtkView drawableSizeWillChange:self.mtkView.bounds.size]; 34 | 35 | self.mtkView.delegate = self.renderer; 36 | 37 | #if TARGET_OS_OSX 38 | // Add a tracking area in order to receive mouse events whenever the mouse is within the bounds of our view 39 | NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:NSZeroRect 40 | options:NSTrackingMouseMoved | NSTrackingInVisibleRect | NSTrackingActiveAlways 41 | owner:self 42 | userInfo:nil]; 43 | [self.view addTrackingArea:trackingArea]; 44 | 45 | // If we want to receive key events, we either need to be in the responder chain of the key view, 46 | // or else we can install a local monitor. The consequence of this heavy-handed approach is that 47 | // we receive events for all controls, not just Dear ImGui widgets. If we had native controls in our 48 | // window, we'd want to be much more careful than just ingesting the complete event stream, though we 49 | // do make an effort to be good citizens by passing along events when Dear ImGui doesn't want to capture. 50 | NSEventMask eventMask = NSEventMaskKeyDown | NSEventMaskKeyUp | NSEventMaskFlagsChanged | NSEventTypeScrollWheel; 51 | [NSEvent addLocalMonitorForEventsMatchingMask:eventMask handler:^NSEvent * _Nullable(NSEvent *event) { 52 | BOOL wantsCapture = ImGui_ImplOSX_HandleEvent(event, self.view); 53 | if (event.type == NSEventTypeKeyDown && wantsCapture) { 54 | return nil; 55 | } else { 56 | return event; 57 | } 58 | 59 | }]; 60 | 61 | ImGui_ImplOSX_Init(); 62 | #endif 63 | } 64 | 65 | #if TARGET_OS_OSX 66 | 67 | - (void)mouseMoved:(NSEvent *)event { 68 | ImGui_ImplOSX_HandleEvent(event, self.view); 69 | } 70 | 71 | - (void)mouseDown:(NSEvent *)event { 72 | ImGui_ImplOSX_HandleEvent(event, self.view); 73 | } 74 | 75 | - (void)mouseUp:(NSEvent *)event { 76 | ImGui_ImplOSX_HandleEvent(event, self.view); 77 | } 78 | 79 | - (void)mouseDragged:(NSEvent *)event { 80 | ImGui_ImplOSX_HandleEvent(event, self.view); 81 | } 82 | 83 | - (void)scrollWheel:(NSEvent *)event { 84 | ImGui_ImplOSX_HandleEvent(event, self.view); 85 | } 86 | 87 | #elif TARGET_OS_IOS 88 | 89 | // This touch mapping is super cheesy/hacky. We treat any touch on the screen 90 | // as if it were a depressed left mouse button, and we don't bother handling 91 | // multitouch correctly at all. This causes the "cursor" to behave very erratically 92 | // when there are multiple active touches. But for demo purposes, single-touch 93 | // interaction actually works surprisingly well. 94 | - (void)updateIOWithTouchEvent:(UIEvent *)event { 95 | UITouch *anyTouch = event.allTouches.anyObject; 96 | CGPoint touchLocation = [anyTouch locationInView:self.view]; 97 | ImGuiIO &io = ImGui::GetIO(); 98 | io.MousePos = ImVec2(touchLocation.x, touchLocation.y); 99 | 100 | BOOL hasActiveTouch = NO; 101 | for (UITouch *touch in event.allTouches) { 102 | if (touch.phase != UITouchPhaseEnded && touch.phase != UITouchPhaseCancelled) { 103 | hasActiveTouch = YES; 104 | break; 105 | } 106 | } 107 | io.MouseDown[0] = hasActiveTouch; 108 | } 109 | 110 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 111 | [self updateIOWithTouchEvent:event]; 112 | } 113 | 114 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { 115 | [self updateIOWithTouchEvent:event]; 116 | } 117 | 118 | - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { 119 | [self updateIOWithTouchEvent:event]; 120 | } 121 | 122 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { 123 | [self updateIOWithTouchEvent:event]; 124 | } 125 | 126 | #endif 127 | 128 | @end 129 | 130 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_apple_metal/Shared/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #if TARGET_OS_IPHONE 4 | 5 | #import 6 | #import "AppDelegate.h" 7 | 8 | int main(int argc, char * argv[]) { 9 | @autoreleasepool { 10 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 11 | } 12 | } 13 | 14 | #else 15 | 16 | #import 17 | 18 | int main(int argc, const char * argv[]) { 19 | return NSApplicationMain(argc, argv); 20 | } 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_apple_metal/iOS/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_apple_metal/iOS/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coremaze/Cube-World-Building-Mod/3515d8d1a564f754b3763edb13b2295581988206/imgui-1.73/examples/example_apple_metal/iOS/Default-568h@2x.png -------------------------------------------------------------------------------- /imgui-1.73/examples/example_apple_metal/iOS/Info-iOS.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | imgui 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | Launch Screen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | metal 31 | 32 | UIRequiresFullScreen 33 | 34 | UIStatusBarHidden 35 | 36 | UISupportedInterfaceOrientations 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | UIInterfaceOrientationPortraitUpsideDown 42 | 43 | UISupportedInterfaceOrientations~ipad 44 | 45 | UIInterfaceOrientationPortrait 46 | UIInterfaceOrientationPortraitUpsideDown 47 | UIInterfaceOrientationLandscapeLeft 48 | UIInterfaceOrientationLandscapeRight 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_apple_metal/iOS/Launch Screen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_apple_metal/macOS/Info-macOS.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | imgui 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | Copyright © 2018 Warren Moore. All rights reserved. 27 | NSMainStoryboardFile 28 | Main 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_emscripten/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile to use with emscripten 3 | # See https://emscripten.org/docs/getting_started/downloads.html 4 | # for installation instructions. This Makefile assumes you have 5 | # loaded emscripten's environment. 6 | # 7 | # Running `make` will produce three files: 8 | # - example_emscripten.html 9 | # - example_emscripten.js 10 | # - example_emscripten.wasm 11 | # 12 | # All three are needed to run the demo. 13 | 14 | CC = emcc 15 | CXX = em++ 16 | 17 | EXE = example_emscripten.html 18 | SOURCES = main.cpp 19 | SOURCES += ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp 20 | SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp 21 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 22 | UNAME_S := $(shell uname -s) 23 | 24 | EMS = -s USE_SDL=2 -s WASM=1 25 | EMS += -s ALLOW_MEMORY_GROWTH=1 -s BINARYEN_TRAP_MODE=clamp 26 | EMS += -s DISABLE_EXCEPTION_CATCHING=1 -s NO_EXIT_RUNTIME=0 27 | EMS += -s ASSERTIONS=1 -s NO_FILESYSTEM=1 28 | #EMS += -s SAFE_HEAP=1 ## Adds overhead 29 | 30 | CPPFLAGS = -I../ -I../../ 31 | #CPPFLAGS += -g 32 | CPPFLAGS += -Wall -Wformat -Os 33 | CPPFLAGS += $(EMS) 34 | LIBS = $(EMS) 35 | LDFLAGS = --shell-file shell_minimal.html 36 | 37 | ##--------------------------------------------------------------------- 38 | ## BUILD RULES 39 | ##--------------------------------------------------------------------- 40 | 41 | %.o:%.cpp 42 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< 43 | 44 | %.o:../%.cpp 45 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< 46 | 47 | %.o:../../%.cpp 48 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< 49 | 50 | %.o:../libs/gl3w/GL/%.c 51 | $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< 52 | 53 | all: $(EXE) 54 | @echo Build complete for $(EXE) 55 | 56 | $(EXE): $(OBJS) 57 | $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) 58 | 59 | clean: 60 | rm -f $(EXE) $(OBJS) *.js *.wasm *.wasm.pre 61 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_emscripten/README.md: -------------------------------------------------------------------------------- 1 | 2 | # How to Build 3 | 4 | - You need to install Emscripten from https://emscripten.org/docs/getting_started/downloads.html, and have the environment variables set, as described in https://emscripten.org/docs/getting_started/downloads.html#installation-instructions 5 | 6 | ``` 7 | em++ -I.. -I../.. main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp -s USE_SDL=2 -s USE_WEBGL2=1 -s WASM=1 -s FULL_ES3=1 -s ALLOW_MEMORY_GROWTH=1 -s BINARYEN_TRAP_MODE=clamp --shell-file shell_minimal.html -o example-emscripten.html 8 | ``` 9 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_emscripten/shell_minimal.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Dear ImGui Emscripten example 7 | 29 | 30 | 31 | 32 | 62 | {{{ SCRIPT }}} 63 | 64 | 65 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_glfw_metal/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # You will need GLFW (http://www.glfw.org): 3 | # brew install glfw 4 | # 5 | 6 | #CXX = g++ 7 | #CXX = clang++ 8 | 9 | EXE = example_glfw_metal 10 | SOURCES = main.mm 11 | SOURCES += ../imgui_impl_glfw.cpp ../imgui_impl_metal.mm 12 | SOURCES += ../../imgui.cpp ../../imgui_widgets.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp 13 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 14 | 15 | LIBS = -framework Metal -framework MetalKit -framework Cocoa -framework IOKit -framework CoreVideo -framework QuartzCore 16 | LIBS += -L/usr/local/lib -lglfw 17 | 18 | CXXFLAGS = -I../ -I../../ -I/usr/local/include 19 | CXXFLAGS += -Wall -Wformat 20 | CFLAGS = $(CXXFLAGS) 21 | 22 | %.o:%.cpp 23 | $(CXX) $(CXXFLAGS) -c -o $@ $< 24 | 25 | %.o:../%.cpp 26 | $(CXX) $(CXXFLAGS) -c -o $@ $< 27 | 28 | %.o:../../%.cpp 29 | $(CXX) $(CXXFLAGS) -c -o $@ $< 30 | 31 | %.o:../%.mm 32 | $(CXX) $(CXXFLAGS) -ObjC++ -fobjc-weak -fobjc-arc -c -o $@ $< 33 | 34 | %.o:%.mm 35 | $(CXX) $(CXXFLAGS) -ObjC++ -fobjc-weak -fobjc-arc -c -o $@ $< 36 | 37 | all: $(EXE) 38 | @echo Build complete 39 | 40 | $(EXE): $(OBJS) 41 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 42 | 43 | clean: 44 | rm -f $(EXE) $(OBJS) 45 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_glfw_opengl2/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Cross Platform Makefile 3 | # Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X 4 | # 5 | # You will need GLFW (http://www.glfw.org): 6 | # Linux: 7 | # apt-get install libglfw-dev 8 | # Mac OS X: 9 | # brew install glfw 10 | # MSYS2: 11 | # pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-glfw 12 | # 13 | 14 | #CXX = g++ 15 | #CXX = clang++ 16 | 17 | EXE = example_glfw_opengl2 18 | SOURCES = main.cpp 19 | SOURCES += ../imgui_impl_glfw.cpp ../imgui_impl_opengl2.cpp 20 | SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp 21 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 22 | UNAME_S := $(shell uname -s) 23 | 24 | CXXFLAGS = -I../ -I../../ 25 | CXXFLAGS += -g -Wall -Wformat 26 | LIBS = 27 | 28 | ##--------------------------------------------------------------------- 29 | ## BUILD FLAGS PER PLATFORM 30 | ##--------------------------------------------------------------------- 31 | 32 | ifeq ($(UNAME_S), Linux) #LINUX 33 | ECHO_MESSAGE = "Linux" 34 | LIBS += -lGL `pkg-config --static --libs glfw3` 35 | 36 | CXXFLAGS += `pkg-config --cflags glfw3` 37 | CFLAGS = $(CXXFLAGS) 38 | endif 39 | 40 | ifeq ($(UNAME_S), Darwin) #APPLE 41 | ECHO_MESSAGE = "Mac OS X" 42 | LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo 43 | LIBS += -L/usr/local/lib -L/opt/local/lib 44 | #LIBS += -lglfw3 45 | LIBS += -lglfw 46 | 47 | CXXFLAGS += -I/usr/local/include -I/opt/local/include 48 | CFLAGS = $(CXXFLAGS) 49 | endif 50 | 51 | ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) 52 | ECHO_MESSAGE = "MinGW" 53 | LIBS += -lglfw3 -lgdi32 -lopengl32 -limm32 54 | 55 | CXXFLAGS += -I../libs/gl3w `pkg-config --cflags glfw3` 56 | CFLAGS = $(CXXFLAGS) 57 | endif 58 | 59 | ##--------------------------------------------------------------------- 60 | ## BUILD RULES 61 | ##--------------------------------------------------------------------- 62 | 63 | %.o:%.cpp 64 | $(CXX) $(CXXFLAGS) -c -o $@ $< 65 | 66 | %.o:../%.cpp 67 | $(CXX) $(CXXFLAGS) -c -o $@ $< 68 | 69 | %.o:../../%.cpp 70 | $(CXX) $(CXXFLAGS) -c -o $@ $< 71 | 72 | all: $(EXE) 73 | @echo Build complete for $(ECHO_MESSAGE) 74 | 75 | $(EXE): $(OBJS) 76 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 77 | 78 | clean: 79 | rm -f $(EXE) $(OBJS) 80 | 81 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_glfw_opengl2/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\glfw\include *.cpp ..\imgui_impl_opengl2.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeDebug/example_glfw_opengl2.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 glfw3.lib opengl32.lib gdi32.lib shell32.lib 4 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {c336cfe3-f0c4-464c-9ef0-a9e17a7ff222} 6 | 7 | 8 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | 13 | 14 | sources 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | imgui 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | imgui 33 | 34 | 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | sources 47 | 48 | 49 | sources 50 | 51 | 52 | 53 | 54 | 55 | sources 56 | 57 | 58 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_glfw_opengl3/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Cross Platform Makefile 3 | # Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X 4 | # 5 | # You will need GLFW (http://www.glfw.org): 6 | # Linux: 7 | # apt-get install libglfw-dev 8 | # Mac OS X: 9 | # brew install glfw 10 | # MSYS2: 11 | # pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-glfw 12 | # 13 | 14 | #CXX = g++ 15 | #CXX = clang++ 16 | 17 | EXE = example_glfw_opengl3 18 | SOURCES = main.cpp 19 | SOURCES += ../imgui_impl_glfw.cpp ../imgui_impl_opengl3.cpp 20 | SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp 21 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 22 | UNAME_S := $(shell uname -s) 23 | 24 | CXXFLAGS = -I../ -I../../ 25 | CXXFLAGS += -g -Wall -Wformat 26 | LIBS = 27 | 28 | ##--------------------------------------------------------------------- 29 | ## OPENGL LOADER 30 | ##--------------------------------------------------------------------- 31 | 32 | ## Using OpenGL loader: gl3w [default] 33 | SOURCES += ../libs/gl3w/GL/gl3w.c 34 | CXXFLAGS += -I../libs/gl3w 35 | 36 | ## Using OpenGL loader: glew 37 | ## (This assumes a system-wide installation) 38 | # CXXFLAGS += -lGLEW -DIMGUI_IMPL_OPENGL_LOADER_GLEW 39 | 40 | ## Using OpenGL loader: glad 41 | # SOURCES += ../libs/glad/src/glad.c 42 | # CXXFLAGS += -I../libs/glad/include -DIMGUI_IMPL_OPENGL_LOADER_GLAD 43 | 44 | ##--------------------------------------------------------------------- 45 | ## BUILD FLAGS PER PLATFORM 46 | ##--------------------------------------------------------------------- 47 | 48 | ifeq ($(UNAME_S), Linux) #LINUX 49 | ECHO_MESSAGE = "Linux" 50 | LIBS += -lGL `pkg-config --static --libs glfw3` 51 | 52 | CXXFLAGS += `pkg-config --cflags glfw3` 53 | CFLAGS = $(CXXFLAGS) 54 | endif 55 | 56 | ifeq ($(UNAME_S), Darwin) #APPLE 57 | ECHO_MESSAGE = "Mac OS X" 58 | LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo 59 | LIBS += -L/usr/local/lib -L/opt/local/lib 60 | #LIBS += -lglfw3 61 | LIBS += -lglfw 62 | 63 | CXXFLAGS += -I/usr/local/include -I/opt/local/include 64 | CFLAGS = $(CXXFLAGS) 65 | endif 66 | 67 | ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) 68 | ECHO_MESSAGE = "MinGW" 69 | LIBS += -lglfw3 -lgdi32 -lopengl32 -limm32 70 | 71 | CXXFLAGS += `pkg-config --cflags glfw3` 72 | CFLAGS = $(CXXFLAGS) 73 | endif 74 | 75 | ##--------------------------------------------------------------------- 76 | ## BUILD RULES 77 | ##--------------------------------------------------------------------- 78 | 79 | %.o:%.cpp 80 | $(CXX) $(CXXFLAGS) -c -o $@ $< 81 | 82 | %.o:../%.cpp 83 | $(CXX) $(CXXFLAGS) -c -o $@ $< 84 | 85 | %.o:../../%.cpp 86 | $(CXX) $(CXXFLAGS) -c -o $@ $< 87 | 88 | %.o:../libs/gl3w/GL/%.c 89 | $(CC) $(CFLAGS) -c -o $@ $< 90 | 91 | %.o:../libs/glad/src/%.c 92 | $(CC) $(CFLAGS) -c -o $@ $< 93 | 94 | all: $(EXE) 95 | @echo Build complete for $(ECHO_MESSAGE) 96 | 97 | $(EXE): $(OBJS) 98 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 99 | 100 | clean: 101 | rm -f $(EXE) $(OBJS) 102 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_glfw_opengl3/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\glfw\include /I ..\libs\gl3w *.cpp ..\imgui_impl_glfw.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_glfw_opengl3.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 glfw3.lib opengl32.lib gdi32.lib shell32.lib 4 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {20b90ce4-7fcb-4731-b9a0-075f875de82d} 6 | 7 | 8 | {f18ab499-84e1-499f-8eff-9754361e0e52} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | {42f99867-3108-43b8-99d0-fabefaf1f2e3} 13 | 14 | 15 | 16 | 17 | sources 18 | 19 | 20 | imgui 21 | 22 | 23 | gl3w 24 | 25 | 26 | imgui 27 | 28 | 29 | imgui 30 | 31 | 32 | sources 33 | 34 | 35 | sources 36 | 37 | 38 | imgui 39 | 40 | 41 | 42 | 43 | imgui 44 | 45 | 46 | imgui 47 | 48 | 49 | gl3w 50 | 51 | 52 | gl3w 53 | 54 | 55 | imgui 56 | 57 | 58 | sources 59 | 60 | 61 | sources 62 | 63 | 64 | 65 | 66 | 67 | sources 68 | 69 | 70 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_glfw_vulkan/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Example usage: 2 | # mkdir build 3 | # cd build 4 | # cmake -g "Visual Studio 14 2015" .. 5 | 6 | cmake_minimum_required(VERSION 2.8) 7 | project(imgui_example_glfw_vulkan C CXX) 8 | 9 | if(NOT CMAKE_BUILD_TYPE) 10 | set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE) 11 | endif() 12 | 13 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVK_PROTOTYPES") 14 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_PROTOTYPES") 15 | 16 | # GLFW 17 | set(GLFW_DIR ../../../glfw) # Set this to point to an up-to-date GLFW repo 18 | option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF) 19 | option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF) 20 | option(GLFW_BUILD_DOCS "Build the GLFW documentation" OFF) 21 | option(GLFW_INSTALL "Generate installation target" OFF) 22 | option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF) 23 | add_subdirectory(${GLFW_DIR} binary_dir EXCLUDE_FROM_ALL) 24 | include_directories(${GLFW_DIR}/include) 25 | 26 | # Dear ImGui 27 | set(IMGUI_DIR ../../) 28 | include_directories(${IMGUI_DIR} ..) 29 | 30 | # Libraries 31 | find_library(VULKAN_LIBRARY 32 | NAMES vulkan vulkan-1) 33 | set(LIBRARIES "glfw;${VULKAN_LIBRARY}") 34 | 35 | # Use vulkan headers from glfw: 36 | include_directories(${GLFW_DIR}/deps) 37 | 38 | file(GLOB sources *.cpp) 39 | 40 | add_executable(example_glfw_vulkan ${sources} ${IMGUI_DIR}/examples/imgui_impl_glfw.cpp ${IMGUI_DIR}/examples/imgui_impl_vulkan.cpp ${IMGUI_DIR}/imgui.cpp ${IMGUI_DIR}/imgui_draw.cpp ${IMGUI_DIR}/imgui_demo.cpp ${IMGUI_DIR}/imgui_widgets.cpp) 41 | target_link_libraries(example_glfw_vulkan ${LIBRARIES}) 42 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_glfw_vulkan/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | 3 | mkdir Debug 4 | cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\glfw\include /I %VULKAN_SDK%\include *.cpp ..\imgui_impl_vulkan.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeDebug/example_glfw_vulkan.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 /libpath:%VULKAN_SDK%\lib32 glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib 5 | 6 | mkdir Release 7 | cl /nologo /Zi /MD /Ox /Oi /I .. /I ..\.. /I ..\libs\glfw\include /I %VULKAN_SDK%\include *.cpp ..\imgui_impl_vulkan.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeRelease/example_glfw_vulkan.exe /FoRelease/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 /libpath:%VULKAN_SDK%\lib32 glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib 8 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_glfw_vulkan/build_win64.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of amd64/vcvars32.bat to setup 64-bit command-line compiler. 2 | 3 | mkdir Debug 4 | cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\glfw\include /I %VULKAN_SDK%\include *.cpp ..\imgui_impl_vulkan.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeDebug/example_glfw_vulkan.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-64 /libpath:%VULKAN_SDK%\lib glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib 5 | 6 | mkdir Release 7 | cl /nologo /Zi /MD /Ox /Oi /I .. /I ..\.. /I ..\libs\glfw\include /I %VULKAN_SDK%\include *.cpp ..\imgui_impl_vulkan.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeRelease/example_glfw_vulkan.exe /FoRelease/ /link /LIBPATH:..\libs\glfw\lib-vc2010-64 /libpath:%VULKAN_SDK%\lib glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib 8 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {20b90ce4-7fcb-4731-b9a0-075f875de82d} 6 | 7 | 8 | {f18ab499-84e1-499f-8eff-9754361e0e52} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | 13 | 14 | imgui 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | sources 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | imgui 33 | 34 | 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | sources 47 | 48 | 49 | sources 50 | 51 | 52 | 53 | 54 | 55 | sources 56 | 57 | 58 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_glfw_vulkan/gen_spv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | glslangValidator -V -x -o glsl_shader.frag.u32 glsl_shader.frag 3 | glslangValidator -V -x -o glsl_shader.vert.u32 glsl_shader.vert 4 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_glfw_vulkan/glsl_shader.frag: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | layout(location = 0) out vec4 fColor; 3 | 4 | layout(set=0, binding=0) uniform sampler2D sTexture; 5 | 6 | layout(location = 0) in struct { 7 | vec4 Color; 8 | vec2 UV; 9 | } In; 10 | 11 | void main() 12 | { 13 | fColor = In.Color * texture(sTexture, In.UV.st); 14 | } 15 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_glfw_vulkan/glsl_shader.vert: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | layout(location = 0) in vec2 aPos; 3 | layout(location = 1) in vec2 aUV; 4 | layout(location = 2) in vec4 aColor; 5 | 6 | layout(push_constant) uniform uPushConstant { 7 | vec2 uScale; 8 | vec2 uTranslate; 9 | } pc; 10 | 11 | out gl_PerVertex { 12 | vec4 gl_Position; 13 | }; 14 | 15 | layout(location = 0) out struct { 16 | vec4 Color; 17 | vec2 UV; 18 | } Out; 19 | 20 | void main() 21 | { 22 | Out.Color = aColor; 23 | Out.UV = aUV; 24 | gl_Position = vec4(aPos * pc.uScale + pc.uTranslate, 0, 1); 25 | } 26 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_glut_opengl2/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Cross Platform Makefile 3 | # Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X 4 | # 5 | # Linux: 6 | # apt-get install freeglut3-dev 7 | # 8 | 9 | #CXX = g++ 10 | #CXX = clang++ 11 | 12 | EXE = example_glut_opengl2 13 | SOURCES = main.cpp 14 | SOURCES += ../imgui_impl_glut.cpp ../imgui_impl_opengl2.cpp 15 | SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp 16 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 17 | UNAME_S := $(shell uname -s) 18 | 19 | CXXFLAGS = -I../ -I../../ 20 | CXXFLAGS += -g -Wall -Wformat 21 | LIBS = 22 | 23 | ##--------------------------------------------------------------------- 24 | ## BUILD FLAGS PER PLATFORM 25 | ##--------------------------------------------------------------------- 26 | 27 | ifeq ($(UNAME_S), Linux) #LINUX 28 | ECHO_MESSAGE = "Linux" 29 | LIBS += -lGL -lglut 30 | CFLAGS = $(CXXFLAGS) 31 | endif 32 | 33 | ifeq ($(UNAME_S), Darwin) #APPLE 34 | ECHO_MESSAGE = "Mac OS X" 35 | LIBS += -framework OpenGL -framework GLUT 36 | LIBS += -L/usr/local/lib -L/opt/local/lib 37 | 38 | CXXFLAGS += -I/usr/local/include -I/opt/local/include 39 | CFLAGS = $(CXXFLAGS) 40 | endif 41 | 42 | ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) 43 | ECHO_MESSAGE = "MinGW" 44 | LIBS += -lgdi32 -lopengl32 -limm32 -lglut 45 | CFLAGS = $(CXXFLAGS) 46 | endif 47 | 48 | ##--------------------------------------------------------------------- 49 | ## BUILD RULES 50 | ##--------------------------------------------------------------------- 51 | 52 | %.o:%.cpp 53 | $(CXX) $(CXXFLAGS) -c -o $@ $< 54 | 55 | %.o:../%.cpp 56 | $(CXX) $(CXXFLAGS) -c -o $@ $< 57 | 58 | %.o:../../%.cpp 59 | $(CXX) $(CXXFLAGS) -c -o $@ $< 60 | 61 | all: $(EXE) 62 | @echo Build complete for $(ECHO_MESSAGE) 63 | 64 | $(EXE): $(OBJS) 65 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 66 | 67 | clean: 68 | rm -f $(EXE) $(OBJS) 69 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_glut_opengl2/example_glut_opengl2.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {c336cfe3-f0c4-464c-9ef0-a9e17a7ff222} 6 | 7 | 8 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | 13 | 14 | sources 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | imgui 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | imgui 33 | 34 | 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | sources 47 | 48 | 49 | sources 50 | 51 | 52 | 53 | 54 | 55 | sources 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_glut_opengl2/main.cpp: -------------------------------------------------------------------------------- 1 | // dear imgui: standalone example application for GLUT/FreeGLUT + OpenGL2, using legacy fixed pipeline 2 | // If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp. 3 | 4 | // !!! GLUT/FreeGLUT IS OBSOLETE SOFTWARE. Using GLUT is not recommended unless you really miss the 90's. !!! 5 | // !!! If someone or something is teaching you GLUT in 2019, you are being abused. Please show some resistance. !!! 6 | // !!! Nowadays, prefer using GLFW or SDL instead! 7 | 8 | #include "imgui.h" 9 | #include "../imgui_impl_glut.h" 10 | #include "../imgui_impl_opengl2.h" 11 | #ifdef __APPLE__ 12 | #include 13 | #else 14 | #include 15 | #endif 16 | 17 | #ifdef _MSC_VER 18 | #pragma warning (disable: 4505) // unreferenced local function has been removed 19 | #endif 20 | 21 | // Our state 22 | static bool show_demo_window = true; 23 | static bool show_another_window = false; 24 | static ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); 25 | 26 | void my_display_code() 27 | { 28 | // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!). 29 | if (show_demo_window) 30 | ImGui::ShowDemoWindow(&show_demo_window); 31 | 32 | // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window. 33 | { 34 | static float f = 0.0f; 35 | static int counter = 0; 36 | 37 | ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it. 38 | 39 | ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too) 40 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state 41 | ImGui::Checkbox("Another Window", &show_another_window); 42 | 43 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 44 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 45 | 46 | if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) 47 | counter++; 48 | ImGui::SameLine(); 49 | ImGui::Text("counter = %d", counter); 50 | 51 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 52 | ImGui::End(); 53 | } 54 | 55 | // 3. Show another simple window. 56 | if (show_another_window) 57 | { 58 | ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked) 59 | ImGui::Text("Hello from another window!"); 60 | if (ImGui::Button("Close Me")) 61 | show_another_window = false; 62 | ImGui::End(); 63 | } 64 | } 65 | 66 | void glut_display_func() 67 | { 68 | // Start the Dear ImGui frame 69 | ImGui_ImplOpenGL2_NewFrame(); 70 | ImGui_ImplGLUT_NewFrame(); 71 | 72 | my_display_code(); 73 | 74 | // Rendering 75 | ImGui::Render(); 76 | ImGuiIO& io = ImGui::GetIO(); 77 | glViewport(0, 0, (GLsizei)io.DisplaySize.x, (GLsizei)io.DisplaySize.y); 78 | glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w); 79 | glClear(GL_COLOR_BUFFER_BIT); 80 | //glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context where shaders may be bound, but prefer using the GL3+ code. 81 | ImGui_ImplOpenGL2_RenderDrawData(ImGui::GetDrawData()); 82 | 83 | glutSwapBuffers(); 84 | glutPostRedisplay(); 85 | } 86 | 87 | // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. 88 | // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. 89 | // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. 90 | // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. 91 | 92 | int main(int argc, char** argv) 93 | { 94 | // Create GLUT window 95 | glutInit(&argc, argv); 96 | #ifdef __FREEGLUT_EXT_H__ 97 | glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS); 98 | #endif 99 | glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE); 100 | glutInitWindowSize(1280, 720); 101 | glutCreateWindow("Dear ImGui GLUT+OpenGL2 Example"); 102 | 103 | // Setup GLUT display function 104 | // We will also call ImGui_ImplGLUT_InstallFuncs() to get all the other functions installed for us, 105 | // otherwise it is possible to install our own functions and call the imgui_impl_glut.h functions ourselves. 106 | glutDisplayFunc(glut_display_func); 107 | 108 | // Setup Dear ImGui context 109 | IMGUI_CHECKVERSION(); 110 | ImGui::CreateContext(); 111 | ImGuiIO& io = ImGui::GetIO(); (void)io; 112 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls 113 | 114 | // Setup Dear ImGui style 115 | ImGui::StyleColorsDark(); 116 | //ImGui::StyleColorsClassic(); 117 | 118 | // Setup Platform/Renderer bindings 119 | ImGui_ImplGLUT_Init(); 120 | ImGui_ImplGLUT_InstallFuncs(); 121 | ImGui_ImplOpenGL2_Init(); 122 | 123 | // Load Fonts 124 | // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. 125 | // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. 126 | // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit). 127 | // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call. 128 | // - Read 'misc/fonts/README.txt' for more instructions and details. 129 | // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! 130 | //io.Fonts->AddFontDefault(); 131 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f); 132 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f); 133 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f); 134 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f); 135 | //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); 136 | //IM_ASSERT(font != NULL); 137 | 138 | glutMainLoop(); 139 | 140 | // Cleanup 141 | ImGui_ImplOpenGL2_Shutdown(); 142 | ImGui_ImplGLUT_Shutdown(); 143 | ImGui::DestroyContext(); 144 | 145 | return 0; 146 | } 147 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_marmalade/data/app.icf: -------------------------------------------------------------------------------- 1 | # This file is for configuration settings for your 2 | # application. 3 | # 4 | # The syntax is similar to windows .ini files ie 5 | # 6 | # [GroupName] 7 | # Setting = Value 8 | # 9 | # Which can be read by your application using 10 | # e.g s3eConfigGetString("GroupName", "Setting", string) 11 | # 12 | # All settings must be documented in .config.txt files. 13 | # New settings specific to this application should be 14 | # documented in app.config.txt 15 | # 16 | # Some conditional operations are also permitted, see the 17 | # S3E documentation for details. 18 | 19 | [S3E] 20 | MemSize=6000000 21 | MemSizeDebug=6000000 22 | DispFixRot=FixedLandscape 23 | 24 | # emulate iphone 5 resolution, change these settings to emulate other display resolution 25 | WinWidth=1136 26 | WinHeight=640 27 | 28 | [GX] 29 | DataCacheSize=131070 30 | 31 | [Util] 32 | #MemoryBreakpoint=1282 33 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_marmalade/main.cpp: -------------------------------------------------------------------------------- 1 | // dear imgui: standalone example application for Marmalade 2 | // If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp. 3 | 4 | // Copyright (C) 2015 by Giovanni Zito 5 | // This file is part of Dear ImGui 6 | 7 | #include "imgui.h" 8 | #include "imgui_impl_marmalade.h" 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | int main(int, char**) 16 | { 17 | IwGxInit(); 18 | 19 | // Setup Dear ImGui context 20 | IMGUI_CHECKVERSION(); 21 | ImGui::CreateContext(); 22 | ImGuiIO& io = ImGui::GetIO(); (void)io; 23 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls 24 | 25 | // Setup Dear ImGui style 26 | ImGui::StyleColorsDark(); 27 | //ImGui::StyleColorsClassic(); 28 | 29 | // Setup Platform/Renderer bindings 30 | ImGui_Marmalade_Init(true); 31 | 32 | // Load Fonts 33 | // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. 34 | // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. 35 | // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit). 36 | // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call. 37 | // - Read 'misc/fonts/README.txt' for more instructions and details. 38 | // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! 39 | //io.Fonts->AddFontDefault(); 40 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f); 41 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f); 42 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f); 43 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f); 44 | //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); 45 | //IM_ASSERT(font != NULL); 46 | 47 | // Our state 48 | bool show_demo_window = true; 49 | bool show_another_window = false; 50 | ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); 51 | 52 | // Main loop 53 | while (true) 54 | { 55 | if (s3eDeviceCheckQuitRequest()) 56 | break; 57 | 58 | // Poll and handle inputs 59 | // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. 60 | // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. 61 | // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. 62 | // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. 63 | s3eKeyboardUpdate(); 64 | s3ePointerUpdate(); 65 | 66 | // Start the Dear ImGui frame 67 | ImGui_Marmalade_NewFrame(); 68 | ImGui::NewFrame(); 69 | 70 | // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!). 71 | if (show_demo_window) 72 | ImGui::ShowDemoWindow(&show_demo_window); 73 | 74 | // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window. 75 | { 76 | static float f = 0.0f; 77 | static int counter = 0; 78 | 79 | ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it. 80 | 81 | ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too) 82 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state 83 | ImGui::Checkbox("Another Window", &show_another_window); 84 | 85 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 86 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 87 | 88 | if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) 89 | counter++; 90 | ImGui::SameLine(); 91 | ImGui::Text("counter = %d", counter); 92 | 93 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 94 | ImGui::End(); 95 | } 96 | 97 | // 3. Show another simple window. 98 | if (show_another_window) 99 | { 100 | ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked) 101 | ImGui::Text("Hello from another window!"); 102 | if (ImGui::Button("Close Me")) 103 | show_another_window = false; 104 | ImGui::End(); 105 | } 106 | 107 | // Rendering 108 | ImGui::Render(); 109 | IwGxSetColClear(clear_color.x * 255, clear_color.y * 255, clear_color.z * 255, clear_color.w * 255); 110 | IwGxClear(); 111 | ImGui_Marmalade_RenderDrawData(ImGui::GetDrawData()); 112 | IwGxSwapBuffers(); 113 | 114 | s3eDeviceYield(0); 115 | } 116 | 117 | // Cleanup 118 | ImGui_Marmalade_Shutdown(); 119 | ImGui::DestroyContext(); 120 | IwGxTerminate(); 121 | 122 | return 0; 123 | } 124 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_marmalade/marmalade_example.mkb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env mkb 2 | 3 | # ImGui - standalone example application for Marmalade 4 | # Copyright (C) 2015 by Giovanni Zito 5 | # This file is part of ImGui 6 | # https://github.com/ocornut/imgui 7 | 8 | define IMGUI_DISABLE_INCLUDE_IMCONFIG_H 9 | define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS 10 | define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS 11 | define _snprintf=snprintf 12 | 13 | options 14 | { 15 | optimise-speed=1 16 | } 17 | 18 | includepaths 19 | { 20 | .. 21 | ../.. 22 | } 23 | 24 | subprojects 25 | { 26 | iwgx 27 | } 28 | 29 | files 30 | { 31 | (.) 32 | ["imgui"] 33 | ../../imgui.cpp 34 | ../../imgui_demo.cpp 35 | ../../imgui_draw.cpp 36 | ../../imgui_widgets.cpp 37 | ../../imconfig.h 38 | ../../imgui.h 39 | ../../imgui_internal.h 40 | 41 | ["imgui","Marmalade binding"] 42 | ../imgui_impl_marmalade.h 43 | ../imgui_impl_marmalade.cpp 44 | main.cpp 45 | 46 | } 47 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_null/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Cross Platform Makefile 3 | # Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X 4 | # 5 | 6 | EXE = example_null 7 | SOURCES = main.cpp 8 | SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp 9 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 10 | UNAME_S := $(shell uname -s) 11 | 12 | CXXFLAGS = -I../ -I../../ 13 | CXXFLAGS += -g -Wall -Wformat 14 | LIBS = 15 | 16 | ##--------------------------------------------------------------------- 17 | ## BUILD FLAGS PER PLATFORM 18 | ##--------------------------------------------------------------------- 19 | 20 | ifeq ($(UNAME_S), Linux) #LINUX 21 | ECHO_MESSAGE = "Linux" 22 | CFLAGS = $(CXXFLAGS) 23 | endif 24 | 25 | ifeq ($(UNAME_S), Darwin) #APPLE 26 | ECHO_MESSAGE = "Mac OS X" 27 | CFLAGS = $(CXXFLAGS) 28 | endif 29 | 30 | ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) 31 | ECHO_MESSAGE = "MinGW" 32 | CFLAGS = $(CXXFLAGS) 33 | endif 34 | 35 | ##--------------------------------------------------------------------- 36 | ## BUILD RULES 37 | ##--------------------------------------------------------------------- 38 | 39 | %.o:%.cpp 40 | $(CXX) $(CXXFLAGS) -c -o $@ $< 41 | 42 | %.o:../%.cpp 43 | $(CXX) $(CXXFLAGS) -c -o $@ $< 44 | 45 | %.o:../../%.cpp 46 | $(CXX) $(CXXFLAGS) -c -o $@ $< 47 | 48 | %.o:../libs/gl3w/GL/%.c 49 | # %.o:../libs/glad/src/%.c 50 | $(CC) $(CFLAGS) -c -o $@ $< 51 | 52 | all: $(EXE) 53 | @echo Build complete for $(ECHO_MESSAGE) 54 | 55 | $(EXE): $(OBJS) 56 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 57 | 58 | clean: 59 | rm -f $(EXE) $(OBJS) 60 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_null/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I ..\.. *.cpp ..\..\*.cpp /FeDebug/example_null.exe /FoDebug/ /link gdi32.lib shell32.lib 4 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_null/main.cpp: -------------------------------------------------------------------------------- 1 | // dear imgui: null/dummy example application 2 | // (compile and link imgui, create context, run headless with NO INPUTS, NO GRAPHICS OUTPUT) 3 | // This is useful to test building, but you cannot interact with anything here! 4 | #include "imgui.h" 5 | #include 6 | 7 | int main(int, char**) 8 | { 9 | IMGUI_CHECKVERSION(); 10 | ImGui::CreateContext(); 11 | ImGuiIO& io = ImGui::GetIO(); 12 | 13 | // Build atlas 14 | unsigned char* tex_pixels = NULL; 15 | int tex_w, tex_h; 16 | io.Fonts->GetTexDataAsRGBA32(&tex_pixels, &tex_w, &tex_h); 17 | 18 | for (int n = 0; n < 20; n++) 19 | { 20 | printf("NewFrame() %d\n", n); 21 | io.DisplaySize = ImVec2(1920, 1080); 22 | io.DeltaTime = 1.0f / 60.0f; 23 | ImGui::NewFrame(); 24 | 25 | static float f = 0.0f; 26 | ImGui::Text("Hello, world!"); 27 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); 28 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); 29 | ImGui::ShowDemoWindow(NULL); 30 | 31 | ImGui::Render(); 32 | } 33 | 34 | printf("DestroyContext()\n"); 35 | ImGui::DestroyContext(); 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_sdl_directx11/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | set OUT_DIR=Debug 3 | set OUT_EXE=example_sdl_directx11 4 | set INCLUDES=/I.. /I..\.. /I%SDL2_DIR%\include /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include" 5 | set SOURCES=main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_dx11.cpp ..\..\imgui*.cpp 6 | set LIBS=/libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d11.lib d3dcompiler.lib 7 | mkdir %OUT_DIR% 8 | cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console 9 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_sdl_directx11/example_sdl_directx11.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {0587d7a3-f2ce-4d56-b84f-a0005d3bfce6} 6 | 7 | 8 | {08e36723-ce4f-4cff-9662-c40801cf1acf} 9 | 10 | 11 | 12 | 13 | imgui 14 | 15 | 16 | imgui 17 | 18 | 19 | imgui 20 | 21 | 22 | sources 23 | 24 | 25 | sources 26 | 27 | 28 | 29 | 30 | imgui 31 | 32 | 33 | sources 34 | 35 | 36 | imgui 37 | 38 | 39 | imgui 40 | 41 | 42 | sources 43 | 44 | 45 | imgui 46 | 47 | 48 | sources 49 | 50 | 51 | 52 | 53 | 54 | sources 55 | 56 | 57 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_sdl_opengl2/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Cross Platform Makefile 3 | # Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X 4 | # 5 | # You will need SDL2 (http://www.libsdl.org): 6 | # Linux: 7 | # apt-get install libsdl2-dev 8 | # Mac OS X: 9 | # brew install sdl2 10 | # MSYS2: 11 | # pacman -S mingw-w64-i686-SDL 12 | # 13 | 14 | #CXX = g++ 15 | #CXX = clang++ 16 | 17 | EXE = example_sdl_opengl2 18 | SOURCES = main.cpp 19 | SOURCES += ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp 20 | SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp 21 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 22 | UNAME_S := $(shell uname -s) 23 | 24 | CXXFLAGS = -I../ -I../../ 25 | CXXFLAGS += -g -Wall -Wformat 26 | LIBS = 27 | 28 | ##--------------------------------------------------------------------- 29 | ## BUILD FLAGS PER PLATFORM 30 | ##--------------------------------------------------------------------- 31 | 32 | ifeq ($(UNAME_S), Linux) #LINUX 33 | ECHO_MESSAGE = "Linux" 34 | LIBS += -lGL -ldl `sdl2-config --libs` 35 | 36 | CXXFLAGS += `sdl2-config --cflags` 37 | CFLAGS = $(CXXFLAGS) 38 | endif 39 | 40 | ifeq ($(UNAME_S), Darwin) #APPLE 41 | ECHO_MESSAGE = "Mac OS X" 42 | LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl2-config --libs` 43 | LIBS += -L/usr/local/lib -L/opt/local/lib 44 | 45 | CXXFLAGS += `sdl2-config --cflags` 46 | CXXFLAGS += -I/usr/local/include -I/opt/local/include 47 | CFLAGS = $(CXXFLAGS) 48 | endif 49 | 50 | ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) 51 | ECHO_MESSAGE = "MinGW" 52 | LIBS += -lgdi32 -lopengl32 -limm32 `pkg-config --static --libs sdl2` 53 | 54 | CXXFLAGS += `pkg-config --cflags sdl2` 55 | CFLAGS = $(CXXFLAGS) 56 | endif 57 | 58 | ##--------------------------------------------------------------------- 59 | ## BUILD RULES 60 | ##--------------------------------------------------------------------- 61 | 62 | %.o:%.cpp 63 | $(CXX) $(CXXFLAGS) -c -o $@ $< 64 | 65 | %.o:../%.cpp 66 | $(CXX) $(CXXFLAGS) -c -o $@ $< 67 | 68 | %.o:../../%.cpp 69 | $(CXX) $(CXXFLAGS) -c -o $@ $< 70 | 71 | all: $(EXE) 72 | @echo Build complete for $(ECHO_MESSAGE) 73 | 74 | $(EXE): $(OBJS) 75 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 76 | 77 | clean: 78 | rm -f $(EXE) $(OBJS) 79 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_sdl_opengl2/README.md: -------------------------------------------------------------------------------- 1 | 2 | # How to Build 3 | 4 | - On Windows with Visual Studio's CLI 5 | 6 | ``` 7 | set SDL2_DIR=path_to_your_sdl2_folder 8 | cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /FeDebug/example_sdl_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console 9 | # ^^ include paths ^^ source files ^^ output exe ^^ output dir ^^ libraries 10 | # or for 64-bit: 11 | cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /FeDebug/example_sdl_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console 12 | ``` 13 | 14 | - On Linux and similar Unixes 15 | 16 | ``` 17 | c++ `sdl2-config --cflags` -I .. -I ../.. main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL 18 | ``` 19 | 20 | - On Mac OS X 21 | 22 | ``` 23 | brew install sdl2 24 | c++ `sdl2-config --cflags` -I .. -I ../.. main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl 25 | ``` 26 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_sdl_opengl2/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | set OUT_DIR=Debug 3 | set OUT_EXE=example_sdl_opengl2 4 | set INCLUDES=/I.. /I..\.. /I%SDL2_DIR%\include 5 | set SOURCES=main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl2.cpp ..\..\imgui*.cpp 6 | set LIBS=/libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib 7 | mkdir %OUT_DIR% 8 | cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console 9 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {20b90ce4-7fcb-4731-b9a0-075f875de82d} 6 | 7 | 8 | {f18ab499-84e1-499f-8eff-9754361e0e52} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | 13 | 14 | imgui 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | sources 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | imgui 33 | 34 | 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | sources 47 | 48 | 49 | sources 50 | 51 | 52 | 53 | 54 | 55 | sources 56 | 57 | 58 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_sdl_opengl2/main.cpp: -------------------------------------------------------------------------------- 1 | // dear imgui: standalone example application for SDL2 + OpenGL 2 | // If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp. 3 | // (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.) 4 | 5 | // **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)** 6 | // **Prefer using the code in the example_sdl_opengl3/ folder** 7 | // See imgui_impl_sdl.cpp for details. 8 | 9 | #include "imgui.h" 10 | #include "imgui_impl_sdl.h" 11 | #include "imgui_impl_opengl2.h" 12 | #include 13 | #include 14 | #include 15 | 16 | // Main code 17 | int main(int, char**) 18 | { 19 | // Setup SDL 20 | if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0) 21 | { 22 | printf("Error: %s\n", SDL_GetError()); 23 | return -1; 24 | } 25 | 26 | // Setup window 27 | SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); 28 | SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); 29 | SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); 30 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); 31 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2); 32 | SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); 33 | SDL_Window* window = SDL_CreateWindow("Dear ImGui SDL2+OpenGL example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags); 34 | SDL_GLContext gl_context = SDL_GL_CreateContext(window); 35 | SDL_GL_MakeCurrent(window, gl_context); 36 | SDL_GL_SetSwapInterval(1); // Enable vsync 37 | 38 | // Setup Dear ImGui context 39 | IMGUI_CHECKVERSION(); 40 | ImGui::CreateContext(); 41 | ImGuiIO& io = ImGui::GetIO(); (void)io; 42 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls 43 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls 44 | 45 | // Setup Dear ImGui style 46 | ImGui::StyleColorsDark(); 47 | //ImGui::StyleColorsClassic(); 48 | 49 | // Setup Platform/Renderer bindings 50 | ImGui_ImplSDL2_InitForOpenGL(window, gl_context); 51 | ImGui_ImplOpenGL2_Init(); 52 | 53 | // Load Fonts 54 | // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. 55 | // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. 56 | // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit). 57 | // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call. 58 | // - Read 'misc/fonts/README.txt' for more instructions and details. 59 | // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! 60 | //io.Fonts->AddFontDefault(); 61 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f); 62 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f); 63 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f); 64 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f); 65 | //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); 66 | //IM_ASSERT(font != NULL); 67 | 68 | // Our state 69 | bool show_demo_window = true; 70 | bool show_another_window = false; 71 | ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); 72 | 73 | // Main loop 74 | bool done = false; 75 | while (!done) 76 | { 77 | // Poll and handle events (inputs, window resize, etc.) 78 | // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. 79 | // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. 80 | // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. 81 | // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. 82 | SDL_Event event; 83 | while (SDL_PollEvent(&event)) 84 | { 85 | ImGui_ImplSDL2_ProcessEvent(&event); 86 | if (event.type == SDL_QUIT) 87 | done = true; 88 | } 89 | 90 | // Start the Dear ImGui frame 91 | ImGui_ImplOpenGL2_NewFrame(); 92 | ImGui_ImplSDL2_NewFrame(window); 93 | ImGui::NewFrame(); 94 | 95 | // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!). 96 | if (show_demo_window) 97 | ImGui::ShowDemoWindow(&show_demo_window); 98 | 99 | // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window. 100 | { 101 | static float f = 0.0f; 102 | static int counter = 0; 103 | 104 | ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it. 105 | 106 | ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too) 107 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state 108 | ImGui::Checkbox("Another Window", &show_another_window); 109 | 110 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 111 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 112 | 113 | if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) 114 | counter++; 115 | ImGui::SameLine(); 116 | ImGui::Text("counter = %d", counter); 117 | 118 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 119 | ImGui::End(); 120 | } 121 | 122 | // 3. Show another simple window. 123 | if (show_another_window) 124 | { 125 | ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked) 126 | ImGui::Text("Hello from another window!"); 127 | if (ImGui::Button("Close Me")) 128 | show_another_window = false; 129 | ImGui::End(); 130 | } 131 | 132 | // Rendering 133 | ImGui::Render(); 134 | glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y); 135 | glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w); 136 | glClear(GL_COLOR_BUFFER_BIT); 137 | //glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context where shaders may be bound 138 | ImGui_ImplOpenGL2_RenderDrawData(ImGui::GetDrawData()); 139 | SDL_GL_SwapWindow(window); 140 | } 141 | 142 | // Cleanup 143 | ImGui_ImplOpenGL2_Shutdown(); 144 | ImGui_ImplSDL2_Shutdown(); 145 | ImGui::DestroyContext(); 146 | 147 | SDL_GL_DeleteContext(gl_context); 148 | SDL_DestroyWindow(window); 149 | SDL_Quit(); 150 | 151 | return 0; 152 | } 153 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_sdl_opengl3/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Cross Platform Makefile 3 | # Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X 4 | # 5 | # You will need SDL2 (http://www.libsdl.org): 6 | # Linux: 7 | # apt-get install libsdl2-dev 8 | # Mac OS X: 9 | # brew install sdl2 10 | # MSYS2: 11 | # pacman -S mingw-w64-i686-SDL 12 | # 13 | 14 | #CXX = g++ 15 | #CXX = clang++ 16 | 17 | EXE = example_sdl_opengl3 18 | SOURCES = main.cpp 19 | SOURCES += ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp 20 | SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp 21 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 22 | UNAME_S := $(shell uname -s) 23 | 24 | CXXFLAGS = -I../ -I../../ 25 | CXXFLAGS += -g -Wall -Wformat 26 | LIBS = 27 | 28 | ##--------------------------------------------------------------------- 29 | ## OPENGL LOADER 30 | ##--------------------------------------------------------------------- 31 | 32 | ## Using OpenGL loader: gl3w [default] 33 | SOURCES += ../libs/gl3w/GL/gl3w.c 34 | CXXFLAGS += -I../libs/gl3w 35 | 36 | ## Using OpenGL loader: glew 37 | ## (This assumes a system-wide installation) 38 | # CXXFLAGS += -lGLEW -DIMGUI_IMPL_OPENGL_LOADER_GLEW 39 | 40 | ## Using OpenGL loader: glad 41 | # SOURCES += ../libs/glad/src/glad.c 42 | # CXXFLAGS += -I../libs/glad/include -DIMGUI_IMPL_OPENGL_LOADER_GLAD 43 | 44 | ##--------------------------------------------------------------------- 45 | ## BUILD FLAGS PER PLATFORM 46 | ##--------------------------------------------------------------------- 47 | 48 | ifeq ($(UNAME_S), Linux) #LINUX 49 | ECHO_MESSAGE = "Linux" 50 | LIBS += -lGL -ldl `sdl2-config --libs` 51 | 52 | CXXFLAGS += `sdl2-config --cflags` 53 | CFLAGS = $(CXXFLAGS) 54 | endif 55 | 56 | ifeq ($(UNAME_S), Darwin) #APPLE 57 | ECHO_MESSAGE = "Mac OS X" 58 | LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl2-config --libs` 59 | LIBS += -L/usr/local/lib -L/opt/local/lib 60 | 61 | CXXFLAGS += `sdl2-config --cflags` 62 | CXXFLAGS += -I/usr/local/include -I/opt/local/include 63 | CFLAGS = $(CXXFLAGS) 64 | endif 65 | 66 | ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) 67 | ECHO_MESSAGE = "MinGW" 68 | LIBS += -lgdi32 -lopengl32 -limm32 `pkg-config --static --libs sdl2` 69 | 70 | CXXFLAGS += `pkg-config --cflags sdl2` 71 | CFLAGS = $(CXXFLAGS) 72 | endif 73 | 74 | ##--------------------------------------------------------------------- 75 | ## BUILD RULES 76 | ##--------------------------------------------------------------------- 77 | 78 | %.o:%.cpp 79 | $(CXX) $(CXXFLAGS) -c -o $@ $< 80 | 81 | %.o:../%.cpp 82 | $(CXX) $(CXXFLAGS) -c -o $@ $< 83 | 84 | %.o:../../%.cpp 85 | $(CXX) $(CXXFLAGS) -c -o $@ $< 86 | 87 | %.o:../libs/gl3w/GL/%.c 88 | $(CC) $(CFLAGS) -c -o $@ $< 89 | 90 | %.o:../libs/glad/src/%.c 91 | $(CC) $(CFLAGS) -c -o $@ $< 92 | 93 | all: $(EXE) 94 | @echo Build complete for $(ECHO_MESSAGE) 95 | 96 | $(EXE): $(OBJS) 97 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 98 | 99 | clean: 100 | rm -f $(EXE) $(OBJS) 101 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_sdl_opengl3/README.md: -------------------------------------------------------------------------------- 1 | 2 | # How to Build 3 | 4 | - On Windows with Visual Studio's CLI 5 | 6 | ``` 7 | set SDL2_DIR=path_to_your_sdl2_folder 8 | cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include /I..\libs\gl3w main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_sdl_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console 9 | # ^^ include paths ^^ source files ^^ output exe ^^ output dir ^^ libraries 10 | # or for 64-bit: 11 | cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include /I..\libs\gl3w main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_sdl_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console 12 | ``` 13 | 14 | - On Linux and similar Unixes 15 | 16 | ``` 17 | c++ `sdl2-config --cflags` -I .. -I ../.. -I ../libs/gl3w main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -lGL -ldl 18 | ``` 19 | 20 | - On Mac OS X 21 | 22 | ``` 23 | brew install sdl2 24 | c++ `sdl2-config --cflags` -I .. -I ../.. -I ../libs/gl3w main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -framework OpenGl -framework CoreFoundation 25 | ``` 26 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_sdl_opengl3/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | set OUT_DIR=Debug 3 | set OUT_EXE=example_sdl_opengl3 4 | set INCLUDES=/I.. /I..\.. /I%SDL2_DIR%\include /I..\libs\gl3w 5 | set SOURCES=main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c 6 | set LIBS=/libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib 7 | mkdir %OUT_DIR% 8 | cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console 9 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {20b90ce4-7fcb-4731-b9a0-075f875de82d} 6 | 7 | 8 | {f18ab499-84e1-499f-8eff-9754361e0e52} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | {f9997b32-5479-4756-9ffc-77793ad3764f} 13 | 14 | 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | imgui 24 | 25 | 26 | sources 27 | 28 | 29 | gl3w 30 | 31 | 32 | sources 33 | 34 | 35 | sources 36 | 37 | 38 | imgui 39 | 40 | 41 | 42 | 43 | imgui 44 | 45 | 46 | imgui 47 | 48 | 49 | imgui 50 | 51 | 52 | gl3w 53 | 54 | 55 | gl3w 56 | 57 | 58 | sources 59 | 60 | 61 | sources 62 | 63 | 64 | 65 | 66 | 67 | sources 68 | 69 | 70 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {20b90ce4-7fcb-4731-b9a0-075f875de82d} 6 | 7 | 8 | {f18ab499-84e1-499f-8eff-9754361e0e52} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | 13 | 14 | imgui 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | sources 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | imgui 33 | 34 | 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | sources 47 | 48 | 49 | sources 50 | 51 | 52 | 53 | 54 | 55 | sources 56 | 57 | 58 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_win32_directx10/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I .. /I ..\.. /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include" /D UNICODE /D _UNICODE *.cpp ..\imgui_impl_win32.cpp ..\imgui_impl_dx10.cpp ..\..\imgui*.cpp /FeDebug/example_win32_directx10.exe /FoDebug/ /link /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d10.lib d3dcompiler.lib 4 | 5 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_win32_directx10/example_win32_directx10.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {0587d7a3-f2ce-4d56-b84f-a0005d3bfce6} 6 | 7 | 8 | {08e36723-ce4f-4cff-9662-c40801cf1acf} 9 | 10 | 11 | 12 | 13 | imgui 14 | 15 | 16 | imgui 17 | 18 | 19 | imgui 20 | 21 | 22 | sources 23 | 24 | 25 | sources 26 | 27 | 28 | 29 | 30 | imgui 31 | 32 | 33 | sources 34 | 35 | 36 | imgui 37 | 38 | 39 | imgui 40 | 41 | 42 | sources 43 | 44 | 45 | sources 46 | 47 | 48 | imgui 49 | 50 | 51 | 52 | 53 | 54 | sources 55 | 56 | 57 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_win32_directx11/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I .. /I ..\.. /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include" /D UNICODE /D _UNICODE *.cpp ..\imgui_impl_dx11.cpp ..\imgui_impl_win32.cpp ..\..\imgui*.cpp /FeDebug/example_win32_directx11.exe /FoDebug/ /link /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d11.lib d3dcompiler.lib 4 | 5 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_win32_directx11/example_win32_directx11.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {0587d7a3-f2ce-4d56-b84f-a0005d3bfce6} 6 | 7 | 8 | {08e36723-ce4f-4cff-9662-c40801cf1acf} 9 | 10 | 11 | 12 | 13 | imgui 14 | 15 | 16 | imgui 17 | 18 | 19 | imgui 20 | 21 | 22 | sources 23 | 24 | 25 | sources 26 | 27 | 28 | 29 | 30 | imgui 31 | 32 | 33 | sources 34 | 35 | 36 | imgui 37 | 38 | 39 | imgui 40 | 41 | 42 | sources 43 | 44 | 45 | sources 46 | 47 | 48 | imgui 49 | 50 | 51 | 52 | 53 | 54 | sources 55 | 56 | 57 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_win32_directx12/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I .. /I ..\.. /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /D UNICODE /D _UNICODE *.cpp ..\imgui_impl_dx12.cpp ..\imgui_impl_win32.cpp ..\..\imgui*.cpp /FeDebug/example_win32_directx12.exe /FoDebug/ /link d3d12.lib d3dcompiler.lib dxgi.lib 4 | 5 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_win32_directx12/example_win32_directx12.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {fb3d294f-51ec-478e-a627-25831c80fefd} 6 | 7 | 8 | {4f33ddea-9910-456d-b868-4267eb3c2b19} 9 | 10 | 11 | 12 | 13 | imgui 14 | 15 | 16 | imgui 17 | 18 | 19 | imgui 20 | 21 | 22 | sources 23 | 24 | 25 | sources 26 | 27 | 28 | 29 | 30 | imgui 31 | 32 | 33 | sources 34 | 35 | 36 | imgui 37 | 38 | 39 | imgui 40 | 41 | 42 | sources 43 | 44 | 45 | sources 46 | 47 | 48 | imgui 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_win32_directx9/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I .. /I ..\.. /I "%DXSDK_DIR%/Include" /D UNICODE /D _UNICODE *.cpp ..\imgui_impl_dx9.cpp ..\imgui_impl_win32.cpp ..\..\imgui*.cpp /FeDebug/example_win32_directx9.exe /FoDebug/ /link /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d9.lib 4 | -------------------------------------------------------------------------------- /imgui-1.73/examples/example_win32_directx9/example_win32_directx9.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {a82cba23-9de0-45c2-b1e3-2eb1666702de} 10 | 11 | 12 | 13 | 14 | sources 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | imgui 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | imgui 33 | 34 | 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | sources 47 | 48 | 49 | sources 50 | 51 | 52 | 53 | 54 | 55 | sources 56 | 57 | 58 | -------------------------------------------------------------------------------- /imgui-1.73/examples/imgui_examples.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_win32_directx9", "example_win32_directx9\example_win32_directx9.vcxproj", "{4165A294-21F2-44CA-9B38-E3F935ABADF5}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_win32_directx10", "example_win32_directx10\example_win32_directx10.vcxproj", "{345A953E-A004-4648-B442-DC5F9F11068C}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_win32_directx11", "example_win32_directx11\example_win32_directx11.vcxproj", "{9F316E83-5AE5-4939-A723-305A94F48005}" 11 | EndProject 12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_glfw_opengl2", "example_glfw_opengl2\example_glfw_opengl2.vcxproj", "{9CDA7840-B7A5-496D-A527-E95571496D18}" 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_glfw_opengl3", "example_glfw_opengl3\example_glfw_opengl3.vcxproj", "{4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}" 15 | EndProject 16 | Global 17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 18 | Debug|Win32 = Debug|Win32 19 | Debug|x64 = Debug|x64 20 | Release|Win32 = Release|Win32 21 | Release|x64 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 24 | {9CDA7840-B7A5-496D-A527-E95571496D18}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {9CDA7840-B7A5-496D-A527-E95571496D18}.Debug|Win32.Build.0 = Debug|Win32 26 | {9CDA7840-B7A5-496D-A527-E95571496D18}.Debug|x64.ActiveCfg = Debug|x64 27 | {9CDA7840-B7A5-496D-A527-E95571496D18}.Debug|x64.Build.0 = Debug|x64 28 | {9CDA7840-B7A5-496D-A527-E95571496D18}.Release|Win32.ActiveCfg = Release|Win32 29 | {9CDA7840-B7A5-496D-A527-E95571496D18}.Release|Win32.Build.0 = Release|Win32 30 | {9CDA7840-B7A5-496D-A527-E95571496D18}.Release|x64.ActiveCfg = Release|x64 31 | {9CDA7840-B7A5-496D-A527-E95571496D18}.Release|x64.Build.0 = Release|x64 32 | {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Debug|Win32.ActiveCfg = Debug|Win32 33 | {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Debug|Win32.Build.0 = Debug|Win32 34 | {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Debug|x64.ActiveCfg = Debug|x64 35 | {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Debug|x64.Build.0 = Debug|x64 36 | {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Release|Win32.ActiveCfg = Release|Win32 37 | {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Release|Win32.Build.0 = Release|Win32 38 | {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Release|x64.ActiveCfg = Release|x64 39 | {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Release|x64.Build.0 = Release|x64 40 | {9F316E83-5AE5-4939-A723-305A94F48005}.Debug|Win32.ActiveCfg = Debug|Win32 41 | {9F316E83-5AE5-4939-A723-305A94F48005}.Debug|Win32.Build.0 = Debug|Win32 42 | {9F316E83-5AE5-4939-A723-305A94F48005}.Debug|x64.ActiveCfg = Debug|x64 43 | {9F316E83-5AE5-4939-A723-305A94F48005}.Debug|x64.Build.0 = Debug|x64 44 | {9F316E83-5AE5-4939-A723-305A94F48005}.Release|Win32.ActiveCfg = Release|Win32 45 | {9F316E83-5AE5-4939-A723-305A94F48005}.Release|Win32.Build.0 = Release|Win32 46 | {9F316E83-5AE5-4939-A723-305A94F48005}.Release|x64.ActiveCfg = Release|x64 47 | {9F316E83-5AE5-4939-A723-305A94F48005}.Release|x64.Build.0 = Release|x64 48 | {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Debug|Win32.ActiveCfg = Debug|Win32 49 | {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Debug|Win32.Build.0 = Debug|Win32 50 | {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Debug|x64.ActiveCfg = Debug|x64 51 | {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Debug|x64.Build.0 = Debug|x64 52 | {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Release|Win32.ActiveCfg = Release|Win32 53 | {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Release|Win32.Build.0 = Release|Win32 54 | {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Release|x64.ActiveCfg = Release|x64 55 | {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Release|x64.Build.0 = Release|x64 56 | {345A953E-A004-4648-B442-DC5F9F11068C}.Debug|Win32.ActiveCfg = Debug|Win32 57 | {345A953E-A004-4648-B442-DC5F9F11068C}.Debug|Win32.Build.0 = Debug|Win32 58 | {345A953E-A004-4648-B442-DC5F9F11068C}.Debug|x64.ActiveCfg = Debug|x64 59 | {345A953E-A004-4648-B442-DC5F9F11068C}.Debug|x64.Build.0 = Debug|x64 60 | {345A953E-A004-4648-B442-DC5F9F11068C}.Release|Win32.ActiveCfg = Release|Win32 61 | {345A953E-A004-4648-B442-DC5F9F11068C}.Release|Win32.Build.0 = Release|Win32 62 | {345A953E-A004-4648-B442-DC5F9F11068C}.Release|x64.ActiveCfg = Release|x64 63 | {345A953E-A004-4648-B442-DC5F9F11068C}.Release|x64.Build.0 = Release|x64 64 | EndGlobalSection 65 | GlobalSection(SolutionProperties) = preSolution 66 | HideSolutionNode = FALSE 67 | EndGlobalSection 68 | EndGlobal 69 | -------------------------------------------------------------------------------- /imgui-1.73/examples/imgui_impl_allegro5.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer + Platform Binding for Allegro 5 2 | // (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 6 | // [X] Platform: Clipboard support (from Allegro 5.1.12) 7 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 8 | // Issues: 9 | // [ ] Renderer: The renderer is suboptimal as we need to unindex our buffers and convert vertices manually. 10 | // [ ] Platform: Missing gamepad support. 11 | 12 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 13 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 14 | // https://github.com/ocornut/imgui, Original Allegro 5 code by @birthggd 15 | 16 | #pragma once 17 | 18 | struct ALLEGRO_DISPLAY; 19 | union ALLEGRO_EVENT; 20 | 21 | IMGUI_IMPL_API bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display); 22 | IMGUI_IMPL_API void ImGui_ImplAllegro5_Shutdown(); 23 | IMGUI_IMPL_API void ImGui_ImplAllegro5_NewFrame(); 24 | IMGUI_IMPL_API void ImGui_ImplAllegro5_RenderDrawData(ImDrawData* draw_data); 25 | IMGUI_IMPL_API bool ImGui_ImplAllegro5_ProcessEvent(ALLEGRO_EVENT* event); 26 | 27 | // Use if you want to reset your rendering device without losing ImGui state. 28 | IMGUI_IMPL_API bool ImGui_ImplAllegro5_CreateDeviceObjects(); 29 | IMGUI_IMPL_API void ImGui_ImplAllegro5_InvalidateDeviceObjects(); 30 | -------------------------------------------------------------------------------- /imgui-1.73/examples/imgui_impl_dx10.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer for DirectX10 2 | // This needs to be used along with a Platform Binding (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 6 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bits indices. 7 | 8 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 9 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 10 | // https://github.com/ocornut/imgui 11 | 12 | #pragma once 13 | 14 | struct ID3D10Device; 15 | 16 | IMGUI_IMPL_API bool ImGui_ImplDX10_Init(ID3D10Device* device); 17 | IMGUI_IMPL_API void ImGui_ImplDX10_Shutdown(); 18 | IMGUI_IMPL_API void ImGui_ImplDX10_NewFrame(); 19 | IMGUI_IMPL_API void ImGui_ImplDX10_RenderDrawData(ImDrawData* draw_data); 20 | 21 | // Use if you want to reset your rendering device without losing ImGui state. 22 | IMGUI_IMPL_API void ImGui_ImplDX10_InvalidateDeviceObjects(); 23 | IMGUI_IMPL_API bool ImGui_ImplDX10_CreateDeviceObjects(); 24 | -------------------------------------------------------------------------------- /imgui-1.73/examples/imgui_impl_dx11.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer for DirectX11 2 | // This needs to be used along with a Platform Binding (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 6 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bits indices. 7 | 8 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 9 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 10 | // https://github.com/ocornut/imgui 11 | 12 | #pragma once 13 | 14 | struct ID3D11Device; 15 | struct ID3D11DeviceContext; 16 | 17 | IMGUI_IMPL_API bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context); 18 | IMGUI_IMPL_API void ImGui_ImplDX11_Shutdown(); 19 | IMGUI_IMPL_API void ImGui_ImplDX11_NewFrame(); 20 | IMGUI_IMPL_API void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data); 21 | 22 | // Use if you want to reset your rendering device without losing ImGui state. 23 | IMGUI_IMPL_API void ImGui_ImplDX11_InvalidateDeviceObjects(); 24 | IMGUI_IMPL_API bool ImGui_ImplDX11_CreateDeviceObjects(); 25 | -------------------------------------------------------------------------------- /imgui-1.73/examples/imgui_impl_dx12.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer for DirectX12 2 | // This needs to be used along with a Platform Binding (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 6 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bits indices. 7 | // Issues: 8 | // [ ] 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*)). See github.com/ocornut/imgui/pull/301 9 | 10 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 11 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 12 | // https://github.com/ocornut/imgui 13 | 14 | #pragma once 15 | 16 | enum DXGI_FORMAT; 17 | struct ID3D12Device; 18 | struct ID3D12GraphicsCommandList; 19 | struct D3D12_CPU_DESCRIPTOR_HANDLE; 20 | struct D3D12_GPU_DESCRIPTOR_HANDLE; 21 | 22 | // cmd_list is the command list that the implementation will use to render imgui draw lists. 23 | // Before calling the render function, caller must prepare cmd_list by resetting it and setting the appropriate 24 | // render target and descriptor heap that contains font_srv_cpu_desc_handle/font_srv_gpu_desc_handle. 25 | // font_srv_cpu_desc_handle and font_srv_gpu_desc_handle are handles to a single SRV descriptor to use for the internal font texture. 26 | IMGUI_IMPL_API bool ImGui_ImplDX12_Init(ID3D12Device* device, int num_frames_in_flight, DXGI_FORMAT rtv_format, 27 | D3D12_CPU_DESCRIPTOR_HANDLE font_srv_cpu_desc_handle, D3D12_GPU_DESCRIPTOR_HANDLE font_srv_gpu_desc_handle); 28 | IMGUI_IMPL_API void ImGui_ImplDX12_Shutdown(); 29 | IMGUI_IMPL_API void ImGui_ImplDX12_NewFrame(); 30 | IMGUI_IMPL_API void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandList* graphics_command_list); 31 | 32 | // Use if you want to reset your rendering device without losing ImGui state. 33 | IMGUI_IMPL_API void ImGui_ImplDX12_InvalidateDeviceObjects(); 34 | IMGUI_IMPL_API bool ImGui_ImplDX12_CreateDeviceObjects(); 35 | -------------------------------------------------------------------------------- /imgui-1.73/examples/imgui_impl_dx9.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer for DirectX9 2 | // This needs to be used along with a Platform Binding (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 6 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bits indices. 7 | 8 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 9 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 10 | // https://github.com/ocornut/imgui 11 | 12 | #pragma once 13 | 14 | struct IDirect3DDevice9; 15 | 16 | IMGUI_IMPL_API bool ImGui_ImplDX9_Init(IDirect3DDevice9* device); 17 | IMGUI_IMPL_API void ImGui_ImplDX9_Shutdown(); 18 | IMGUI_IMPL_API void ImGui_ImplDX9_NewFrame(); 19 | IMGUI_IMPL_API void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data); 20 | 21 | // Use if you want to reset your rendering device without losing ImGui state. 22 | IMGUI_IMPL_API bool ImGui_ImplDX9_CreateDeviceObjects(); 23 | IMGUI_IMPL_API void ImGui_ImplDX9_InvalidateDeviceObjects(); 24 | -------------------------------------------------------------------------------- /imgui-1.73/examples/imgui_impl_glfw.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Binding for GLFW 2 | // This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan..) 3 | // (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.) 4 | 5 | // Implemented features: 6 | // [X] Platform: Clipboard support. 7 | // [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 8 | // [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW. 9 | // [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE). 10 | 11 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 12 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 13 | // https://github.com/ocornut/imgui 14 | 15 | // About GLSL version: 16 | // The 'glsl_version' initialization parameter defaults to "#version 150" if NULL. 17 | // Only override if your GL version doesn't handle this GLSL version. Keep NULL if unsure! 18 | 19 | #pragma once 20 | 21 | struct GLFWwindow; 22 | 23 | IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks); 24 | IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool install_callbacks); 25 | IMGUI_IMPL_API void ImGui_ImplGlfw_Shutdown(); 26 | IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame(); 27 | 28 | // InitXXX function with 'install_callbacks=true': install GLFW callbacks. They will call user's previously installed callbacks, if any. 29 | // InitXXX function with 'install_callbacks=false': do not install GLFW callbacks. You will need to call them yourself from your own GLFW callbacks. 30 | IMGUI_IMPL_API void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods); 31 | IMGUI_IMPL_API void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset); 32 | IMGUI_IMPL_API void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods); 33 | IMGUI_IMPL_API void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c); 34 | -------------------------------------------------------------------------------- /imgui-1.73/examples/imgui_impl_glut.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Binding for GLUT/FreeGLUT 2 | // This needs to be used along with a Renderer (e.g. OpenGL2) 3 | 4 | // !!! GLUT/FreeGLUT IS OBSOLETE SOFTWARE. Using GLUT is not recommended unless you really miss the 90's. !!! 5 | // !!! If someone or something is teaching you GLUT in 2019, you are being abused. Please show some resistance. !!! 6 | // !!! Nowadays, prefer using GLFW or SDL instead! 7 | 8 | // Issues: 9 | // [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I 10 | // [ ] Platform: Missing mouse cursor shape/visibility support. 11 | // [ ] Platform: Missing clipboard support (not supported by Glut). 12 | // [ ] Platform: Missing gamepad support. 13 | 14 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 15 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 16 | // https://github.com/ocornut/imgui 17 | 18 | #pragma once 19 | 20 | IMGUI_IMPL_API bool ImGui_ImplGLUT_Init(); 21 | IMGUI_IMPL_API void ImGui_ImplGLUT_InstallFuncs(); 22 | IMGUI_IMPL_API void ImGui_ImplGLUT_Shutdown(); 23 | IMGUI_IMPL_API void ImGui_ImplGLUT_NewFrame(); 24 | 25 | // You can call ImGui_ImplGLUT_InstallFuncs() to get all those functions installed automatically, 26 | // or call them yourself from your own GLUT handlers. We are using the same weird names as GLUT for consistency.. 27 | //---------------------------------------- GLUT name --------------------------------------------- Decent Name --------- 28 | IMGUI_IMPL_API void ImGui_ImplGLUT_ReshapeFunc(int w, int h); // ~ ResizeFunc 29 | IMGUI_IMPL_API void ImGui_ImplGLUT_MotionFunc(int x, int y); // ~ MouseMoveFunc 30 | IMGUI_IMPL_API void ImGui_ImplGLUT_MouseFunc(int button, int state, int x, int y); // ~ MouseButtonFunc 31 | IMGUI_IMPL_API void ImGui_ImplGLUT_MouseWheelFunc(int button, int dir, int x, int y); // ~ MouseWheelFunc 32 | IMGUI_IMPL_API void ImGui_ImplGLUT_KeyboardFunc(unsigned char c, int x, int y); // ~ CharPressedFunc 33 | IMGUI_IMPL_API void ImGui_ImplGLUT_KeyboardUpFunc(unsigned char c, int x, int y); // ~ CharReleasedFunc 34 | IMGUI_IMPL_API void ImGui_ImplGLUT_SpecialFunc(int key, int x, int y); // ~ KeyPressedFunc 35 | IMGUI_IMPL_API void ImGui_ImplGLUT_SpecialUpFunc(int key, int x, int y); // ~ KeyReleasedFunc 36 | -------------------------------------------------------------------------------- /imgui-1.73/examples/imgui_impl_marmalade.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer + Platform Binding for Marmalade + IwGx 2 | // Marmalade code: Copyright (C) 2015 by Giovanni Zito (this file is part of Dear ImGui) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'CIwTexture*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 6 | 7 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 8 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 9 | // https://github.com/ocornut/imgui 10 | 11 | #pragma once 12 | 13 | IMGUI_IMPL_API bool ImGui_Marmalade_Init(bool install_callbacks); 14 | IMGUI_IMPL_API void ImGui_Marmalade_Shutdown(); 15 | IMGUI_IMPL_API void ImGui_Marmalade_NewFrame(); 16 | IMGUI_IMPL_API void ImGui_Marmalade_RenderDrawData(ImDrawData* draw_data); 17 | 18 | // Use if you want to reset your rendering device without losing ImGui state. 19 | IMGUI_IMPL_API void ImGui_Marmalade_InvalidateDeviceObjects(); 20 | IMGUI_IMPL_API bool ImGui_Marmalade_CreateDeviceObjects(); 21 | 22 | // Callbacks (installed by default if you enable 'install_callbacks' during initialization) 23 | // You can also handle inputs yourself and use those as a reference. 24 | IMGUI_IMPL_API int32 ImGui_Marmalade_PointerButtonEventCallback(void* system_data, void* user_data); 25 | IMGUI_IMPL_API int32 ImGui_Marmalade_KeyCallback(void* system_data, void* user_data); 26 | IMGUI_IMPL_API int32 ImGui_Marmalade_CharCallback(void* system_data, void* user_data); 27 | -------------------------------------------------------------------------------- /imgui-1.73/examples/imgui_impl_metal.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer for Metal 2 | // This needs to be used along with a Platform Binding (e.g. OSX) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'MTLTexture' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 6 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bits indices. 7 | 8 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 9 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 10 | // https://github.com/ocornut/imgui 11 | 12 | @class MTLRenderPassDescriptor; 13 | @protocol MTLDevice, MTLCommandBuffer, MTLRenderCommandEncoder; 14 | 15 | IMGUI_IMPL_API bool ImGui_ImplMetal_Init(id device); 16 | IMGUI_IMPL_API void ImGui_ImplMetal_Shutdown(); 17 | IMGUI_IMPL_API void ImGui_ImplMetal_NewFrame(MTLRenderPassDescriptor *renderPassDescriptor); 18 | IMGUI_IMPL_API void ImGui_ImplMetal_RenderDrawData(ImDrawData* draw_data, 19 | id commandBuffer, 20 | id commandEncoder); 21 | 22 | // Called by Init/NewFrame/Shutdown 23 | IMGUI_IMPL_API bool ImGui_ImplMetal_CreateFontsTexture(id device); 24 | IMGUI_IMPL_API void ImGui_ImplMetal_DestroyFontsTexture(); 25 | IMGUI_IMPL_API bool ImGui_ImplMetal_CreateDeviceObjects(id device); 26 | IMGUI_IMPL_API void ImGui_ImplMetal_DestroyDeviceObjects(); 27 | -------------------------------------------------------------------------------- /imgui-1.73/examples/imgui_impl_opengl2.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer for OpenGL2 (legacy OpenGL, fixed pipeline) 2 | // This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 6 | 7 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 8 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 9 | // https://github.com/ocornut/imgui 10 | 11 | // **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)** 12 | // **Prefer using the code in imgui_impl_opengl3.cpp** 13 | // This code is mostly provided as a reference to learn how ImGui integration works, because it is shorter to read. 14 | // If your code is using GL3+ context or any semi modern OpenGL calls, using this is likely to make everything more 15 | // complicated, will require your code to reset every single OpenGL attributes to their initial state, and might 16 | // confuse your GPU driver. 17 | // The GL2 code is unable to reset attributes or even call e.g. "glUseProgram(0)" because they don't exist in that API. 18 | 19 | #pragma once 20 | 21 | IMGUI_IMPL_API bool ImGui_ImplOpenGL2_Init(); 22 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_Shutdown(); 23 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_NewFrame(); 24 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data); 25 | 26 | // Called by Init/NewFrame/Shutdown 27 | IMGUI_IMPL_API bool ImGui_ImplOpenGL2_CreateFontsTexture(); 28 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_DestroyFontsTexture(); 29 | IMGUI_IMPL_API bool ImGui_ImplOpenGL2_CreateDeviceObjects(); 30 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_DestroyDeviceObjects(); 31 | -------------------------------------------------------------------------------- /imgui-1.73/examples/imgui_impl_opengl3.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer for modern OpenGL with shaders / programmatic pipeline 2 | // - Desktop GL: 2.x 3.x 4.x 3 | // - Embedded GL: ES 2.0 (WebGL 1.0), ES 3.0 (WebGL 2.0) 4 | // This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..) 5 | 6 | // Implemented features: 7 | // [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 8 | // [x] Renderer: Desktop GL only: Support for large meshes (64k+ vertices) with 16-bits indices. 9 | 10 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 11 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 12 | // https://github.com/ocornut/imgui 13 | 14 | // About Desktop OpenGL function loaders: 15 | // Modern desktop OpenGL doesn't have a standard portable header file to load OpenGL function pointers. 16 | // Helper libraries are often used for this purpose! Here we are supporting a few common ones (gl3w, glew, glad). 17 | // You may use another loader/header of your choice (glext, glLoadGen, etc.), or chose to manually implement your own. 18 | 19 | // About GLSL version: 20 | // The 'glsl_version' initialization parameter should be NULL (default) or a "#version XXX" string. 21 | // On computer platform the GLSL version default to "#version 130". On OpenGL ES 3 platform it defaults to "#version 300 es" 22 | // Only override if your GL version doesn't handle this GLSL version. See GLSL version table at the top of imgui_impl_opengl3.cpp. 23 | 24 | #pragma once 25 | 26 | // Backend API 27 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL); 28 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown(); 29 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_NewFrame(); 30 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data); 31 | 32 | // (Optional) Called by Init/NewFrame/Shutdown 33 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateFontsTexture(); 34 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyFontsTexture(); 35 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateDeviceObjects(); 36 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects(); 37 | 38 | // Specific OpenGL versions 39 | //#define IMGUI_IMPL_OPENGL_ES2 // Auto-detected on Emscripten 40 | //#define IMGUI_IMPL_OPENGL_ES3 // Auto-detected on iOS/Android 41 | 42 | // Desktop OpenGL: attempt to detect default GL loader based on available header files. 43 | // If auto-detection fails or doesn't select the same GL loader file as used by your application, 44 | // you are likely to get a crash in ImGui_ImplOpenGL3_Init(). 45 | // You can explicitly select a loader by using '#define IMGUI_IMPL_OPENGL_LOADER_XXX' in imconfig.h or compiler command-line. 46 | #if !defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) \ 47 | && !defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) \ 48 | && !defined(IMGUI_IMPL_OPENGL_LOADER_GLAD) \ 49 | && !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM) 50 | #if defined(__has_include) 51 | #if __has_include() 52 | #define IMGUI_IMPL_OPENGL_LOADER_GLEW 53 | #elif __has_include() 54 | #define IMGUI_IMPL_OPENGL_LOADER_GLAD 55 | #elif __has_include() 56 | #define IMGUI_IMPL_OPENGL_LOADER_GL3W 57 | #else 58 | #error "Cannot detect OpenGL loader!" 59 | #endif 60 | #else 61 | #define IMGUI_IMPL_OPENGL_LOADER_GL3W // Default to GL3W 62 | #endif 63 | #endif 64 | 65 | -------------------------------------------------------------------------------- /imgui-1.73/examples/imgui_impl_osx.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Binding for OSX / Cocoa 2 | // This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..) 3 | // [ALPHA] Early bindings, not well tested. If you want a portable application, prefer using the GLFW or SDL platform bindings on Mac. 4 | 5 | // Implemented features: 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // [X] Platform: OSX clipboard is supported within core Dear ImGui (no specific code in this back-end). 8 | // Issues: 9 | // [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters].. 10 | 11 | @class NSEvent; 12 | @class NSView; 13 | 14 | IMGUI_API bool ImGui_ImplOSX_Init(); 15 | IMGUI_API void ImGui_ImplOSX_Shutdown(); 16 | IMGUI_API void ImGui_ImplOSX_NewFrame(NSView *_Nonnull view); 17 | IMGUI_API bool ImGui_ImplOSX_HandleEvent(NSEvent *_Nonnull event, NSView *_Nullable view); 18 | -------------------------------------------------------------------------------- /imgui-1.73/examples/imgui_impl_sdl.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Binding for SDL2 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | // (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.) 4 | 5 | // Implemented features: 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // [X] Platform: Clipboard support. 8 | // [X] Platform: Keyboard arrays indexed using SDL_SCANCODE_* codes, e.g. ImGui::IsKeyPressed(SDL_SCANCODE_SPACE). 9 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 10 | // Missing features: 11 | // [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME. 12 | 13 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 14 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 15 | // https://github.com/ocornut/imgui 16 | 17 | #pragma once 18 | 19 | struct SDL_Window; 20 | typedef union SDL_Event SDL_Event; 21 | 22 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForOpenGL(SDL_Window* window, void* sdl_gl_context); 23 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForVulkan(SDL_Window* window); 24 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForD3D(SDL_Window* window); 25 | IMGUI_IMPL_API void ImGui_ImplSDL2_Shutdown(); 26 | IMGUI_IMPL_API void ImGui_ImplSDL2_NewFrame(SDL_Window* window); 27 | IMGUI_IMPL_API bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event); 28 | -------------------------------------------------------------------------------- /imgui-1.73/examples/imgui_impl_vulkan.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer for Vulkan 2 | // This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..) 3 | 4 | // Implemented features: 5 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bits indices. 6 | // Missing features: 7 | // [ ] Renderer: User texture binding. Changes of ImTextureID aren't supported by this binding! See https://github.com/ocornut/imgui/pull/914 8 | 9 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 10 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 11 | // https://github.com/ocornut/imgui 12 | 13 | // The aim of imgui_impl_vulkan.h/.cpp is to be usable in your engine without any modification. 14 | // IF YOU FEEL YOU NEED TO MAKE ANY CHANGE TO THIS CODE, please share them and your feedback at https://github.com/ocornut/imgui/ 15 | 16 | // Important note to the reader who wish to integrate imgui_impl_vulkan.cpp/.h in their own engine/app. 17 | // - Common ImGui_ImplVulkan_XXX functions and structures are used to interface with imgui_impl_vulkan.cpp/.h. 18 | // You will use those if you want to use this rendering back-end in your engine/app. 19 | // - Helper ImGui_ImplVulkanH_XXX functions and structures are only used by this example (main.cpp) and by 20 | // the back-end itself (imgui_impl_vulkan.cpp), but should PROBABLY NOT be used by your own engine/app code. 21 | // Read comments in imgui_impl_vulkan.h. 22 | 23 | #pragma once 24 | 25 | #include 26 | 27 | // Initialization data, for ImGui_ImplVulkan_Init() 28 | // [Please zero-clear before use!] 29 | struct ImGui_ImplVulkan_InitInfo 30 | { 31 | VkInstance Instance; 32 | VkPhysicalDevice PhysicalDevice; 33 | VkDevice Device; 34 | uint32_t QueueFamily; 35 | VkQueue Queue; 36 | VkPipelineCache PipelineCache; 37 | VkDescriptorPool DescriptorPool; 38 | uint32_t MinImageCount; // >= 2 39 | uint32_t ImageCount; // >= MinImageCount 40 | VkSampleCountFlagBits MSAASamples; // >= VK_SAMPLE_COUNT_1_BIT 41 | const VkAllocationCallbacks* Allocator; 42 | void (*CheckVkResultFn)(VkResult err); 43 | }; 44 | 45 | // Called by user code 46 | IMGUI_IMPL_API bool ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info, VkRenderPass render_pass); 47 | IMGUI_IMPL_API void ImGui_ImplVulkan_Shutdown(); 48 | IMGUI_IMPL_API void ImGui_ImplVulkan_NewFrame(); 49 | IMGUI_IMPL_API void ImGui_ImplVulkan_RenderDrawData(ImDrawData* draw_data, VkCommandBuffer command_buffer); 50 | IMGUI_IMPL_API bool ImGui_ImplVulkan_CreateFontsTexture(VkCommandBuffer command_buffer); 51 | IMGUI_IMPL_API void ImGui_ImplVulkan_DestroyFontUploadObjects(); 52 | IMGUI_IMPL_API void ImGui_ImplVulkan_SetMinImageCount(uint32_t min_image_count); // To override MinImageCount after initialization (e.g. if swap chain is recreated) 53 | 54 | 55 | //------------------------------------------------------------------------- 56 | // Internal / Miscellaneous Vulkan Helpers 57 | // (Used by example's main.cpp. Used by multi-viewport features. PROBABLY NOT used by your own engine/app.) 58 | //------------------------------------------------------------------------- 59 | // You probably do NOT need to use or care about those functions. 60 | // Those functions only exist because: 61 | // 1) they facilitate the readability and maintenance of the multiple main.cpp examples files. 62 | // 2) the upcoming multi-viewport feature will need them internally. 63 | // Generally we avoid exposing any kind of superfluous high-level helpers in the bindings, 64 | // but it is too much code to duplicate everywhere so we exceptionally expose them. 65 | // 66 | // Your engine/app will likely _already_ have code to setup all that stuff (swap chain, render pass, frame buffers, etc.). 67 | // You may read this code to learn about Vulkan, but it is recommended you use you own custom tailored code to do equivalent work. 68 | // (The ImGui_ImplVulkanH_XXX functions do not interact with any of the state used by the regular ImGui_ImplVulkan_XXX functions) 69 | //------------------------------------------------------------------------- 70 | 71 | struct ImGui_ImplVulkanH_Frame; 72 | struct ImGui_ImplVulkanH_Window; 73 | 74 | // Helpers 75 | IMGUI_IMPL_API void ImGui_ImplVulkanH_CreateWindow(VkInstance instance, VkPhysicalDevice physical_device, VkDevice device, ImGui_ImplVulkanH_Window* wnd, uint32_t queue_family, const VkAllocationCallbacks* allocator, int w, int h, uint32_t min_image_count); 76 | IMGUI_IMPL_API void ImGui_ImplVulkanH_DestroyWindow(VkInstance instance, VkDevice device, ImGui_ImplVulkanH_Window* wnd, const VkAllocationCallbacks* allocator); 77 | IMGUI_IMPL_API VkSurfaceFormatKHR ImGui_ImplVulkanH_SelectSurfaceFormat(VkPhysicalDevice physical_device, VkSurfaceKHR surface, const VkFormat* request_formats, int request_formats_count, VkColorSpaceKHR request_color_space); 78 | IMGUI_IMPL_API VkPresentModeKHR ImGui_ImplVulkanH_SelectPresentMode(VkPhysicalDevice physical_device, VkSurfaceKHR surface, const VkPresentModeKHR* request_modes, int request_modes_count); 79 | IMGUI_IMPL_API int ImGui_ImplVulkanH_GetMinImageCountFromPresentMode(VkPresentModeKHR present_mode); 80 | 81 | // Helper structure to hold the data needed by one rendering frame 82 | // (Used by example's main.cpp. Used by multi-viewport features. Probably NOT used by your own engine/app.) 83 | // [Please zero-clear before use!] 84 | struct ImGui_ImplVulkanH_Frame 85 | { 86 | VkCommandPool CommandPool; 87 | VkCommandBuffer CommandBuffer; 88 | VkFence Fence; 89 | VkImage Backbuffer; 90 | VkImageView BackbufferView; 91 | VkFramebuffer Framebuffer; 92 | }; 93 | 94 | struct ImGui_ImplVulkanH_FrameSemaphores 95 | { 96 | VkSemaphore ImageAcquiredSemaphore; 97 | VkSemaphore RenderCompleteSemaphore; 98 | }; 99 | 100 | // Helper structure to hold the data needed by one rendering context into one OS window 101 | // (Used by example's main.cpp. Used by multi-viewport features. Probably NOT used by your own engine/app.) 102 | struct ImGui_ImplVulkanH_Window 103 | { 104 | int Width; 105 | int Height; 106 | VkSwapchainKHR Swapchain; 107 | VkSurfaceKHR Surface; 108 | VkSurfaceFormatKHR SurfaceFormat; 109 | VkPresentModeKHR PresentMode; 110 | VkRenderPass RenderPass; 111 | bool ClearEnable; 112 | VkClearValue ClearValue; 113 | uint32_t FrameIndex; // Current frame being rendered to (0 <= FrameIndex < FrameInFlightCount) 114 | uint32_t ImageCount; // Number of simultaneous in-flight frames (returned by vkGetSwapchainImagesKHR, usually derived from min_image_count) 115 | uint32_t SemaphoreIndex; // Current set of swapchain wait semaphores we're using (needs to be distinct from per frame data) 116 | ImGui_ImplVulkanH_Frame* Frames; 117 | ImGui_ImplVulkanH_FrameSemaphores* FrameSemaphores; 118 | 119 | ImGui_ImplVulkanH_Window() 120 | { 121 | memset(this, 0, sizeof(*this)); 122 | PresentMode = VK_PRESENT_MODE_MAX_ENUM_KHR; 123 | ClearEnable = true; 124 | } 125 | }; 126 | 127 | -------------------------------------------------------------------------------- /imgui-1.73/examples/imgui_impl_win32.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Binding for Windows (standard windows API for 32 and 64 bits applications) 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | 4 | // Implemented features: 5 | // [X] Platform: Clipboard support (for Win32 this is actually part of core imgui) 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // [X] Platform: Keyboard arrays indexed using VK_* Virtual Key Codes, e.g. ImGui::IsKeyPressed(VK_SPACE). 8 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 9 | 10 | #pragma once 11 | 12 | IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd); 13 | IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown(); 14 | IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame(); 15 | 16 | // Handler for Win32 messages, update mouse/keyboard data. 17 | // You may or not need this for your implementation, but it can serve as reference for handling inputs. 18 | // Intentionally commented out to avoid dragging dependencies on types. You can COPY this line into your .cpp code instead. 19 | /* 20 | IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 21 | */ 22 | -------------------------------------------------------------------------------- /imgui-1.73/examples/libs/glfw/COPYING.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002-2006 Marcus Geelnard 2 | Copyright (c) 2006-2010 Camilla Berglund 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely, subject to the following restrictions: 11 | 12 | 1. The origin of this software must not be misrepresented; you must not 13 | claim that you wrote the original software. If you use this software 14 | in a product, an acknowledgment in the product documentation would 15 | be appreciated but is not required. 16 | 17 | 2. Altered source versions must be plainly marked as such, and must not 18 | be misrepresented as being the original software. 19 | 20 | 3. This notice may not be removed or altered from any source 21 | distribution. 22 | 23 | -------------------------------------------------------------------------------- /imgui-1.73/examples/libs/glfw/lib-vc2010-32/glfw3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coremaze/Cube-World-Building-Mod/3515d8d1a564f754b3763edb13b2295581988206/imgui-1.73/examples/libs/glfw/lib-vc2010-32/glfw3.lib -------------------------------------------------------------------------------- /imgui-1.73/examples/libs/glfw/lib-vc2010-64/glfw3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coremaze/Cube-World-Building-Mod/3515d8d1a564f754b3763edb13b2295581988206/imgui-1.73/examples/libs/glfw/lib-vc2010-64/glfw3.lib -------------------------------------------------------------------------------- /imgui-1.73/examples/libs/usynergy/README.txt: -------------------------------------------------------------------------------- 1 | 2 | uSynergy client -- Implementation for the embedded Synergy client library 3 | version 1.0.0, July 7th, 2012 4 | Copyright (c) 2012 Alex Evans 5 | 6 | This is a copy of the files once found at: 7 | https://github.com/symless/synergy-core/tree/790d108a56ada9caad8e56ff777d444485a69da9/src/micro 8 | 9 | -------------------------------------------------------------------------------- /imgui-1.73/imconfig.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // COMPILE-TIME OPTIONS FOR DEAR IMGUI 3 | // Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure. 4 | // You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions. 5 | //----------------------------------------------------------------------------- 6 | // A) You may edit imconfig.h (and not overwrite it when updating Dear ImGui, or maintain a patch/branch with your modifications to imconfig.h) 7 | // B) or add configuration directives in your own file and compile with #define IMGUI_USER_CONFIG "myfilename.h" 8 | // If you do so you need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include 9 | // the imgui*.cpp files but also _any_ of your code that uses Dear ImGui. This is because some compile-time options have an affect on data structures. 10 | // Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts. 11 | // Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using. 12 | //----------------------------------------------------------------------------- 13 | 14 | #pragma once 15 | 16 | //---- Define assertion handler. Defaults to calling assert(). 17 | //#define IM_ASSERT(_EXPR) MyAssert(_EXPR) 18 | //#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts 19 | 20 | //---- Define attributes of all API symbols declarations, e.g. for DLL under Windows 21 | // Using dear imgui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility. 22 | //#define IMGUI_API __declspec( dllexport ) 23 | //#define IMGUI_API __declspec( dllimport ) 24 | 25 | //---- Don't define obsolete functions/enums names. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names. 26 | //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 27 | 28 | //---- Don't implement demo windows functionality (ShowDemoWindow()/ShowStyleEditor()/ShowUserGuide() methods will be empty) 29 | // It is very strongly recommended to NOT disable the demo windows during development. Please read the comments in imgui_demo.cpp. 30 | //#define IMGUI_DISABLE_DEMO_WINDOWS 31 | //#define IMGUI_DISABLE_METRICS_WINDOW 32 | 33 | //---- Don't implement some functions to reduce linkage requirements. 34 | //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. 35 | //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] Don't implement default IME handler. Won't use and link with ImmGetContext/ImmSetCompositionWindow. 36 | //#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, ime). 37 | //#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices'). 38 | //#define IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself if you don't want to link with vsnprintf. 39 | //#define IMGUI_DISABLE_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 wrapper so you can implement them yourself. Declare your prototypes in imconfig.h. 40 | //#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions(). 41 | 42 | //---- Include imgui_user.h at the end of imgui.h as a convenience 43 | //#define IMGUI_INCLUDE_IMGUI_USER_H 44 | 45 | //---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another) 46 | //#define IMGUI_USE_BGRA_PACKED_COLOR 47 | 48 | //---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version 49 | // By default the embedded implementations are declared static and not available outside of imgui cpp files. 50 | //#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h" 51 | //#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h" 52 | //#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION 53 | //#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION 54 | 55 | //---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4. 56 | // This will be inlined as part of ImVec2 and ImVec4 class declarations. 57 | /* 58 | #define IM_VEC2_CLASS_EXTRA \ 59 | ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \ 60 | operator MyVec2() const { return MyVec2(x,y); } 61 | 62 | #define IM_VEC4_CLASS_EXTRA \ 63 | ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \ 64 | operator MyVec4() const { return MyVec4(x,y,z,w); } 65 | */ 66 | 67 | //---- Using 32-bits vertex indices (default is 16-bits) is one way to allow large meshes with more than 64K vertices. 68 | // Your renderer back-end will need to support it (most example renderer back-ends support both 16/32-bits indices). 69 | // Another way to allow large meshes while keeping 16-bits indices is to handle ImDrawCmd::VtxOffset in your renderer. 70 | // Read about ImGuiBackendFlags_RendererHasVtxOffset for details. 71 | //#define ImDrawIdx unsigned int 72 | 73 | //---- Override ImDrawCallback signature (will need to modify renderer back-ends accordingly) 74 | //struct ImDrawList; 75 | //struct ImDrawCmd; 76 | //typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data); 77 | //#define ImDrawCallback MyImDrawCallback 78 | 79 | //---- Debug Tools 80 | // Use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging. 81 | //#define IM_DEBUG_BREAK IM_ASSERT(0) 82 | //#define IM_DEBUG_BREAK __debugbreak() 83 | // Have the Item Picker break in the ItemAdd() function instead of ItemHoverable() - which is earlier in the code, will catch a few extra items, allow picking items other than Hovered one. 84 | // This adds a small runtime cost which is why it is not enabled by default. 85 | //#define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX 86 | 87 | //---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files. 88 | /* 89 | namespace ImGui 90 | { 91 | void MyFunction(const char* name, const MyMatrix44& v); 92 | } 93 | */ 94 | -------------------------------------------------------------------------------- /imgui-1.73/misc/README.txt: -------------------------------------------------------------------------------- 1 | 2 | misc/cpp/ 3 | InputText() wrappers for C++ standard library (STL) type: std::string. 4 | This is also an example of how you may wrap your own similar types. 5 | 6 | misc/fonts/ 7 | Fonts loading/merging instructions (e.g. How to handle glyph ranges, how to merge icons fonts). 8 | Command line tool "binary_to_compressed_c" to create compressed arrays to embed data in source code. 9 | Suggested fonts and links. 10 | 11 | misc/freetype/ 12 | Font atlas builder/rasterizer using FreeType instead of stb_truetype. 13 | Benefit from better FreeType rasterization, in particular for small fonts. 14 | 15 | misc/natvis/ 16 | Natvis file to describe dear imgui types in the Visual Studio debugger. 17 | With this, types like ImVector<> will be displayed nicely in the debugger. 18 | You can include this file a Visual Studio project file, or install it in Visual Studio folder. 19 | -------------------------------------------------------------------------------- /imgui-1.73/misc/cpp/README.txt: -------------------------------------------------------------------------------- 1 | 2 | imgui_stdlib.h + imgui_stdlib.cpp 3 | InputText() wrappers for C++ standard library (STL) type: std::string. 4 | This is also an example of how you may wrap your own similar types. 5 | 6 | imgui_scoped.h 7 | [Experimental, not currently in main repository] 8 | Additional header file with some RAII-style wrappers for common Dear ImGui functions. 9 | Try by merging: https://github.com/ocornut/imgui/pull/2197 10 | Discuss at: https://github.com/ocornut/imgui/issues/2096 11 | -------------------------------------------------------------------------------- /imgui-1.73/misc/cpp/imgui_stdlib.cpp: -------------------------------------------------------------------------------- 1 | // imgui_stdlib.cpp 2 | // Wrappers for C++ standard library (STL) types (std::string, etc.) 3 | // This is also an example of how you may wrap your own similar types. 4 | 5 | // Compatibility: 6 | // - std::string support is only guaranteed to work from C++11. 7 | // If you try to use it pre-C++11, please share your findings (w/ info about compiler/architecture) 8 | 9 | // Changelog: 10 | // - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string 11 | 12 | #include "imgui.h" 13 | #include "imgui_stdlib.h" 14 | 15 | struct InputTextCallback_UserData 16 | { 17 | std::string* Str; 18 | ImGuiInputTextCallback ChainCallback; 19 | void* ChainCallbackUserData; 20 | }; 21 | 22 | static int InputTextCallback(ImGuiInputTextCallbackData* data) 23 | { 24 | InputTextCallback_UserData* user_data = (InputTextCallback_UserData*)data->UserData; 25 | if (data->EventFlag == ImGuiInputTextFlags_CallbackResize) 26 | { 27 | // Resize string callback 28 | // If for some reason we refuse the new length (BufTextLen) and/or capacity (BufSize) we need to set them back to what we want. 29 | std::string* str = user_data->Str; 30 | IM_ASSERT(data->Buf == str->c_str()); 31 | str->resize(data->BufTextLen); 32 | data->Buf = (char*)str->c_str(); 33 | } 34 | else if (user_data->ChainCallback) 35 | { 36 | // Forward to user callback, if any 37 | data->UserData = user_data->ChainCallbackUserData; 38 | return user_data->ChainCallback(data); 39 | } 40 | return 0; 41 | } 42 | 43 | bool ImGui::InputText(const char* label, std::string* str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data) 44 | { 45 | IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0); 46 | flags |= ImGuiInputTextFlags_CallbackResize; 47 | 48 | InputTextCallback_UserData cb_user_data; 49 | cb_user_data.Str = str; 50 | cb_user_data.ChainCallback = callback; 51 | cb_user_data.ChainCallbackUserData = user_data; 52 | return InputText(label, (char*)str->c_str(), str->capacity() + 1, flags, InputTextCallback, &cb_user_data); 53 | } 54 | 55 | bool ImGui::InputTextMultiline(const char* label, std::string* str, const ImVec2& size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data) 56 | { 57 | IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0); 58 | flags |= ImGuiInputTextFlags_CallbackResize; 59 | 60 | InputTextCallback_UserData cb_user_data; 61 | cb_user_data.Str = str; 62 | cb_user_data.ChainCallback = callback; 63 | cb_user_data.ChainCallbackUserData = user_data; 64 | return InputTextMultiline(label, (char*)str->c_str(), str->capacity() + 1, size, flags, InputTextCallback, &cb_user_data); 65 | } 66 | 67 | bool ImGui::InputTextWithHint(const char* label, const char* hint, std::string* str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data) 68 | { 69 | IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0); 70 | flags |= ImGuiInputTextFlags_CallbackResize; 71 | 72 | InputTextCallback_UserData cb_user_data; 73 | cb_user_data.Str = str; 74 | cb_user_data.ChainCallback = callback; 75 | cb_user_data.ChainCallbackUserData = user_data; 76 | return InputTextWithHint(label, hint, (char*)str->c_str(), str->capacity() + 1, flags, InputTextCallback, &cb_user_data); 77 | } 78 | -------------------------------------------------------------------------------- /imgui-1.73/misc/cpp/imgui_stdlib.h: -------------------------------------------------------------------------------- 1 | // imgui_stdlib.h 2 | // Wrappers for C++ standard library (STL) types (std::string, etc.) 3 | // This is also an example of how you may wrap your own similar types. 4 | 5 | // Compatibility: 6 | // - std::string support is only guaranteed to work from C++11. 7 | // If you try to use it pre-C++11, please share your findings (w/ info about compiler/architecture) 8 | 9 | // Changelog: 10 | // - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | namespace ImGui 17 | { 18 | // ImGui::InputText() with std::string 19 | // Because text input needs dynamic resizing, we need to setup a callback to grow the capacity 20 | IMGUI_API bool InputText(const char* label, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); 21 | IMGUI_API bool InputTextMultiline(const char* label, std::string* str, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); 22 | IMGUI_API bool InputTextWithHint(const char* label, const char* hint, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); 23 | } 24 | -------------------------------------------------------------------------------- /imgui-1.73/misc/fonts/Cousine-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coremaze/Cube-World-Building-Mod/3515d8d1a564f754b3763edb13b2295581988206/imgui-1.73/misc/fonts/Cousine-Regular.ttf -------------------------------------------------------------------------------- /imgui-1.73/misc/fonts/DroidSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coremaze/Cube-World-Building-Mod/3515d8d1a564f754b3763edb13b2295581988206/imgui-1.73/misc/fonts/DroidSans.ttf -------------------------------------------------------------------------------- /imgui-1.73/misc/fonts/Karla-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coremaze/Cube-World-Building-Mod/3515d8d1a564f754b3763edb13b2295581988206/imgui-1.73/misc/fonts/Karla-Regular.ttf -------------------------------------------------------------------------------- /imgui-1.73/misc/fonts/ProggyClean.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coremaze/Cube-World-Building-Mod/3515d8d1a564f754b3763edb13b2295581988206/imgui-1.73/misc/fonts/ProggyClean.ttf -------------------------------------------------------------------------------- /imgui-1.73/misc/fonts/ProggyTiny.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coremaze/Cube-World-Building-Mod/3515d8d1a564f754b3763edb13b2295581988206/imgui-1.73/misc/fonts/ProggyTiny.ttf -------------------------------------------------------------------------------- /imgui-1.73/misc/fonts/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coremaze/Cube-World-Building-Mod/3515d8d1a564f754b3763edb13b2295581988206/imgui-1.73/misc/fonts/Roboto-Medium.ttf -------------------------------------------------------------------------------- /imgui-1.73/misc/freetype/README.md: -------------------------------------------------------------------------------- 1 | # imgui_freetype 2 | 3 | Build font atlases using FreeType instead of stb_truetype (which is the default font rasterizer in Dear ImGui). 4 |
by @vuhdo, @mikesart, @ocornut. 5 | 6 | ### Usage 7 | 8 | 1. Get latest FreeType binaries or build yourself (under Windows you may use vcpkg with `vcpkg install freetype`). 9 | 2. Add imgui_freetype.h/cpp alongside your imgui sources. 10 | 3. Include imgui_freetype.h after imgui.h. 11 | 4. Call `ImGuiFreeType::BuildFontAtlas()` *BEFORE* calling `ImFontAtlas::GetTexDataAsRGBA32()` or `ImFontAtlas::Build()` (so normal Build() won't be called): 12 | 13 | ```cpp 14 | // See ImGuiFreeType::RasterizationFlags 15 | unsigned int flags = ImGuiFreeType::NoHinting; 16 | ImGuiFreeType::BuildFontAtlas(io.Fonts, flags); 17 | io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); 18 | ``` 19 | 20 | ### Gamma Correct Blending 21 | 22 | FreeType assumes blending in linear space rather than gamma space. 23 | See FreeType note for [FT_Render_Glyph](https://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_Render_Glyph). 24 | For correct results you need to be using sRGB and convert to linear space in the pixel shader output. 25 | The default Dear ImGui styles will be impacted by this change (alpha values will need tweaking). 26 | 27 | ### Test code Usage 28 | ```cpp 29 | #include "misc/freetype/imgui_freetype.h" 30 | #include "misc/freetype/imgui_freetype.cpp" 31 | 32 | // Load various small fonts 33 | ImGuiIO& io = ImGui::GetIO(); 34 | io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 13.0f); 35 | io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 13.0f); 36 | io.Fonts->AddFontDefault(); 37 | 38 | FreeTypeTest freetype_test; 39 | 40 | // Main Loop 41 | while (true) 42 | { 43 | if (freetype_test.UpdateRebuild()) 44 | { 45 | // REUPLOAD FONT TEXTURE TO GPU 46 | ImGui_ImplXXX_DestroyDeviceObjects(); 47 | ImGui_ImplXXX_CreateDeviceObjects(); 48 | } 49 | ImGui::NewFrame(); 50 | freetype_test.ShowFreetypeOptionsWindow(); 51 | ... 52 | } 53 | ``` 54 | 55 | ### Test code 56 | ```cpp 57 | #include "misc/freetype/imgui_freetype.h" 58 | #include "misc/freetype/imgui_freetype.cpp" 59 | 60 | struct FreeTypeTest 61 | { 62 | enum FontBuildMode 63 | { 64 | FontBuildMode_FreeType, 65 | FontBuildMode_Stb 66 | }; 67 | 68 | FontBuildMode BuildMode; 69 | bool WantRebuild; 70 | float FontsMultiply; 71 | int FontsPadding; 72 | unsigned int FontsFlags; 73 | 74 | FreeTypeTest() 75 | { 76 | BuildMode = FontBuildMode_FreeType; 77 | WantRebuild = true; 78 | FontsMultiply = 1.0f; 79 | FontsPadding = 1; 80 | FontsFlags = 0; 81 | } 82 | 83 | // Call _BEFORE_ NewFrame() 84 | bool UpdateRebuild() 85 | { 86 | if (!WantRebuild) 87 | return false; 88 | ImGuiIO& io = ImGui::GetIO(); 89 | io.Fonts->TexGlyphPadding = FontsPadding; 90 | for (int n = 0; n < io.Fonts->ConfigData.Size; n++) 91 | { 92 | ImFontConfig* font_config = (ImFontConfig*)&io.Fonts->ConfigData[n]; 93 | font_config->RasterizerMultiply = FontsMultiply; 94 | font_config->RasterizerFlags = (BuildMode == FontBuildMode_FreeType) ? FontsFlags : 0x00; 95 | } 96 | if (BuildMode == FontBuildMode_FreeType) 97 | ImGuiFreeType::BuildFontAtlas(io.Fonts, FontsFlags); 98 | else if (BuildMode == FontBuildMode_Stb) 99 | io.Fonts->Build(); 100 | WantRebuild = false; 101 | return true; 102 | } 103 | 104 | // Call to draw interface 105 | void ShowFreetypeOptionsWindow() 106 | { 107 | ImGui::Begin("FreeType Options"); 108 | ImGui::ShowFontSelector("Fonts"); 109 | WantRebuild |= ImGui::RadioButton("FreeType", (int*)&BuildMode, FontBuildMode_FreeType); 110 | ImGui::SameLine(); 111 | WantRebuild |= ImGui::RadioButton("Stb (Default)", (int*)&BuildMode, FontBuildMode_Stb); 112 | WantRebuild |= ImGui::DragFloat("Multiply", &FontsMultiply, 0.001f, 0.0f, 2.0f); 113 | WantRebuild |= ImGui::DragInt("Padding", &FontsPadding, 0.1f, 0, 16); 114 | if (BuildMode == FontBuildMode_FreeType) 115 | { 116 | WantRebuild |= ImGui::CheckboxFlags("NoHinting", &FontsFlags, ImGuiFreeType::NoHinting); 117 | WantRebuild |= ImGui::CheckboxFlags("NoAutoHint", &FontsFlags, ImGuiFreeType::NoAutoHint); 118 | WantRebuild |= ImGui::CheckboxFlags("ForceAutoHint", &FontsFlags, ImGuiFreeType::ForceAutoHint); 119 | WantRebuild |= ImGui::CheckboxFlags("LightHinting", &FontsFlags, ImGuiFreeType::LightHinting); 120 | WantRebuild |= ImGui::CheckboxFlags("MonoHinting", &FontsFlags, ImGuiFreeType::MonoHinting); 121 | WantRebuild |= ImGui::CheckboxFlags("Bold", &FontsFlags, ImGuiFreeType::Bold); 122 | WantRebuild |= ImGui::CheckboxFlags("Oblique", &FontsFlags, ImGuiFreeType::Oblique); 123 | WantRebuild |= ImGui::CheckboxFlags("Monochrome", &FontsFlags, ImGuiFreeType::Monochrome); 124 | } 125 | ImGui::End(); 126 | } 127 | }; 128 | ``` 129 | 130 | ### Known issues 131 | - `cfg.OversampleH`, `OversampleV` are ignored (but perhaps not so necessary with this rasterizer). 132 | 133 | -------------------------------------------------------------------------------- /imgui-1.73/misc/freetype/imgui_freetype.h: -------------------------------------------------------------------------------- 1 | // Wrapper to use FreeType (instead of stb_truetype) for Dear ImGui 2 | // Get latest version at https://github.com/ocornut/imgui/tree/master/misc/freetype 3 | // Original code by @Vuhdo (Aleksei Skriabin), maintained by @ocornut 4 | 5 | #pragma once 6 | 7 | #include "imgui.h" // IMGUI_API, ImFontAtlas 8 | 9 | namespace ImGuiFreeType 10 | { 11 | // Hinting greatly impacts visuals (and glyph sizes). 12 | // When disabled, FreeType generates blurrier glyphs, more or less matches the stb's output. 13 | // The Default hinting mode usually looks good, but may distort glyphs in an unusual way. 14 | // The Light hinting mode generates fuzzier glyphs but better matches Microsoft's rasterizer. 15 | 16 | // You can set those flags on a per font basis in ImFontConfig::RasterizerFlags. 17 | // Use the 'extra_flags' parameter of BuildFontAtlas() to force a flag on all your fonts. 18 | enum RasterizerFlags 19 | { 20 | // By default, hinting is enabled and the font's native hinter is preferred over the auto-hinter. 21 | NoHinting = 1 << 0, // Disable hinting. This generally generates 'blurrier' bitmap glyphs when the glyph are rendered in any of the anti-aliased modes. 22 | NoAutoHint = 1 << 1, // Disable auto-hinter. 23 | ForceAutoHint = 1 << 2, // Indicates that the auto-hinter is preferred over the font's native hinter. 24 | LightHinting = 1 << 3, // A lighter hinting algorithm for gray-level modes. Many generated glyphs are fuzzier but better resemble their original shape. This is achieved by snapping glyphs to the pixel grid only vertically (Y-axis), as is done by Microsoft's ClearType and Adobe's proprietary font renderer. This preserves inter-glyph spacing in horizontal text. 25 | MonoHinting = 1 << 4, // Strong hinting algorithm that should only be used for monochrome output. 26 | Bold = 1 << 5, // Styling: Should we artificially embolden the font? 27 | Oblique = 1 << 6, // Styling: Should we slant the font, emulating italic style? 28 | Monochrome = 1 << 7 // Disable anti-aliasing. Combine this with MonoHinting for best results! 29 | }; 30 | 31 | IMGUI_API bool BuildFontAtlas(ImFontAtlas* atlas, unsigned int extra_flags = 0); 32 | 33 | // By default ImGuiFreeType will use IM_ALLOC()/IM_FREE(). 34 | // However, as FreeType does lots of allocations we provide a way for the user to redirect it to a separate memory heap if desired: 35 | IMGUI_API void SetAllocatorFunctions(void* (*alloc_func)(size_t sz, void* user_data), void (*free_func)(void* ptr, void* user_data), void* user_data = NULL); 36 | } 37 | -------------------------------------------------------------------------------- /imgui-1.73/misc/natvis/README.txt: -------------------------------------------------------------------------------- 1 | 2 | Natvis file to describe dear imgui types in the Visual Studio debugger. 3 | With this, types like ImVector<> will be displayed nicely in the debugger. 4 | You can include this file a Visual Studio project file, or install it in Visual Studio folder. 5 | -------------------------------------------------------------------------------- /imgui-1.73/misc/natvis/imgui.natvis: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{Size={Size} Capacity={Capacity}}} 9 | 10 | 11 | Size 12 | Data 13 | 14 | 15 | 16 | 17 | 18 | {{x={x,g} y={y,g}}} 19 | 20 | 21 | 22 | {{x={x,g} y={y,g} z={z,g} w={w,g}}} 23 | 24 | 25 | 26 | {{Min=({Min.x,g} {Min.y,g}) Max=({Max.x,g} {Max.y,g}) Size=({Max.x-Min.x,g} {Max.y-Min.y,g})}} 27 | 28 | Min 29 | Max 30 | Max.x - Min.x 31 | Max.y - Min.y 32 | 33 | 34 | 35 | 36 | {{Name {Name,s} Active {(Active||WasActive)?1:0,d} Child {(Flags & 0x01000000)?1:0,d} Popup {(Flags & 0x04000000)?1:0,d} Hidden {(Hidden)?1:0,d}} 37 | 38 | 39 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include "BuildingMod.h" 2 | 3 | EXPORT BuildingMod* MakeMod() { 4 | return new BuildingMod(); 5 | } --------------------------------------------------------------------------------