This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add alpha to RGB color | |
* @param rgb | |
* @param a | |
* @return | |
*/ | |
public static function addAlpha( rgb:uint, a:uint = 0xFF ):uint | |
{ | |
return (a << 24) | rgb; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ================================================================================================= | |
// | |
// based on starling.text.TextField | |
// modified to use text layout framework engine for rendering text | |
// | |
// ================================================================================================= | |
package starling.extensions | |
{ | |
import flash.display.BitmapData; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package starling.extensions.DistanceFieldFont | |
{ | |
import flash.geom.Rectangle; | |
import flash.utils.Dictionary; | |
import starling.display.Image; | |
import starling.text.BitmapChar; | |
import starling.textures.Texture; | |
import starling.textures.TextureSmoothing; | |
import starling.utils.HAlign; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public const c0:Number = 2.515517; | |
public const c1:Number = 0.802853; | |
public const c2:Number = 0.010328; | |
public const d1:Number = 1.432788; | |
public const d2:Number = 0.189269; | |
public const d3:Number = 0.001308; | |
/** | |
* 正态分布的随机数.a控制波形的顶点,b控制波形的扁度 | |
* @param a 如a是0即,随机出0的机率会大到-1,1,-2,2,然后递减 | |
* @param b 如b是2即,随机出>-2和<2之间的数字机率最大(注意这里的b 是方差,等于标准差的平方) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.rayyee; | |
import org.apache.http.HttpStatus; | |
import org.apache.http.client.methods.CloseableHttpResponse; | |
import org.apache.http.client.methods.HttpPost; | |
import org.apache.http.impl.client.CloseableHttpClient; | |
import org.apache.http.impl.client.HttpClients; | |
import org.apache.http.util.EntityUtils; | |
import java.io.File; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstddef> | |
const char *advanceP(const char *&p, size_t n) | |
{ | |
const char *pp = p; | |
p += n; | |
return pp; | |
} | |
typedef struct | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* coroutine.h | |
* | |
* Coroutine mechanics, implemented on top of standard ANSI C. See | |
* http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html for | |
* a full discussion of the theory behind this. | |
* | |
* To use these macros to define a coroutine, you need to write a | |
* function that looks something like this. | |
* | |
* [Simple version using static variables (scr macros)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
attribute vec4 a_position; | |
attribute vec3 a_normal; | |
attribute vec2 a_texCoord; | |
attribute vec2 a_texCoord1; | |
varying vec2 v_texture_coord; | |
varying vec2 v_texture_coord1; | |
// height of the wave in world units. | |
uniform float u_amplitude; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
attribute vec4 a_position; | |
attribute vec2 a_texCoord; | |
attribute vec2 a_texCoord1; | |
attribute vec2 a_texCoord2; | |
attribute vec4 a_color; | |
varying vec4 v_color; | |
varying vec2 v_texture_coord; | |
varying vec2 v_texture_coord1; | |
varying vec2 v_texture_coord2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef GL_ES | |
varying mediump vec2 v_texture_coord; | |
varying mediump vec2 v_texture_coord1; | |
#else | |
varying vec2 v_texture_coord; | |
varying vec2 v_texture_coord1; | |
#endif | |
uniform sampler2D lightmap; | |
void main(void) |