Skip to content

Instantly share code, notes, and snippets.

@xndc
Last active April 2, 2019 12:05
Show Gist options
  • Save xndc/78d58f7a7f964a01051b07cbd3edf265 to your computer and use it in GitHub Desktop.
Save xndc/78d58f7a7f964a01051b07cbd3edf265 to your computer and use it in GitHub Desktop.
VS Code IntelliSense slowdown
{
"env": {
"includePath": [
"${workspaceFolder}",
"${workspaceFolder}/glfw/include",
"${workspaceFolder}/imgui"
],
"includePathWin32": [
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/include/*",
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/atlmfc/include/*",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/um",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/ucrt",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/shared",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/winrt",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/cppwinrt",
"C:/VulkanSDK/1.1.101.0/Include"
],
"includePathMac": [
"/usr/include",
"/usr/local/include"
],
"includePathLinux": [
"/usr/include",
"/usr/local/include"
]
},
"configurations": [
{
"name": "Mac",
"includePath": [
"${includePathMac}",
"${includePath}"
],
"defines": [
"_EDITOR"
],
"browse": {
"path": [
"${includePathMac}",
"${includePath}"
],
"limitSymbolsToIncludedHeaders": false,
"databaseFilename": ""
},
"intelliSenseMode": "clang-x64",
"macFrameworkPath": [
"/System/Library/Frameworks",
"/Library/Frameworks"
]
},
{
"name": "Linux",
"includePath": [
"${includePathLinux}",
"${includePath}"
],
"defines": [
"_EDITOR"
],
"browse": {
"path": [
"${includePathLinux}",
"${includePath}"
],
"limitSymbolsToIncludedHeaders": false,
"databaseFilename": ""
},
"intelliSenseMode": "clang-x64"
},
{
"name": "Win32",
"includePath": [
"${includePathWin32}",
"${includePath}"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE",
"_EDITOR"
],
"browse": {
"path": [
"${includePathWin32}",
"${includePath}"
],
"limitSymbolsToIncludedHeaders": false,
"databaseFilename": ""
},
"intelliSenseMode": "msvc-x64",
"cStandard": "c11",
"cppStandard": "c++14"
}
],
"version": 4
}
cmake_minimum_required(VERSION 3.12)
project(Demo)
# GLFW:
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory(glfw)
# dear imgui:
add_library(imgui
"imgui/imgui.cpp"
"imgui/imgui_demo.cpp"
"imgui/imgui_draw.cpp"
"imgui/imgui_widgets.cpp"
"imgui/examples/imgui_impl_opengl3.cpp"
"imgui/examples/imgui_impl_glfw.cpp"
)
target_include_directories(imgui PUBLIC "./")
target_include_directories(imgui PUBLIC "imgui")
target_compile_definitions(imgui PUBLIC "IMGUI_IMPL_OPENGL_LOADER_GLAD")
target_link_libraries(imgui PUBLIC glfw)
# Main target:
add_executable(Demo
"glad/glad.c"
"Main.cpp"
)
# Headers:
target_include_directories(Demo PUBLIC "./")
# Libraries:
target_link_libraries(Demo PUBLIC glfw)
target_link_libraries(Demo PUBLIC imgui)
# Use C++14:
target_compile_features(Demo PUBLIC cxx_std_14)
# Compiler options for MSVC:
if (MSVC)
target_compile_definitions(Demo PUBLIC _CRT_SECURE_NO_WARNINGS)
endif()
# Set the working directory for debugging:
set_target_properties(Demo PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
#include <assert.h>
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <stdio.h>
#if defined(_WIN32) && !defined(APIENTRY)
#define APIENTRY __stdcall
#endif
#include <glad/glad.h>
#include <glfw/glfw3.h>
#include <imgui/imgui.h>
#include <imgui/examples/imgui_impl_opengl3.h>
#include <imgui/examples/imgui_impl_glfw.h>
int main() {
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, true);
GLFWwindow* window = glfwCreateWindow(1280, 1024, "Codex", nullptr, nullptr);
glfwMakeContextCurrent(window);
gladLoadGL();
glfwSwapInterval(0);
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
ImGui_ImplOpenGL3_Init("#version 140");
ImGui_ImplGlfw_InitForOpenGL(window, true);
while (!glfwWindowShouldClose(window)) {
int w, h;
glfwGetFramebufferSize(window, &w, &h);
glViewport(0, 0, w, h);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
ImGui::ShowDemoWindow();
ImGui::Begin("Test"); {
static float a = 0.0f;
ImGui::SliderAngle("Angle", &a);
} ImGui::End();
ImGui::Render();
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
glfwSwapBuffers(window);
glfwWaitEvents();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment