본문 바로가기
스터디/OpenGL

[ OpenGL ] 미니 태양계

by 알 수 없는 사용자 2019. 10. 31.

( ** 인프런에서 들은 강의 '홍정모의 게임 만들기 연습 문제 패키지'를 통해서 공부한 내용과 연습 문제 풀이입니다. **)

	// MyExample1
	class MyExample1 : public Game2D
	{
		float time = 0.0f;

	public:
		void update() override
		{
			beginTransformation();
			{
				rotate(time*5.0f);
				drawFilledStar(Colors::gold, 0.2f, 0.13f);	// Sun

				rotate(time*10.0f);
;				translate(0.5f, 0.0f);
				drawFilledCircle(Colors::blue, 0.1f);		// Earth

				rotate(time*10.0f);
				translate(0.2f, 0.0f);
				drawFilledCircle(Colors::yellow, 0.05f);	// Moon
			}
			endTransformation();

			time += this->getTimeStep();

		}

	};

 

 

 

미니 태양계.mp4
1.08MB

 

 

**** 키워드 : 로컬 좌표계와 월드 좌표계의 활용 ****