This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using SFML.Graphics; | |
using SFML.System; | |
using SFML.Window; | |
var window = new RenderWindow(new VideoMode(800, 600), "SFML Test", Styles.None); | |
window.SetFramerateLimit(30); | |
var font = new Font("C:/Windows/Fonts/Arial.ttf"); | |
var text = new Text(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <deque> | |
#include <mutex> | |
#include <SFML/Audio.hpp> | |
#include <SFML/Graphics.hpp> | |
class MusicVisualizer : public sf::Music, public sf::Drawable | |
{ | |
public: | |
void update(const sf::Time& deltaTime); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SFML/Graphics.hpp> | |
class PausableClock | |
{ | |
sf::Clock m_clock; | |
sf::Time m_elapsed; | |
bool m_isRunning = false; | |
float m_skewFactor = 1.f; | |
public: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
// Entity class | |
class Entity | |
{ | |
public: | |
// List of components associated with the entity | |
vector<class Component *> components; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SFML/Window.hpp> | |
#include <iostream> | |
#include <Windows.h> | |
LONG_PTR originalsfmlcallback = 0x0; | |
LRESULT CALLBACK mycallback(HWND handle, UINT message, WPARAM wParam, LPARAM lParam) | |
{ | |
if(message == WM_DROPFILES) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find_package(zlib) | |
if (NOT zlib_FOUND) | |
message("Fetch zlib content instead...") | |
include(FetchContent) | |
FetchContent_Declare( | |
zlib | |
GIT_REPOSITORY "https://github.com/madler/zlib.git" | |
GIT_TAG "v1.2.11" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <SFML/Graphics.hpp> | |
int main() | |
{ | |
auto window = sf::RenderWindow{{800, 600, 32}, "SFML Window"}; | |
window.setFramerateLimit(60); | |
auto font = sf::Font{}; | |
if (!font.loadFromFile("OpenSans.ttf")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required (VERSION 2.8.12) | |
# set a default build type if none was provided | |
# this has to be done before the project() instruction! | |
if(NOT CMAKE_BUILD_TYPE) | |
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build (Debug or Release)" FORCE) | |
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <streambuf> | |
#include <ostream> | |
#include "spdlog/spdlog.h" | |
template<class Element = char, class Trait = std::char_traits<Element>> | |
class StreamLogger : public std::basic_streambuf<Element, Trait> | |
{ | |
public: | |
StreamLogger(std::ostream& stream, std::shared_ptr<spdlog::logger> logger) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SFML/Network.hpp> | |
#include <iostream> | |
#include <csignal> | |
#include <atomic> | |
#include <string> | |
using namespace std::string_literals; | |
namespace | |
{ |
NewerOlder