Skip to content

Instantly share code, notes, and snippets.

View HiromichiYamada's full-sized avatar

Hiromichi Yamada HiromichiYamada

View GitHub Profile
@HiromichiYamada
HiromichiYamada / CreateTextImage
Created October 18, 2024 11:15
テキストだけの仮画像を生成するSiv3D用コード
// Siv3D: 仮画像ファイルを作成するツールです
// Main.cpp として使ってください
# include <Siv3D.hpp> // Siv3D v0.6.15
void createTextImage(String text, Image& image, Font& font, String filename)
{
// https://zenn.dev/reputeless/books/siv3d-documentation/viewer/tutorial-image
constexpr Vec2 basePos{ 20, 20 };
@HiromichiYamada
HiromichiYamada / Siv3D-TypingGame-Main.cpp
Last active September 29, 2024 06:26
Siv3Dのタイピングゲームのコードを拡張できるようにしたサンプル実装。元→https://siv3d.github.io/ja-jp/samples/games/#5-%E3%82%BF%E3%82%A4%E3%83%94%E3%83%B3%E3%82%B0%E3%82%B2%E3%83%BC%E3%83%A0
# include <Siv3D.hpp>
// Siv3D 0.6.15
// My basic code for Typing Game Example.
enum class AppState {
Title,
Countdown,
Typing,
};
@HiromichiYamada
HiromichiYamada / Unlit-CastShadow.shader
Created June 17, 2021 14:17 — forked from pigeon6/Unlit-CastShadow.shader
Unlit texture shader which casts shadow on Forward/Defered
// Unlit texture shader which casts shadow on Forward/Defered
Shader "Unlit/Texture CastShadow" {
Properties {
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}
SubShader {
Tags {"Queue"="Geometry" }
LOD 100
@HiromichiYamada
HiromichiYamada / 360_3840x1920
Created January 31, 2019 10:54
OpenShot Profile for 360 movie (3840x1920)
description=360(3840x1920)
frame_rate_num=60000
frame_rate_den=1001
width=3840
height=1920
progressive=1
sample_aspect_num=1
sample_aspect_den=1
display_aspect_num=2
display_aspect_den=1
@HiromichiYamada
HiromichiYamada / class_as_namespace.swift
Created November 27, 2015 06:05
画面毎にnamespace的なclassを使うと便利じゃないかと思いついた
import UIKit
class Contents {
enum Section: Int {
case Top = 0
case Contents = 1
case Notes = 2
}
@HiromichiYamada
HiromichiYamada / MyInitViewController.swift
Last active August 29, 2015 14:07
override initializers for swift with Xcode 6.0.1
// Xcode 6.0.1
class MyInitViewController: UIViewController {
override init() {
// init parameters here.
super.init()
}
@HiromichiYamada
HiromichiYamada / calcScreenRatios.swift
Last active August 29, 2015 14:06
Calculate Screen Ratios.
// Euclidean algorithm for GCD
func euclid( a:Int, b:Int ) -> Int{
var aa : Int = a
var bb : Int = b
var rr : Int = aa % bb
while rr != 0 {
aa = bb
bb = rr
rr = aa % bb
}
@HiromichiYamada
HiromichiYamada / perfect_insider.c
Last active August 29, 2015 14:04
ビットのすべてが立っている数値を生成
#include <stdio.h>
int main(){
int flag = ~0; // 全部1になっている数値はこれでOK?
printf("flag = %x\n", flag); // --> "flag = ffffffff" .. OKっぽい.
}
// THE PERFECT INSIDER -- http://www.amazon.co.jp/dp/4062639246
@HiromichiYamada
HiromichiYamada / xib_iphone_ipad.md
Last active August 29, 2015 14:02
xib iphone/ipad

コンバート

  • InterfaceBuilder3

     "com.apple.InterfaceBuilder3.CocoaTouch.XIB"
    
     "com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB"
    
@HiromichiYamada
HiromichiYamada / file0.txt
Created May 19, 2014 13:10
UIViewのconvertRect:toView:に関するメモ ref: http://qiita.com/octi/items/5feee79492c8776c3761
CGRect frame = [viewA convertRect:viewB.frame toView:viewA];