Ownfos / Waffle

static library for easier use of DirectX11

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Waffle

  • Static library for easier use of DirectX11 and ImGui
  • Created with Visual Studio 2019 version 16.5.3, Boost library version 1.72.0, and ImGui

Required project settings:

  • C++ 17 as language standard

  • Waffle as project reference (for correct build order)

  • Additional include directories

    1. ../libraries/boost_1_72_0
    2. ../libraries/imgui
    3. ../Waffle
    • The external libraries I used is not modified at all.
      Just download, unzip if neccessary, and everything's good to go.
      If you have those libraries in different folder, then change
      additional include directories to fit yours.

    • I assume that you are creating a project in this solution (the same one where Waffle is in),
      so there will be no problem in locating required lib file

    • I just discovered that libraries/imgui is empty and github desktop doesn't commit and push
      those files! Until I find a solution, you should download the imgui repository and paste it
      inside the folder...

Required project settings (using "Waffle Binary.zip"):

  • download the zip file and unzip it
  • install boost (both x86, x64) and imgui using vcpkg
    or manually download and add their root directories ("boost_1_72_0", "imgui")
    to "additional include directory"
  • add "Waffle Binary/include" as "additional include directory"
  • add "Waffle Binary/lib" as "additional library directory"
  • set corresponding .lib file as "additional dependencies" for your project configuration
    (e.g. "Waffle_x86_debug.lib" for x86, debug)

Example1

  • This example project shows how to use ImGui with this library
  • There are some steps you need to follow in order to use ImGui:
    1. Create waffle::ImGuiHelper instance (requires waffle::Context and waffle::RenderWindow)
    2. Call RenderWindow::Clear() and RenderWindow::Set() at the beginning of each frame
    3. Call ImGuiHelper::BeginFrame() with the instance you've created
    4. Use ImGui (ImGui::Begin, ImGui::Button, ...)
    5. Call ImGuiHelper::EndFrame()
    6. Call RenderWindow::Present()

Example2

  • This example project shows the overview of this library
    To be specific, it will be performing an offscreen rendering (two-pass)
    First on a texture, then on the actual window

  • Things covered in this example:

    1. Creating window
    2. Creating input layout for shader
    3. Loading compiled vertex/pixel shaders
    4. Creating an indexed triangle mesh
    5. Creating transform matrices
    6. Creating constant buffers for shaders
    7. Creating an empty texture and texture sampler
    8. Synchronizing texture size with window by adding event handler for window resize event
    9. Setting pipeline (CV, RT, PS, VS, ...)
    10. Starting message loop
    11. Using keyboard input to update constant buffer
    12. Rendering to a texture
    13. Rendering texture to window (you can do post-processing with this)
    14. Exception handling (the outermost try-catch block and printing exception)
    • I used shader model 5.0 and specified whether it is a PS or VS
      Visual studio will compile it for you

About

static library for easier use of DirectX11

License:MIT License


Languages

Language:C++ 51.5%Language:HTML 46.2%Language:JavaScript 0.6%Language:C 0.5%Language:Python 0.4%Language:XSLT 0.2%Language:CSS 0.1%Language:Assembly 0.1%Language:CMake 0.1%Language:Makefile 0.1%Language:CWeb 0.0%Language:Shell 0.0%Language:Cuda 0.0%Language:C# 0.0%Language:Ada 0.0%Language:PHP 0.0%Language:TeX 0.0%Language:Pascal 0.0%Language:Batchfile 0.0%Language:Perl 0.0%Language:Max 0.0%Language:DIGITAL Command Language 0.0%Language:Roff 0.0%Language:Objective-C 0.0%Language:Yacc 0.0%Language:QMake 0.0%Language:M4 0.0%Language:Ruby 0.0%Language:Eiffel 0.0%Language:Fortran 0.0%Language:SAS 0.0%Language:Module Management System 0.0%Language:Lex 0.0%Language:TSQL 0.0%Language:Tcl 0.0%Language:HLSL 0.0%Language:Objective-C++ 0.0%Language:D 0.0%Language:QML 0.0%Language:Rebol 0.0%Language:IDL 0.0%