<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: clyh</title>
    <description>The latest articles on Forem by clyh (@clyh).</description>
    <link>https://forem.com/clyh</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1179490%2Fc87a7361-d443-414b-a31d-21c7804db7aa.png</url>
      <title>Forem: clyh</title>
      <link>https://forem.com/clyh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/clyh"/>
    <language>en</language>
    <item>
      <title>I guess we now have Sprite Animations</title>
      <dc:creator>clyh</dc:creator>
      <pubDate>Sun, 05 Apr 2026 08:35:59 +0000</pubDate>
      <link>https://forem.com/clyh/i-guess-we-now-have-sprite-animations-3489</link>
      <guid>https://forem.com/clyh/i-guess-we-now-have-sprite-animations-3489</guid>
      <description>&lt;p&gt;A while back I posted something about wgpu, and making a game engine.&lt;br&gt;
I've since worked on it a bit more, and now we somehow have Animated Sprites! 🎉&lt;/p&gt;

&lt;p&gt;Yay!&lt;/p&gt;

&lt;p&gt;Here’s how it works:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I loaded a spritesheet and slice it into individual sprites.&lt;/li&gt;
&lt;li&gt;These sprites are grouped into animations, which are then handed off to the SpriteAnimator.&lt;/li&gt;
&lt;li&gt;The SpriteAnimator tells the SpriteRenderer which sprite to display at any given time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The sprites aren’t independent images. Each one stores UV coordinates corresponding to its region on the spritesheet.&lt;/p&gt;

&lt;p&gt;The SpriteRenderer then simply renders a 2D quad using the sprite’s UV coordinates, effectively showing the correct pixels from the spritesheet.&lt;/p&gt;

&lt;p&gt;Meanwhile, the SpriteAnimator handles all the animation logic, controlling which sprite the renderer should display and when.&lt;/p&gt;

&lt;p&gt;It’s rather simple, really. Here it is in action:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/1YfXeqwOrWM"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;P.S:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I also implemented text rendering as you can see in the FPS counter at the top left corner of the window in the example gif. Perhaps I will talk about it another day.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>gamedev</category>
      <category>rust</category>
      <category>showdev</category>
      <category>sideprojects</category>
    </item>
    <item>
      <title>Building something here.. maybe..</title>
      <dc:creator>clyh</dc:creator>
      <pubDate>Sun, 08 Mar 2026 10:07:42 +0000</pubDate>
      <link>https://forem.com/clyh/building-something-here-maybe-3i64</link>
      <guid>https://forem.com/clyh/building-something-here-maybe-3i64</guid>
      <description>&lt;p&gt;I've recently being messing around with WGPU, trying make a game engine, and here is what I have right now.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx5xarvbagm8a35tp9thh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx5xarvbagm8a35tp9thh.png" alt=" " width="800" height="616"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;small&gt;&lt;br&gt;
 The model used is  "Microphone GXL 066 Bafhcteks" (&lt;a href="https://skfb.ly/RCGN" rel="noopener noreferrer"&gt;https://skfb.ly/RCGN&lt;/a&gt;) by Gistold is licensed under CC Attribution-NonCommercial-ShareAlike (&lt;a href="http://creativecommons.org/licenses/by-nc-sa/4.0/" rel="noopener noreferrer"&gt;http://creativecommons.org/licenses/by-nc-sa/4.0/&lt;/a&gt;).&lt;br&gt;
&lt;/small&gt;&lt;/p&gt;

&lt;p&gt;It doesn't really do much right now, other than spin the model around&lt;/p&gt;

&lt;p&gt;It is able to load a gltf model, and the relevant textures.&lt;br&gt;
Haven't really touched on lighting yet.&lt;/p&gt;

&lt;p&gt;The next step I will probably be taking would be implementing a deferred renderer.&lt;/p&gt;

</description>
      <category>devlog</category>
      <category>wgpu</category>
      <category>gltf</category>
      <category>rust</category>
    </item>
    <item>
      <title>Setting up C++ (Without Visual Studio)</title>
      <dc:creator>clyh</dc:creator>
      <pubDate>Sun, 08 Oct 2023 04:33:41 +0000</pubDate>
      <link>https://forem.com/clyh/setting-up-c-without-visual-studio-2282</link>
      <guid>https://forem.com/clyh/setting-up-c-without-visual-studio-2282</guid>
      <description>&lt;p&gt;Setting up the development for C++ (and C) is hard. Especially for beginners, even when you are coming from other languages.&lt;br&gt;
I use windows, which can complicates things even further.&lt;/p&gt;

&lt;p&gt;I could use Visual Studio, which would probably make my life easier, but I refuse to.&lt;/p&gt;

&lt;p&gt;In this post I am going to share how I managed to finally create a development environment for C++ on windows which I am satisfied with.&lt;/p&gt;
&lt;h1&gt;
  
  
  1. Compiler
&lt;/h1&gt;

&lt;p&gt;First we need a compiler that works on windows. Traditionally to do this, I used the mingw64 gcc tools. However setting up mingw can be rather complicated and confusing.&lt;/p&gt;

&lt;p&gt;Since then, I've discovered clang. The clang compiler is actually a part of the llvm project. The good thing about clang is that it has windows binaries, which means I can basically install it directly without any of the mingw / msys nonsense.&lt;/p&gt;

&lt;p&gt;I installed clang (and other llvm tools) through winget.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;winget &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nt"&gt;--id&lt;/span&gt; LLVM.LLVM
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, you can get clang (and llvm) from their &lt;a href="https://github.com/llvm/llvm-project/releases" rel="noopener noreferrer"&gt;github releases&lt;/a&gt; or website &lt;a href="https://releases.llvm.org" rel="noopener noreferrer"&gt;here&lt;/a&gt; (which links to their github releases anyway) where you download the windows .exe installer.&lt;/p&gt;

&lt;p&gt;Now you should verify that clang has been added to your path by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;clang &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If it gives some error like &lt;code&gt;clang is not recognized...&lt;/code&gt;&lt;br&gt;
It means that the llvm binaries (which includes clang) has not been added to your path.&lt;br&gt;
So add the llvm installation which is normally at &lt;code&gt;C:\Program Files\LLVM\bin&lt;/code&gt; to your path.&lt;/p&gt;

&lt;p&gt;Now if we run &lt;code&gt;clang --version&lt;/code&gt; again we should get an output like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;clang version 17.0.1
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Congratulations, we now have a C++ compiler!&lt;/p&gt;

&lt;h1&gt;
  
  
  Setting up CMake
&lt;/h1&gt;

&lt;p&gt;Most projects use CMake to build the project.&lt;br&gt;
As much as I want to avoid CMake, it is inevitable. You cannot runaway from it.&lt;br&gt;
I will not go into much detail about how cmake works. I find this &lt;a href="https://cliutils.gitlab.io/modern-cmake/" rel="noopener noreferrer"&gt;website&lt;/a&gt; is very useful for learning about CMake.&lt;/p&gt;

&lt;p&gt;The website also tells you how you can install cmake.&lt;/p&gt;

&lt;p&gt;In general, CMake can generate Makefiles, Visual Studio solutions or other stuff needed to compile the project.&lt;/p&gt;
&lt;h2&gt;
  
  
  Ninja
&lt;/h2&gt;

&lt;p&gt;CMake by default generates a Visual Studio solution. Because I am a avoiding Visual Studio like a plague, we will be using Ninja.&lt;/p&gt;

&lt;p&gt;Why Ninja?&lt;br&gt;
We can't really tell CMake to generate Makefiles because we are not using the gcc toolchain and hence we don't have gnu make.&lt;br&gt;
Besides ninja claims to be faster and can be installed easily.&lt;/p&gt;
&lt;h3&gt;
  
  
  Installing Ninja
&lt;/h3&gt;

&lt;p&gt;There are many ways to install ninja:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Use your system package manager. See &lt;a href="https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages" rel="noopener noreferrer"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Download the binary from &lt;a href="https://github.com/ninja-build/ninja/releases" rel="noopener noreferrer"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Build from source.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://ninja-build.org" rel="noopener noreferrer"&gt;Check here for more details&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For me I installed using through pip: &lt;code&gt;pip install ninja&lt;/code&gt;&lt;br&gt;
(Technically I used &lt;a href="https://pypa.github.io/pipx/" rel="noopener noreferrer"&gt;pipx&lt;/a&gt; but that doesn't really matter)&lt;/p&gt;

&lt;p&gt;It does not matter what method you use, as long as ninja is added to path and accessible from the terminal.&lt;/p&gt;
&lt;h2&gt;
  
  
  Using CMake with ninja
&lt;/h2&gt;

&lt;p&gt;Now to build your CMake project with Ninja you simply do:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cmake &lt;span class="nt"&gt;-S&lt;/span&gt; &amp;lt;project root&amp;gt; &lt;span class="nt"&gt;-B&lt;/span&gt; build &lt;span class="nt"&gt;-G&lt;/span&gt; Ninja
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Managing dependencies with vcpkg
&lt;/h1&gt;

&lt;p&gt;When you program stuff, we tend to use external libraries/packages  so we don't reinvent the wheel every time we need something.&lt;/p&gt;

&lt;p&gt;In python we can simply use pip to install them.&lt;/p&gt;

&lt;p&gt;In C# we can use nuget.&lt;/p&gt;

&lt;p&gt;However in C++ (and C), we have to manually download the external library/package and add them to the project, or put it in the C drive (which clutters it up), or some other very not elegant solution.&lt;/p&gt;

&lt;p&gt;vcpkg solves this. There are other solutions like conan but I find vcpkg to be the simplest.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing and adding vcpkg
&lt;/h2&gt;

&lt;p&gt;There are many ways of installing and adding vcpkg to your project.&lt;/p&gt;

&lt;p&gt;I will be installing vcpkg as a git submodule.&lt;/p&gt;

&lt;p&gt;In the project root folder, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git submodule add https://github.com/microsoft/vcpkg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now add the following to project &lt;code&gt;CMakeLists.txt&lt;/code&gt; before the first &lt;code&gt;project()&lt;/code&gt; call.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cmake"&gt;&lt;code&gt;&lt;span class="nb"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;CMAKE_TOOLCHAIN_FILE &lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CMAKE_CURRENT_SOURCE_DIR&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;/vcpkg/scripts/buildsystems/vcpkg.cmake CACHE STRING &lt;span class="s2"&gt;"Vcpkg toolchain file"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;This will still allow people to not use vcpkg, by passing the CMAKE_TOOLCHAIN_FILE directly, but it will make the configure-build step slightly easier.&lt;br&gt;
from: &lt;a href="https://github.com/microsoft/vcpkg#vcpkg-as-a-submodule-with-cmake" rel="noopener noreferrer"&gt;https://github.com/microsoft/vcpkg#vcpkg-as-a-submodule-with-cmake&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Consuming dependencies
&lt;/h2&gt;

&lt;p&gt;To start using packages from vcpkg, we have to first create a &lt;code&gt;vcpkg.json&lt;/code&gt; file in the project root.&lt;br&gt;
In &lt;code&gt;vcpkg.json&lt;/code&gt; we declare our dependencies like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"dependencies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"fmt"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;example&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;dependency&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can now add use dependencies in CMakeList.txt like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cmake"&gt;&lt;code&gt;&lt;span class="nb"&gt;find_package&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;fmt CONFIG REQUIRED&lt;span class="p"&gt;)&lt;/span&gt; // first find the package first
&lt;span class="nb"&gt;target_link_libraries&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;main PRIVATE fmt::fmt&lt;span class="p"&gt;)&lt;/span&gt; // Add package to target
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(Taken from &lt;a href="https://learn.microsoft.com/en-gb/vcpkg/consume/manifest-mode?tabs=msbuild%2Cbuild-MSBuild" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-gb/vcpkg/consume/manifest-mode?tabs=msbuild%2Cbuild-MSBuild&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Now if you build your project with cmake, vcpkg will automatically fetch the required packages and build them for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finding packages
&lt;/h2&gt;

&lt;p&gt;You can go to &lt;a href="https://vcpkg.io/en/packages" rel="noopener noreferrer"&gt;https://vcpkg.io/en/packages&lt;/a&gt; to see available packages.&lt;/p&gt;

&lt;h1&gt;
  
  
  TLDR
&lt;/h1&gt;

&lt;p&gt;My C++ setup basically consists of:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;llvm/clang&lt;/li&gt;
&lt;li&gt;CMake&lt;/li&gt;
&lt;li&gt;Ninja&lt;/li&gt;
&lt;li&gt;vcpkg&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  THE END
&lt;/h1&gt;

</description>
      <category>cpp</category>
      <category>tutorial</category>
      <category>devjournal</category>
    </item>
    <item>
      <title>First post: Hello World!</title>
      <dc:creator>clyh</dc:creator>
      <pubDate>Sun, 08 Oct 2023 02:26:04 +0000</pubDate>
      <link>https://forem.com/clyh/first-post-hello-world-57dh</link>
      <guid>https://forem.com/clyh/first-post-hello-world-57dh</guid>
      <description>&lt;p&gt;This is my first post. Yes very exciting. In the future I will be ranting about random stuff in this blog.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
