Skip to content

Instantly share code, notes, and snippets.

@f-space
f-space / VertexTransformation.cs
Created July 11, 2016 13:40
頂点変換アニメーションのUnityエディタ拡張
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityObject = UnityEngine.Object;
@f-space
f-space / UnityEditorPrefs.ps1
Created August 26, 2016 10:08
UnityのEditorPrefsで保存した値を操作するPowerShellスクリプト
Set-Variable -Name "DefaultUnityEditorVersion" -Value 5 -Option Constant -Scope Global
function global:Get-UnityEditorPrefPath()
{
[CmdletBinding()]
[OutputType([string])]
param
(
[Parameter(Mandatory=$false)]
[int] $Version = $DefaultUnityEditorVersion
@f-space
f-space / Program.cs
Created September 26, 2016 09:18
DXライブラリで三角形を回転させるサンプル (C#)
using DxLibDLL;
using System;
using System.Diagnostics;
namespace DxLibTest
{
public static class Program
{
private static readonly float DegToRad = (float)(Math.PI / 180.0);
@f-space
f-space / PluginSystem.ts
Created December 2, 2016 09:11
RPGツクールMVでモジュールを管理するためのプラグイン。(TypeScript)
/*!
/*:
* @plugindesc プラグインの管理システム
* @author F_
*
* @help
* プラグイン開発をサポートするプラグイン。
*
* 必ず最初に実行すること。
*
@f-space
f-space / PluginSystem.js
Created December 2, 2016 09:13
RPGツクールMVでモジュールを管理するためのプラグイン。(JavaScript)
/*!
/*:
* @plugindesc プラグインの管理システム
* @author F_
*
* @help
* プラグイン開発をサポートするプラグイン。
*
* 必ず最初に実行すること。
*
@f-space
f-space / Actor.cs
Created October 15, 2017 10:53
http://filaaas216.hatenablog.com/entry/2017/10/15/021000 へのコメント用サンプルコード
using UnityEngine;
public class Actor : MonoBehaviour
{
// Rigidbodyと大きさを受け取り、画面内に収まるように位置と速度を調節する
protected void EnsureInScreen(Rigidbody2D rigidbody, Vector2 size)
{
// いくつもの前提の下に動作することに注意
// 前提1:メインカメラはZ軸正方向を向いている
// 前提2:画像の中心位置とオブジェクトの位置が一致している
@f-space
f-space / blit.js
Created October 23, 2017 09:41
WebGLによるImageのコピー
const VS_SRC = `
attribute vec4 position;
attribute vec2 texcoord;
varying vec2 vTexcoord;
void main(void){
gl_Position = position;
vTexcoord = texcoord;
}
`;
@f-space
f-space / tsconfig-webpack-plugin.js
Last active June 14, 2018 11:58
Webpack resolver plugin for tsconfig.json (baseUrl, paths, rootDirs).
const fs = require('fs');
const { posix, win32 } = require('path');
const path = (process.platform !== 'win32') ? posix : {
resolve() { return replaceSep(win32.resolve.apply(this, arguments)); },
relative() { return replaceSep(win32.relative.apply(this, arguments)); },
normalize() { return replaceSep(win32.normalize.apply(this, arguments)); },
join() { return replaceSep(win32.join.apply(this, arguments)); },
dirname() { return replaceSep(win32.dirname.apply(this, arguments)); },
};
@f-space
f-space / mixin.ts
Created December 18, 2017 11:03
TypeScript 'mixin' function for vue-class-component.
import { Vue } from 'vue/types/vue';
import { ComponentOptions } from 'vue/types/options';
type VueCtor<V extends Vue> = { new(...args: any[]): V };
type VueClass<V extends Vue> = VueCtor<V> & typeof Vue;
type MixinType<V extends Vue> = ComponentOptions<V> | VueClass<V>;
function mixin<
T extends VueClass<Vue>,
M1 extends Vue>(
@f-space
f-space / vuex-class-module.ts
Last active March 18, 2019 19:48
Decorators for class-style vuex modules.
import * as Vuex from 'vuex';
import 'reflect-metadata';
export const TypeSymbol = Symbol('type');
export interface IModule<R = any> {
readonly $state: any;
readonly $getters: any;
readonly $commit: Vuex.Commit;
readonly $dispatch: Vuex.Dispatch;