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
unit SFUtils; | |
{$mode objfpc}{$H+} | |
interface | |
uses | |
Classes, SysUtils; | |
type |
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
program watergold; | |
uses math; | |
var | |
gold : array [1..500] of Integer; | |
chains : array [1..1000] of record | |
a, b : Integer; | |
end; | |
e, v, i, j : Integer; | |
best2, best3, best4 : Integer; | |
connected : array[1..1000, 1..1000] of boolean; |
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 <stdio.h> | |
#include <string.h> | |
unsigned fnv_hash(const char * str) | |
{ | |
unsigned hash = 2166136261u; | |
unsigned i; | |
for (i = 0u; str[i]; ++i) | |
hash = (hash * 16777619u) ^ str[i]; | |
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
/* | |
* File: main.cpp | |
* Author: frex | |
* | |
* Created on February 19, 2016, 9:56 PM | |
*/ | |
#include <vector> | |
#include <string> | |
#include <iostream> |
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> | |
#include <random> | |
#include <vector> | |
const float kSquareSize = 32.f; | |
const int kBoardWidthCells = 10; | |
const int kBoardHeightCells = 10; | |
const int kUpdatesPerTick = 20; |
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
#include <SFML/Graphics.hpp> | |
#include <cstdio> | |
static void loadXorTextureInto(sf::Image& img) | |
{ | |
img.create(256u, 256u); | |
for(unsigned x = 0u; x < img.getSize().x; ++x) | |
for(unsigned y = 0u; y < img.getSize().y; ++y) | |
img.setPixel(x, y, sf::Color(x ^ y, x ^ y, x ^ y)); | |
} |
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> | |
static void loadXorTextureInto(sf::Texture& tex) | |
{ | |
sf::Image img; | |
img.create(256u, 256u); | |
for(unsigned x = 0u; x < img.getSize().x; ++x) | |
for(unsigned y = 0u; y < img.getSize().y; ++y) | |
img.setPixel(x, y, sf::Color(x ^ y, x ^ y, x ^ y)); |
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> | |
class Ensurer | |
{ | |
public: | |
void bind(int ptr, bool texturing) | |
{ | |
std::printf("bind(%d, %s)\n", ptr, texturing ? "true" : "false"); | |
if(ptr != m_ptr) |
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> | |
int main(int argc, char ** argv) | |
{ | |
sf::RenderWindow app(sf::VideoMode(640u, 480u), "DoubleClick"); | |
app.setFramerateLimit(60u); | |
while(app.isOpen()) | |
{ | |
sf::Event eve; | |
while(app.pollEvent(eve)) |
OlderNewer