페이지 플리퍼! Android/iOS Game: Page Flipper!!

iphone1136_640__01

새로운 스타일의 심플한 캐주얼 게임! Page Flipper를 경험해보세요!
한 장씩 넘어오는 페이지가 찢겨지지 않도록 캐릭터를 이동하며 큐브를 획득해 보세요!
빠르고 정확한 판단력을 가진 당신이라면 더 많은 페이지로 진행할 수 있습니다.
순발력 있게 큐브를 획득하면 할수록 더 높은 레벨의 캐릭터를 가질 수 있습니다.
의외의 긴장감을 주는 중독성 최고의 게임 Page Flipper를 지금 바로 즐겨보세요!

The NEW style of “Simple Casual” game! How quick are your reflexes? Join Page Flipper and test your reflexes.
Quickly step on the correct square to avoid being crushed by the flipping page!
With quick and accurate instinct, you can flip more pages.
Level up your character by collecting more cubes on the page as fast as possible.
Incredibly addictive game with tensions.
Play Page Flipper and challenge yourself.

       

Android Play Store

Android Play Store

AppStore

iOS AppStore

카테고리: game | 태그: , , , , , | 댓글 남기기

Unity3d에서 sprite 리스트를 자동 등록하는 Editor기능 만들기 (to generate sprite list automatically)

다음과 같은 스프라이트리스트를 가진 스크립트있다고 가정:

// Assets/Scripts/SpriteListScript.cs

public class SpriteListScript : MonoBehaviour {
    public Sprite[] spriteList;

    void Start() {
        // ...
    }
    
    // ...
}

Assets/Editor폴더안에 editor용 스크립트를 만든다:

// Assets/Editor/SpriteListScriptEditor.cs

[CustomEditor(typeof(SpriteListScript))]
public class SpriteListScriptEditor : Editor {
    public override void OnInspectorGUI() {
        DrawDefaultInspector();
        var ps = target as SpriteListScript;
        if (ps != null) {
            if(GUILayout.Button("Update Resources")) {
                UpdateSprites(ps);
            }
        }
    }

    void UpdateSprites(SpriteListScript ps) {
        var filepath = "Assets/Textures/sprites/numbers.png"; // path to texture containing sprites.
        var sprites = AssetDatabase.LoadAllAssetRepresentationsAtPath(filepath);

        if (sprites != null) {
            var l = new List<Sprite>(sprites.Length);
            foreach(var i in sprites) {
                var s = i as Sprite;
                l.Add(s);
            }

            l.Sort((x,y) => { return x.name.CompareTo(y.name); });
            ps.numberSprites = l.ToArray();
        } else {
            ps.numberSprites = new Sprite[0] {};
        }
    }
}
카테고리: unity3d | 태그: , , | 댓글 남기기

페이지 플리퍼! Android Game: Page Flipper published today!

pageflipper144

새로운 스타일의 심플한 캐주얼 게임! Page Flipper를 경험해보세요!
한 장씩 넘어오는 페이지가 찢겨지지 않도록 캐릭터를 이동하며 큐브를 획득해 보세요!
빠르고 정확한 판단력을 가진 당신이라면 더 많은 페이지로 진행할 수 있습니다.
순발력 있게 큐브를 획득하면 할수록 더 높은 레벨의 캐릭터를 가질 수 있습니다.
의외의 긴장감을 주는 중독성 최고의 게임 Page Flipper를 지금 바로 즐겨보세요!

The NEW style of “Simple Casual” game! How quick are your reflexes? Join Page Flipper and test your reflexes.
Quickly step on the correct square to avoid being crushed by the flipping page!
With quick and accurate instinct, you can flip more pages.
Level up your character by collecting more cubes on the page as fast as possible.
Incredibly addictive game with tensions.
Play Page Flipper and challenge yourself.

다운로드 –>>    

카테고리: game | 태그: , , , , | 댓글 남기기

샘플코드로 보는 C#기능들

Constraints on Type Parameters

public static void OpTest<T>(T s, T t) where T : class
{
   System.Console.WriteLine(s == t);
}
static void Main()
{
   string s1 = "target";
   System.Text.StringBuilder sb =
               new System.Text.StringBuilder("target");
   string s2 = sb.ToString();
   OpTest(s1, s2);
}

Anonymous Types

var v = new { Amount = 108, Message = "Hello" };
Console.WriteLine(v.Amount + v.Message);

Lambda Expressions

delegate int del(int i);
static void Main(string[] args)
{
   del myDelegate = x => x * x;
   int j = myDelegate(5); //j = 25
}

LINQ Query Expressions

class LINQQueryExpressions
{
   static void Main()
   {

      // Specify the data source.
      int[] scores = new int[] { 97, 92, 81, 60 };

      // Define the query expression.
      IEnumerable scoreQuery =
         from score in scores
         where score > 80
         select score;

      // Execute the query.
      foreach (int i in scoreQuery)
      {
         Console.Write(i + " ");
      }
   }
}
// Output: 97 92 81

yield

using System.Collections;

public class PowersOf2
{
   static void Main()
   {
      // Display powers of 2 up to the exponent of 8:
      foreach (int i in Power(2, 8))
      {
         Console.Write("{0} ", i);
      }
   }

   static IEnumerable Power(int number, int exponent)
   {
      int result = 1;

      for (int i = 0; i < exponent; i++)
      {
         result = result * number;
         yield return result;
      }
   }

   // Output: 2 4 8 16 32 64 128 256
}

var

var i = 10; // implicitly typed
int i = 10; //explicitly typed

using statement

using ASimpleName = Dictionary<string, Dictionary<string, List>>;

using block

using (DbTransaction tran = new DbTransaction())
{
   DoQuery("...");
   DoQuery("...");
}

volatile

class IfYouThinkYouUnderstandVolatile
{
   volatile int x, y;

   void Test1() // Executed on one thread
   {
      x = 1; // Volatile write (release-fence)
      int a = y; // Volatile read (acquire-fence)
      ...
   }

   void Test2() // Executed on another thread
   {
      y = 1; // Volatile write (release-fence)
      int b = x; // Volatile read (acquire-fence)
      ...
   }
}

?? operator

class NullCoalesce
{
   static int? GetNullableInt()
   {
      return null;
   }

   static string GetStringValue()
   {
      return null;
   }

   static void Main()
   {
      // ?? operator example.
      int? x = null;

      // y = x, unless x is null, in which case y = -1.
      int y = x ?? -1;

      // Assign i to return value of method, unless
      // return value is null, in which case assign
      // default value of int to i.
      int i = GetNullableInt() ?? default(int);

      string s = GetStringValue();
      // ?? also works with reference types.
      // Display contents of s, unless s is null,
      // in which case display "Unspecified".
      Console.WriteLine(s ?? "Unspecified");
   }
}

Verbatim string literals

"c:\\program files\\oldway"
@"c:\program files\newway"

object initializers

Employee emp = new Employee();
emp.Name = "John Smith";
emp.StartDate = DateTime.Now();

=>

Employee emp = new Employee {
      Name="John Smith", StartDate=DateTime.Now()
   }

#if DEBUG

[Conditional("DEBUG")]

static constructors

public class Example
{
   static Example()
   {
      // Code to execute during type initialization
   }

   public Example()
   {
      // Code to execute during object initialization
   }
}

Conditional string Format

string s = string.Format("{0:positive;negative;zero}", i);

string format = "000;-#;(0)";

string pos = 1.ToString(format); // 001

string neg = (-1).ToString(format); // -1

string zer = 0.ToString(format); // (0)

checked and unchecked

short x = 32767; // 32767 is the max value for short
short y = 32767;
int z1 = checked((short)(x + y)); // OverflowException
int z2 = unchecked((short)(x + y)); // will return -2
int z3 = (short)(x + y); // will return -2
카테고리: language | 태그: | 댓글 남기기

python으로 C++ 소스코드 파싱하기 (to parse C++ source code with Python)

LLVM( http://llvm.org )의 clang라이브러리를 사용해서 C++코드를 파싱할 수 있다.
libclang은 python바인딩이 있어서 python에서도 활용가능하다^^

준비:

  • python 2.7이상 32비트버젼 (windows 7에서 테스트했을때 64비트버젼은 호환하지 않는거같음. clang dll을 로드하지 못함)
    -> http://python.org/download/
  • pip (python 모듈들을 손쉽게 설치할 수 있음)
    -> http://www.pip-installer.org/en/latest/installing.html
    (설치후 python설치폴더의 Scripts폴더를 PATH에 추가해야함)
  • python clang 모듈 설치 (pip로 설치)
    -> 명령프롬프트에서 “pip install clang” 입력

샘플코드:


from clang.cindex import Index


def clang_test(s):
	tu = Index.create().parse(
		'xxx.cpp', unsaved_files=[('xxx.cpp', s)] )
	
	for d in tu.diagnostics:
		if d.severity >= 3:
			print 'Error:', d.spelling, d.location

	print

	for c in tu.cursor.get_children():
		print c.spelling, ':', c.kind

if __name__ == '__main__':
	clang_test('''
	Xyz123 x; // syntax error.
	int myFunc(int a, int b)
	{
		return a + b;
	}
	''')

출력:

Error: unknown type name 'Xyz123' <SourceLocation file 'xxx.cpp', line 2, column 2>

__builtin_va_list : CursorKind.TYPEDEF_DECL
type_info : CursorKind.CLASS_DECL
x : CursorKind.VAR_DECL
myFunc : CursorKind.FUNCTION_DECL

정상적으로 문법적인 에러 위치와 소스내의 변수, 함수들을 출력했음^^

카테고리: clang, llvm, python | 댓글 남기기

ZenWheels 고장 셀프수리

ZenWheels를 선물받았는데, 뒷바퀴만 작동하지않는 사태 발생 ㅠㅜ

프레임을 열어보닌 뒷바퀴 모터랑 연결되는 걸로 추정되는 전선이 납땜부위에서 떨어저 있는걸 발견하고,
인두가 없어서 스카치테입으로 간단히 해결~ㅋ

zenwheels_error

 

zenwheels_fix

카테고리: Uncategorized | 태그: , , , | 댓글 남기기

Ambient Cube lighting

ambientcube

Ambient Cube를 사용해서 Ambient 라이팅 계산:

float3 ambientCubeLighting( float3 ambientColors[6], float3 N )

{

// N = normal vector (unit)

float3 nSquared = N * N;

int3 isNegative = (N < 0);

float3 ambientColor =

nSquared.x * AmbientColors[isNegative.x] +

nSquared.y * AmbientColors[isNegative.y + 2] +

nSquared.z * AmbientColors[isNegative.z + 4];

return ambientColor;

}

Specular Ambient를 추가 적용:

float3 ambientLighting( float3 ambientColors[6], float3 N, float3 V )

{

float3 R = -reflect(V, N);

float fresnel = pow( 1 – abs(dot(V, N)), 3.0);

float3 diffuseAmbient = ambientCubeLighting( ambientColors, N );

float3 specAmbient = ambientCubeLighting( ambientColors, N );

float3 finalAmbient = lerp(diffuseAmbient, specAmbient, f);

return finalAmbient;

}

카테고리: Uncategorized | 태그: , , , | 댓글 남기기

MAC OS X에서 JRE(Java Runtime Env.)위치 얻기

디폴트 JRE:

$ /usr/libexec/java_home
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

특정 버전의 JRE:

$ /usr/libexec/java_home --version 1.7
/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home
카테고리: java | 태그: , , | 댓글 남기기

Eclipse + Scala + openGL 개발환경

  1. JSK (Java SE)설치
  2. eclipse설치
  3. Scala-IDE설치
  4. JOGL다운로드하고 적절한 폴더에 압축풀기
    ( http://jogamp.org/: jogamp-all-platforms.7z )
  5. eclipse에서 User Library생성
    1. Windows > Preferences
    2. Java > Build Path > User Libraries
    3. New.. (not system library)
    4. jogl.all.jar
      glugen-rt.jar
      jogl-all-natives-windows-amd64.jar (64비트 윈도우즈의 경우)
      newt.event.jar
    5. native library location설정

  6. Scala프로젝트 생성
    User Library (JOGL)추가
// ported from: http://www.leolol.com/drupal/tutorials/3d-graphics-jogl-opengl-etc/jogl-2-lesson-1-setup-and-introduction

import java.awt.Component
import java.awt.Frame
import java.awt.event.{ KeyEvent, KeyListener, WindowAdapter, WindowEvent }
import javax.media.opengl.{ GL, GL2, GL2ES1, GLAutoDrawable, GLEventListener }
import javax.media.opengl.awt.GLCanvas
import javax.media.opengl.fixedfunc.{ GLLightingFunc, GLMatrixFunc }
import javax.media.opengl.glu.GLU
 
import com.jogamp.opengl.util.Animator

object MyJoglTest {
  val canvas = new GLCanvas()
  val frame = new Frame("Jogl Quad drawing")
  val animator = new Animator(canvas)

  def exit() = {
    animator.stop()
    frame.dispose()
    System.exit(0)
  }
 
  def main(args: Array[String]): Unit = {
    canvas.addGLEventListener( new MyJoglTest() )
    frame add(canvas)
    frame setSize(640, 480)
    frame setUndecorated(true)
    frame setExtendedState(Frame.MAXIMIZED_BOTH)
    frame addWindowListener(new WindowAdapter() {
      override def windowClosing( e : WindowEvent ) = {
        exit();
      }
    })
    frame setVisible(true)
    animator start()
    canvas requestFocus()
  }
}

class MyJoglTest extends GLEventListener with KeyListener {
  var rotateT = 0.0f
  val glu = new GLU()

  override def display( gLDrawable: GLAutoDrawable ) = {
    val gl = gLDrawable.getGL().getGL2()
    gl glClear(GL.GL_COLOR_BUFFER_BIT)
    gl glClear(GL.GL_DEPTH_BUFFER_BIT)
    gl glLoadIdentity()
    gl glTranslatef(0.0f, 0.0f, -5.0f)
 
    // rotate on the three axis
    gl glRotatef(rotateT, 1.0f, 0.0f, 0.0f)
    gl glRotatef(rotateT, 0.0f, 1.0f, 0.0f)
    gl glRotatef(rotateT, 0.0f, 0.0f, 1.0f)
 
    // Draw A Quad
    gl glBegin(GL2.GL_QUADS)
      gl glColor3f(0.0f, 1.0f, 1.0f)   // set the color of the quad
      gl glVertex3f(-1.0f, 1.0f, 0.0f)      // Top Left
      gl glVertex3f( 1.0f, 1.0f, 0.0f)       // Top Right
      gl glVertex3f( 1.0f,-1.0f, 0.0f)      // Bottom Right
      gl glVertex3f(-1.0f,-1.0f, 0.0f)     // Bottom Left
    // Done Drawing The Quad
    gl glEnd()
 
    // increasing rotation for the next iteration                                 
    rotateT += 0.2f
  }
 
  override def init( gLDrawable : GLAutoDrawable ) = {
    val gl = gLDrawable.getGL().getGL2()
    gl glShadeModel(GLLightingFunc.GL_SMOOTH)
    gl glClearColor(0.0f, 0.0f, 0.0f, 0.0f)
    gl glClearDepth(1.0f)
    gl glEnable(GL.GL_DEPTH_TEST)
    gl glDepthFunc(GL.GL_LEQUAL)
    gl glHint(GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST)
    
    gLDrawable match { case comp : Component => comp addKeyListener this }
  }
 
  override def reshape( gLDrawable : GLAutoDrawable, x : Int, y : Int, width : Int, height : Int ) = {
    val gl = gLDrawable.getGL().getGL2()
    val h = (width toFloat) / (height max 1)
        
    gl glMatrixMode(GLMatrixFunc.GL_PROJECTION)
    gl glLoadIdentity()
    glu gluPerspective(50.0f, h, 1.0, 1000.0)
    gl glMatrixMode(GLMatrixFunc.GL_MODELVIEW)
    gl glLoadIdentity()
  }
 
  override def keyPressed( e : KeyEvent ) = {
    if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
      exit()
    }
  }
 
  override def keyReleased( e : KeyEvent ) = {}
  override def keyTyped( e : KeyEvent ) = {}
  override def dispose( gLDrawable : GLAutoDrawable ) = {}
}

*. 참고(Eclipse+Java+openGL): jogl-2-lesson-1-setup-and-introduction

카테고리: scala | 태그: , , | 댓글 남기기

eclipse로 scala개발 환경 준비

  1. JDK (Java SE) 설치
    http://www.oracle.com/technetwork/java/javase/downloads/index.html
  2. eclipse설치
    eclipse 다운로드 사이트에서 Eclipse IDE for Java Developers를 다운로드
    ( http://eclipse.org/downloads/ )
    적당한 폴더에 압축을 풀면 됨 (설치가 필요 없음)
  3. scala-ide설치 ( scala-ide.org)
    1. eclipse실행
    2. Help / Install New Software.. 메뉴 선택
    3. Add.. 버튼
    4. scala-ide사이트에서 찾을 수 있는 업데이트사이트 URL입력
    5. 리스트에서 Scala IDE for eclipse 체크
    6. Next.. 로 설치 진행

카테고리: scala | 태그: , | 1개의 댓글