<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kayra Urfalı on Medium]]></title>
        <description><![CDATA[Stories by Kayra Urfalı on Medium]]></description>
        <link>https://medium.com/@kayraurf?source=rss-925782a4ed32------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lFqlzJLtVObjSB38eL0kHg.png</url>
            <title>Stories by Kayra Urfalı on Medium</title>
            <link>https://medium.com/@kayraurf?source=rss-925782a4ed32------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 15:11:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kayraurf/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Delegates in C++// Polos]]></title>
            <link>https://medium.com/@kayraurf/delegates-in-c-polos-56211a7536ba?source=rss-925782a4ed32------2</link>
            <guid isPermaLink="false">https://medium.com/p/56211a7536ba</guid>
            <category><![CDATA[game-engine]]></category>
            <category><![CDATA[cpp]]></category>
            <dc:creator><![CDATA[Kayra Urfalı]]></dc:creator>
            <pubDate>Mon, 31 Jan 2022 13:40:17 GMT</pubDate>
            <atom:updated>2023-09-21T20:13:23.520Z</atom:updated>
            <content:encoded><![CDATA[<p>Well, this blog is probably going to be the hardest one to explain. I hope in the end, you are not mindblown by what you have read. However, once we get the grip of delegates, everything will be easier to understand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*3IHqeRRkUNlb6X2-AuNeHA.png" /></figure><h3><strong>Delegates (The bleeding wound of C++)</strong></h3><p><strong>What is a delegate</strong>, you might ask. I would have had a detailed answer that’s content has been copy-pasted from another article, but I will not do that. I will explain it as I understood it. Also I will be assuming that you are familiar with C/C++’ function pointers.</p><p><strong>So, what are they?</strong> Well, in short, they are a function pointer. But, delegates would be ashamed if they saw that sentence, because they are much more than that. In C#, the delegates just comes out of the box with the language. However, they have still not been implemented by the <a href="https://isocpp.org/"><strong>isocpp</strong></a> committee. Why? Who knows. But that doesn’t stop us from implementing our own delegates in an elegant way, while still sticking to the C++ standards.</p><p>C# delegates are essentially multicast delegates, meaning that they are capable of holding multiple function pointers, and from different objects as well. For C++, i could do the same with another class, but I feel that it’s not needed.</p><p><strong>Can we not just store the pointer of a class method, and call it from somewhere else? </strong>No. Because in C++, methods work different than normal functions. That’s where delegates come in. Delegates holds the pointer of the object and a “special pointer” to it’s method. That way, we can call the method of a class. This “special pointer” is called a method stub. First described in Sergey Ryazanov’s “<a href="https://www.codeproject.com/Articles/11015/The-Impossibly-Fast-C-Delegates">The Impossibly Fast C++ Delegates</a>” article on CodeProject. Which is the source of my delegate implementation.</p><p>My implementation, has a couple more methods so I can use STL’s functions with adding and removing from vectors. With a vector, I’ll essentially have a multicast delegate, which holds functions that has the same return type and argument types as the declared delegate template in the vector.</p><p>Complicated? Yes. But code will make you understand all these better. Before we move on to the event bus, let’s take a look at what I added to my delegate class:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*LozQAPWY9IEbbduHqM4WzQ.png" /><figcaption>Some default constructors and a const method stub creator</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iXxK7IDBqTCifXeon3E0Lg.png" /><figcaption>stuff you need for std::remove (which we’ll se in our event bus)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*PHy6L6FkVqVZ1h_CBi6bqQ.png" /></figure><p>That was all there was to delegates. The topic itself is a bit hard to understand and also harder to explain, so I also gave some code from my implementation.</p><p><strong>In short</strong>, delegates can hold class functions (methods) without allocating any extra memory.</p><p>I was originally going to explain delegates and my event bus implementation in the same post, but the delegates took too much space, and I do not want to bore the reader by making this as long as possible. So I had to seperate them.</p><p>Thank you for reading and bearing this much information with me. See you in my next post about an <strong>Event Bus Implementation!</strong></p><p>Links:</p><p>My implementation origin: <br><a href="https://www.codeproject.com/Articles/13287/Fast-C-Delegate">Fast C++ Delegate — CodeProject</a></p><p>A better and more portable solution to delegates:<br><a href="https://www.codeproject.com/Articles/11015/The-Impossibly-Fast-C-Delegates">The Impossibly Fast C++ Delegates — CodeProject</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56211a7536ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My attempt on a game engine // Polos]]></title>
            <link>https://medium.com/@kayraurf/my-attempt-on-a-game-engine-polos-2ce0421d41cd?source=rss-925782a4ed32------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ce0421d41cd</guid>
            <category><![CDATA[first-post]]></category>
            <category><![CDATA[opengl]]></category>
            <category><![CDATA[game-engine]]></category>
            <category><![CDATA[vulkan]]></category>
            <dc:creator><![CDATA[Kayra Urfalı]]></dc:creator>
            <pubDate>Fri, 28 Jan 2022 19:31:05 GMT</pubDate>
            <atom:updated>2022-01-28T20:59:38.493Z</atom:updated>
            <content:encoded><![CDATA[<p>Since the last 2 years, I have been actively contributing to an open-source OpenGL framework called <a href="https://github.com/GlistEngine/GlistEngine"><strong>GlistEngine</strong></a>, that has a lot of functionality and that is not only limited to developing games. While there, I have developed various types of stuff for the framework. Including, a video player, GUI items, various shaders etc. I would definitely recommend using that framework, if you are new to game programming but have some C++ backend.</p><p>After some time contributing to GlistEngine, some time in the last week, I started working on my own game engine, <strong>Polos</strong>. As of now, it only has a logging system and an event bus system (both of which I will cover in my next Medium posts). I will probably make the source code of all my progress open-source sometime in near future, probably when I can render stuff with my engine or when I have a proper editor to do stuff with.</p><p>This project is going to be a “learn &amp; develop” one. Meaning, that I will be actively researching concepts related to game engines, and will be implementing them in my own way. So I expect this project to be a long-term one. I also feel like this project is going to help me understand a lot of concepts both from C++ and game engines perspective. I am really excited for this!</p><p>This post being the first post of mine on Medium, I feel like it was a good introduction to what I was doing in my last 2 years, and what I will be doing for the near future. So, expect some good stuff as I get deeper into developing my engine!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uCA2Qsml51SxRu66.jpg" /><figcaption>Picture is representative, not actual footage from the engine.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ce0421d41cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>