This file contains hidden or 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
# Execute with: | |
# godot --no-window -s aoc2021-day1.gd | |
extends SceneTree | |
func read_ints(file: String) -> Array: | |
var ints = [] | |
var f = File.new() | |
f.open(file, File.READ) | |
if f.is_open(): |
This file contains hidden or 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
// Pins used for this | |
#define LED_PIN 13 | |
#define BUZZER_PIN 11 | |
// The time in milliseconds for short signals | |
#define TIME_UNIT 100 | |
// Frequency used | |
// For classic codes both should match | |
#define FREQUENCY_LONG 220 | |
#define FREQUENCY_SHORT 440 |
This file contains hidden or 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> | |
#include <vector> | |
int main() | |
{ | |
sf::RenderWindow window({640, 480}, "Hexagons", sf::Style::Default, sf::ContextSettings(0, 0, 8)); | |
// We're simply abusing a `CircleShape` here, | |
// since a circle defined by 6 points IS a hexagon! | |
sf::CircleShape hexagon(25, 6); |
This file contains hidden or 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
/** | |
* @file conext.h | |
* @author Mario Liebisch <[email protected]> | |
* @section LICENSE | |
* | |
* © 2011 All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions are met: | |
* |
This file contains hidden or 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> | |
#include <sstream> | |
#include <iomanip> | |
int main(int argc, char **argv) { | |
sf::RenderWindow window(sf::VideoMode(300, 100), "Timer Test", sf::Style::Default); | |
window.setVerticalSyncEnabled(true); | |
sf::Font font; | |
font.loadFromFile("Arial.ttf"); |
This file contains hidden or 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> | |
#include <sstream> | |
class RenderWindowStats : public sf::RenderWindow { | |
public: | |
RenderWindowStats() : RenderWindow({640, 480}, "Test") { | |
} | |
void draw(sf::Drawable &dr, sf::RenderStates states = sf::RenderStates()) { | |
++mDrawCallsTemp; |
This file contains hidden or 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
std::string getSelf() | |
{ | |
char buf[1024] = { 0 }; | |
#ifdef WIN32 | |
DWORD ret = GetModuleFileNameA(NULL, buf, sizeof(buf)); | |
if (ret && ret != sizeof(buf)) { | |
std::string res(buf); | |
for (auto &c : res) | |
if (c == '\\') | |
c = '/'; |
This file contains hidden or 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
/* | |
Usage: | |
* Load a font, if you don't have one yet | |
* Create the `FpsMeter` object | |
* Optional: Set a position | |
* Draw the meter | |
sf::Font font; | |
font.loadFromFile("myfont.ttf"); |
This file contains hidden or 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 <functional> | |
#include <string> | |
// Definee an `Observable` class. | |
// This works as a wrapper around a variable of any type. | |
// Once it's assigned a new value, a predefined callback is defined to react on this. | |
template<typename T> | |
class Observable { | |
public: |
This file contains hidden or 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> | |
int main(int argc, char **argv) { | |
sf::RenderWindow window(sf::VideoMode(800, 600), "Circle Text", sf::Style::Default); | |
window.setVerticalSyncEnabled(true); | |
sf::Font font; | |
font.loadFromFile("arial.ttf"); | |
sf::Text text("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut ultrices ante. Aliquam ornare eu enim eget accumsan.", font); |
NewerOlder