본문 바로가기

동방프로젝트

(67)
남방요척몽) 특별한 일 없으면 아직 바꿀 일 없을 player.cpp #include "Player.h" //플레이어 셋업. void Player::setup(ofImage * _img, ofPoint _pos, bool visiblecenter, ofImage * _center) { img = _img; height = img->getHeight(); width = img->getWidth(); pos.set(_pos); collisionpos.set(pos.x - width / 3, pos.y); speed = 3; lives = 5; visible = visiblecenter; center = _center; centerwidth = center->getWidth(); } //업데이트는, 왼쪽이냐 오른쪽이냐에 따라 player의 xpos를 움직임 30프레임 void ..
코틀린 2일차 fun joinToString( collection: Collection, separator: String= ", ", prefix: String= " ", postfix: String= " " ):String joinToString(list, ",", "", "") joinToString(list) joinToString(list, "; ") 이렇게 함수 호출할 때 일부 인자를 쓰거나 안 쓸 수 있음. 오버로드 문제 x 이를 strings 패키지에 삽입 법: package strings fun joinToString(...) : String {...} 이렇게, 이 함수를 소스 파일의 최상위 수준에 넣어 모든 곳에서 import를 통해 사용이 가능 변수도 fun 바깥에 선언하므로써 정적으로 선언 가능 p..
코틀린 1일차 fun main(args: Array) println("hello, world") } fun max(a:Int, b:Int): Int { return if (a>b) a else b } println(max(1,2)) == fun max(a:Int, b:Int) = if(a>b) a else b enum class Color(var r: Int, var g:Int, var b:Int) { BLUE(0, 0, 255); fun rgb()=(r*256+g)*256 + b } println(Color.BLUE.rgb()) fun getMNemonic(color:Color) = wehn(color) { Color.BLUE, Color.Red -> "Batlle" } println(getMNemonic(Color..