Skip to content

Instantly share code, notes, and snippets.

@dev001hajipro
dev001hajipro / SDL_Emscripten_pixel manipulation_SDL_LockTexture_SDL_MapRGBA
Last active August 24, 2021 01:06
pixel manipulation: SDL_LockTexture and SDL_MapRGBA sample on Emscripten.
pixel manipulation: SDL_LockTexture and SDL_MapRGBA sample on Emscripten.
# https://gamedev.stackexchange.com/questions/98641/how-do-i-modify-textures-in-sdl-with-direct-pixel-access
bellow code dont run.
SDL_PixelFormat pixelFormat;
pixelFormat.format = format;
# rewrite my code.
ctx->pixelFormat = SDL_AllocFormat(SDL_PIXELFORMAT_RGBA8888);
*p = SDL_MapRGBA(ctx->pixelFormat, 255, 0, 0, 255);
@dev001hajipro
dev001hajipro / typinggame.py
Created July 13, 2018 21:29
Python3+Pygame typing game
# -*- coding: utf-8 -*-
""" タイピングゲーム """
import random
import sys
import pygame
def select_word():
@dev001hajipro
dev001hajipro / build.bat
Created April 24, 2017 07:47
emscripten draw pixels and scale by SDL_RenderCopy
emcc test_pixel2.c ^
-O2 ^
-Wall -Wextra -pedantic ^
-s USE_SDL=2 ^
-s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS="[""png""]" ^
-s USE_SDL_TTF=2 ^
--preload-file assets ^
-o test_pixel2.html
@dev001hajipro
dev001hajipro / install.txt
Last active September 3, 2020 10:49
Windows10でUnity2020.1.4f1にAndroid10.0(Android SDK Platform 29)をインストールする方法
Unity2020.1.4f1でビルドしたら、Google Play Consoleでエラーが出たので調べました。
管理者権限でcmdコマンドプロンプト起動して以下のコマンドを入れていく。
set java_home="C:\Program Files\Unity\Hub\Editor\2020.1.4f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK"
set android_home="C:\Program Files\Unity\Hub\Editor\2020.1.4f1\Editor\Data\PlaybackEngines\AndroidPlayer"
cd "C:\Program Files\Unity\Hub\Editor\2020.1.4f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\bin"
sdkmanager.bat --update
sdkmanager "platform-tools" "platforms;android-29"
@dev001hajipro
dev001hajipro / PIC16F628A_led_blink.c
Created May 16, 2020 13:47
MCLREをONにしているので、リセット回路を追加する必要がある。
/*
* GccApplication1.c
*
* Created: 2020/04/24 19:51:08
* Author : dev001hajipro
8-PDIP
PB5 1| tiny13 8|VCC
A3 PB3 2| |PB2 (SCK A1
A2 PB4 3| |PB1 (MISO
@dev001hajipro
dev001hajipro / build.bat
Created April 24, 2017 08:07
emscripten: draw pixels with SDL_UpdateTexture
emcc test_pixel.c ^
-O2 ^
-s USE_SDL=2 ^
-s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS="[""png""]" ^
-s USE_SDL_TTF=2 ^
--preload-file assets ^
-o test_pixel.html
# a initial term
# d common_difference
def arithmetic_progression(a = 0, d = 0, n = 1):
print(a + (d * (n-1)))
return a + (d * (n-1))
def main():
nnn = [arithmetic_progression(5, 2, i) for i in range(1,10)]
print(nnn)
@dev001hajipro
dev001hajipro / Mux8Way16.hdl
Created December 23, 2018 10:55
nand2tetris Mux8Way16.hdl
// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by Nisan and Schocken, MIT Press.
// File name: projects/01/Mux8Way16.hdl
/**
* 8-way 16-bit multiplexor:
* out = a if sel == 000
* b if sel == 001
* etc.
@dev001hajipro
dev001hajipro / p5.js_snakegame.js
Created November 11, 2018 12:16
p5.js_snakegame.js
// https://www.youtube.com/watch?v=AaGK-fj-BAM
const scale = 20;
class Snake {
constructor() {
this.x = 0;
this.y = 0;
this.xspeed = 1;
this.yspeed = 0;
this.total = 0;
this.tail = [];