Skip to content

Instantly share code, notes, and snippets.

Avatar
🤔
Thinking

Alisson Nunes Alynva

🤔
Thinking
View GitHub Profile
@Alynva
Alynva / jogo-da-velha-2.c
Last active Jul 13, 2017
Um jogo da velha simples utilizando CGI
View jogo-da-velha-2.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
// Declaração de variáveis
char *dado = NULL;
char tabuleiro[3][3];
// Inicialização do tabuleiro
tabuleiro[0][0] = '-'; tabuleiro[0][1] = '-'; tabuleiro[0][2] = '-';
@Alynva
Alynva / data_structures.h
Last active Jul 1, 2017 — forked from sp0oks/data_structures.h
Abstract data types library for C++
View data_structures.h
/*My personal project of a library that includes different types of template container structures.
Basically a rework of C++'s STL.
It is an open source project and so if you feel like contributing to it(testing, fixing and/or adding new stuff) just send me an
email with the subject "data structures gist contribution" listing what you did or want to do and I'll have it added with due
credit (just check my profile for the email address).
Biblioteca criada para o uso de diferentes tipos abstratos de dados dinâmicos,
partindo do conceito de listas encadeadas para posterior reuso em projetos.
@Alynva
Alynva / letreiro.cpp
Last active Jun 25, 2017
Um programa louco feito em alguma madrugada qualquer
View letreiro.cpp
#include <iostream>
#include <map>
#include <windows.h>
#include <vector>
#include <string>
#include <sstream>
using namespace std;
// Move o ponteiro de escrita
@Alynva
Alynva / GeoA.h
Last active Jun 27, 2017
Uma biblioteca de geometria, adaptada da p5.js (JavaScript) para C++.
View GeoA.h
#ifndef __Geometria_Alynva__
#define __Geometria_Alynva__
namespace GeoA {
const double TWO_PI = 6.28318530717958647693;
const double PI = 3.14159265358979323846;
const double HALF_PI = 1.57079632679489661923;
const double QUARTER_PI = 0.7853982;
double random(); // [0.0 .. 1.0]
@Alynva
Alynva / teste_fps.cpp
Created Jun 1, 2017
Um código simples pra testar o framerate no SDL
View teste_fps.cpp
#include "SDL2/SDL.h"
#include <stdio.h>
// How many frames time values to keep
// The higher the value the smoother the result is...
// Don't make it 0 or less :)
#define FRAME_VALUES 10
// An array to store frame times:
Uint32 frametimes[FRAME_VALUES];
@Alynva
Alynva / to_string.cpp
Last active Oct 29, 2017
Convert anything to string
View to_string.cpp
#include <string> // std::string
#include <iostream> // std::cout
#include <sstream> // std::ostringstream
using namespace std;
template <typename T>
string to_string ( T Number ) {
string Result;
ostringstream convert;
@Alynva
Alynva / funcs.cpp
Created May 21, 2017
A function as a parameter of another function
View funcs.cpp
#include <iostream>
using namespace std;
int f1(int n) {
return n * 3;
}
int f2(int f(int), int n) {
return f(n) - 2;
@Alynva
Alynva / SDL Message Box.cpp
Created Apr 8, 2017
A little example of SDL Message Box
View SDL Message Box.cpp
#include "SDL.h"
#include <windows.h>
int main(int argc, char *argv[]) {
const SDL_MessageBoxButtonData buttons[] = {
{ /* .flags, .buttonid, .text */ 0, 0, "no" },
{ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, 1, "yes" },
{ SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT, 2, "cancel" },
};
const SDL_MessageBoxColorScheme colorScheme = {
@Alynva
Alynva / jogo-de-pintar.c
Created Feb 11, 2017
Jogo de Pintar (Paint) em CGI
View jogo-de-pintar.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#define MAXPIXELSTRING 71910
#define MAXPIXEL 4794
int main() {
int i = 0;
int j, k;
@Alynva
Alynva / jogo-da-velha.c
Created Feb 11, 2017
Jogo da Velha em CGI
View jogo-da-velha.c
#include <stdio.h>
#include <stdlib.h>
int main() {
// 0 = não jogado
// 1 = jogado o "O"
// 2 = jogado o "X"
char* dados = NULL;