Skip to content

Instantly share code, notes, and snippets.

Avatar

Wellington Domiciano wldomiciano

View GitHub Profile
@wldomiciano
wldomiciano / sdl2-setup.ps1
Last active Sep 8, 2020
Download and install SDL 2 and extra Visual Studio development libraries
View sdl2-setup.ps1
Set-PSDebug -off
$SDL2_DIR = "SDL_TEST"
$TEMP = "SDL_TEMP"
$SDL2_VERSIONS = @{
"SDL" = "2.0.10";
"SDL_image" = "2.0.5";
"SDL_mixer" = "2.0.4";
"SDL_net" = "2.0.1";
@wldomiciano
wldomiciano / list-tables-with-a-column-in-a-db.sql
Last active May 15, 2020
Lista todas as tabelas que contenham colunas com um certo nome em um banco de dados em MySQL
View list-tables-with-a-column-in-a-db.sql
SELECT DISTINCT TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME = 'your_column_name'
AND TABLE_SCHEMA = 'your_database_name';
@wldomiciano
wldomiciano / game.c
Last active Apr 16, 2020
Demonstração das funções para lidar com eventos de teclado usando SDL 2 com um protótipo simples, os exemplos estão descritos nesta postagem: https://wldomiciano.com/sdl-2-como-lidar-com-eventos-unicos-do-teclado/
View game.c
// Testado no MinGW64
// gcc -Wall -Wextra -Wpedantic -Wno-unused-parameter game.c `sdl2-config --cflags --libs`
#include <SDL.h>
SDL_Window* window;
SDL_Renderer* renderer;
SDL_bool quit = SDL_FALSE;
// A tecla está pressionada?
@wldomiciano
wldomiciano / install-vscode-and-chrome.sh
Last active Aug 31, 2019
Script para instalar os Visual Studio Code e o Google Chrome no Ubuntu
View install-vscode-and-chrome.sh
#!/usr/bin/env sh
# Baixa a chave da Microsoft
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
# Baixa a chave do Google
wget -qO- https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
# Move a chave da Microsoft pro lugar certo e remove arquivo temporário
sudo install -o root -g root -m 644 packages.microsoft.gpg /usr/share/keyrings/ && rm packages.microsoft.gpg
View vector.c
// compiles with
// gcc vector.c -Wall -Wextra -Wpedantic `sdl2-config --cflags --libs` -lm
#include <SDL.h>
#include <math.h>
const double PI = 3.14159265358979323846264338327950288;
typedef struct {
double x, y;
@wldomiciano
wldomiciano / circle-drawing.c
Created May 23, 2019
Drawing a normal and filled circle with SDL 2
View circle-drawing.c
#include <SDL.h>
SDL_Window* window;
SDL_Renderer* renderer;
void drawCircle(int xc, int yc, int x, int y) {
SDL_RenderDrawPoint(renderer, xc + x, yc + y);
SDL_RenderDrawPoint(renderer, xc - x, yc + y);
SDL_RenderDrawPoint(renderer, xc + x, yc - y);
@wldomiciano
wldomiciano / remove-pinned-app-from-start-menu.ps1
Last active Nov 25, 2018
Remove all pinned apps from start menu in Windows 10
View remove-pinned-app-from-start-menu.ps1
(New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() |
%{ $_.Verbs() } | ?{ $_.Name -match 'Un.*pin from Start' } | %{ $_.DoIt() }
@wldomiciano
wldomiciano / sdl2-ttf-basico.c
Last active Sep 12, 2018
Exemplo básico usando SDL 2 com SDL_ttf
View sdl2-ttf-basico.c
// Testado com MinGW64:
// gcc -Wall -Wextra -Wpedantic -Wno-unused-parameter test0.c `sdl2-config --cflags --libs` -lSDL2_ttf
#include <SDL.h>
#include <SDL_ttf.h>
SDL_Window *window;
SDL_Surface *surface;
TTF_Font *font;
int main(int argc, char *argv[]) {
@wldomiciano
wldomiciano / sdl2-ttf-exemplo-com-window-surface.c
Last active Sep 12, 2018
Exemplo usando SDL 2 com SDL_ttf usando window surface
View sdl2-ttf-exemplo-com-window-surface.c
// Testado com MinGW64:
// gcc -Wall -Wextra -Wpedantic -Wno-unused-parameter test1.c `sdl2-config --cflags --libs` -lSDL2_ttf
#include <SDL.h>
#include <SDL_ttf.h>
SDL_Window *window;
SDL_Surface *surface;
TTF_Font *font;
#define MAX_LENGTH 1024
@wldomiciano
wldomiciano / sdl2-tff-exemplo-com-renderer.c
Created Sep 12, 2018
Exemplo usando SDL 2 com SDL_ttf usando renderer
View sdl2-tff-exemplo-com-renderer.c
// Testado com MinGW64:
// gcc -Wall -Wextra -Wpedantic -Wno-unused-parameter test1.c `sdl2-config --cflags --libs` -lSDL2_ttf
#include <SDL.h>
#include <SDL_ttf.h>
SDL_Window *window;
SDL_Renderer *renderer;
TTF_Font *font;
#define MAX_LENGTH 1024
You can’t perform that action at this time.