1 / 10

Carré Rouge

Carré Rouge. Day 14. 지성 우. Index. Step 1 - Moving and Colliding Initial Declarations Extern inline Step 2 - Score. Initial. // PAGfxConverter Include #include " gfx / all_gfx.c " #include " gfx / all_gfx.h " #define MAXBLUE 4 // 파란 블록의 개수 typedef struct { s16 x, y; // 픽셀들의 위치

tudor
Télécharger la présentation

Carré Rouge

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Carré Rouge Day 14 지성우

  2. Index • Step 1 - Moving and Colliding • Initial • Declarations • Extern inline • Step 2 - Score

  3. Initial // PAGfxConverter Include #include "gfx/all_gfx.c" #include "gfx/all_gfx.h" #define MAXBLUE 4 // 파란 블록의 개수 typedefstruct{ s16 x, y; // 픽셀들의 위치 s32 fx, fy; // 고정된 점의 위치 s32 vx, vy; // 고정된 점의 속도 s16 w, h; // 너비와 높이 } rectangle; rectangle blue[MAXBLUE]; // MAXBLUE는 가능한 사각형의 수 rectangle red; // 사용자가 움직이게 될 사각형

  4. Declarations • 파란 사각형이 가질 수 있는 크기 void Blue16x32(u8 number); void Blue32x16(u8 number); void Blue32x32(u8 number); • 이동시키고 싶은 파란 사각형의 넘버로사각형의 움직임과 화면 틀에 부딪쳐 튀는 것을 체크 void MoveBlue(u8 number); • 파란 사각형과 빨간 사각형과의 충돌을 체크하여 화면 상단에 “Collision”이라고 보여줌 void CheckCollision(u8 number); // 충돌할 경우 체크

  5. Extern inline • extern inline 함수를 선언하여 코드를 직접 사용 • 일반 함수와 inline 함수의 차이점 • 컴파일 시 inline로 선언되어 코드를 복사/붙이기를 함 • 장점 : 기다리는 시간 동안 함수 콜을 할 필요가 없어 속도가 빠름 • 단점 : 너무 많은 내용을 inline 함수에 담을 경우, 많은 메모리를 사용하여 복사/붙이기를 해야 하기 때문에, 오히려 더 큰 코드를 생성하는 것과 같은 처리상태 • 무엇을 할 수 있는가? • ToFixedPoint는 .x와 .y의 노멀 위치를 고정된 점 위치로 바꿔주며, 그것을 .fx와 .fy로 저장 • ToNormal은 반대로, 고정된 점 위치를 노멀 위치인 .x에 복사

  6. Data Transfer and Multiplayer Day 20

  7. Index • Init • How to create a socket? • The others

  8. init • PAlib의 wifi를 통해 사용할 수 있음 • 프로젝트의 arm9의 makefile안의 -ldswifi9에서 추가할 수 있음 • 소켓 사용 전, 항상 PA_InitWifi()와 PA_ConnectWifiWFC()를 사용해야 함

  9. How to create a socket? • 소켓 생성 intPA_InitSocket(int *socket, char *host, intport, intmode); • 호스트는 ip나 dns어느쪽도 할 수 있음 • 포트는 소켓의 포트 • 모드는 소켓의 모드 • PA_NORMAL_TCP는 tcp소켓 • PA_NONBLOCKING_TCP는 막히지 않은 tcp소켓

  10. The Others • How to receive a message from the server? char buffer[256]; recv(sock, buffer, 256, 0); • How to send a message to the server? char buffer[256]; strcpy(buffer,"hello world"); send(sock,buffer,256,0); • How to get a file with http? char *buffer = new char[256*256]; PA_GetHTTP(buffer,"http://www.google.be/index.html"); • How to get the IP address of your DS? char *buffer = malloc(256*256); PA_GetHTTP(buffer,"http://www.invisionsoft.co.uk/ip.php"); • How to disconnect from the access point? Wifi_DisconnectAP(); Wifi_DisableWifi();

More Related