초음파 오디오로 통신하는 SAPI 예제이다.
동영상과 동일한 기능을 하는 예제를 작성해 보았다.
API사이트는 아래와 같다.
illiri API(SAPI) : http://illiri.com/index.html
사용방법은 아래의 순서대로 하면된다.
스마트폰이 2개 필요하다.
1. 클라이언트 attach
2. 서버 create
3. 클라이언트 onAttach
4. 서버 onAttached member
5. 클라이언트 onAttached leader
6. 양방향(서버 <-> 클라이언트) transfer -> onTransfer 가능
다운로드
Thursday, April 2, 2015
Visual C++ domain name을 IP로 변환
#include <winsock.h>
#pragma comment(lib, "ws2_32.lib")
void init_ws() {
WSADATA WSAData;
WSAStartup (MAKEWORD(2,2), &WSAData);
}
char* get_ip(const char* domain) {
struct hostent *host_entry;
host_entry = gethostbyname(domain);
char* ip = inet_ntoa( *(struct in_addr*)host_entry->h_addr_list[0]);
return ip;
}
int _tmain(int argc, _TCHAR* argv[])
{
init_ws();
char *ip = get_ip("www.freelab.co.kr");
printf("ip=%s\n", ip);
return 0;
}
#pragma comment(lib, "ws2_32.lib")
void init_ws() {
WSADATA WSAData;
WSAStartup (MAKEWORD(2,2), &WSAData);
}
char* get_ip(const char* domain) {
struct hostent *host_entry;
host_entry = gethostbyname(domain);
char* ip = inet_ntoa( *(struct in_addr*)host_entry->h_addr_list[0]);
return ip;
}
int _tmain(int argc, _TCHAR* argv[])
{
init_ws();
char *ip = get_ip("www.freelab.co.kr");
printf("ip=%s\n", ip);
return 0;
}
Visual C++ 파일 drag and drop
메인 이벤트 루프에 다음과 같이 추가하면 파일 드래그 앤 드랍을 받을수 있다.
case WM_DROPFILES:
{
HDROP hDropInfo = (HDROP)wParam;
char sItem[MAX_PATH];
for(int i = 0; DragQueryFile(hDropInfo, i, (LPSTR)sItem, sizeof(sItem)); i++)
{
}
DragFinish(hDropInfo);
}
break;
case WM_DROPFILES:
{
HDROP hDropInfo = (HDROP)wParam;
char sItem[MAX_PATH];
for(int i = 0; DragQueryFile(hDropInfo, i, (LPSTR)sItem, sizeof(sItem)); i++)
{
}
DragFinish(hDropInfo);
}
break;
Image processing을 이용한 shader effects
Framework:
General Filters:
http://http.developer.nvidia.com/GPUGems/gpugems_ch24.html
A Framework for Image Processing:
http://http.developer.nvidia.com/GPUGems/gpugems_ch27.html
Effects:
Realtime Glow: http://http.developer.nvidia.com/GPUGems/gpugems_ch21.html
Depth Of Field: http://http.developer.nvidia.com/GPUGems/gpugems_ch23.html
http://http.developer.nvidia.com/GPUGems3/gpugems3_ch28.html
Motion Blur:
http://http.developer.nvidia.com/GPUGems3/gpugems3_ch27.html
Physics:
Realtime Rigid Body: http://http.developer.nvidia.com/GPUGems3/gpugems3_ch29.html
Realtime Fluid Simulation: http://http.developer.nvidia.com/GPUGems3/gpugems3_ch30.html
http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter47.html
General Filters:
http://http.developer.nvidia.com/GPUGems/gpugems_ch24.html
A Framework for Image Processing:
http://http.developer.nvidia.com/GPUGems/gpugems_ch27.html
Effects:
Realtime Glow: http://http.developer.nvidia.com/GPUGems/gpugems_ch21.html
Depth Of Field: http://http.developer.nvidia.com/GPUGems/gpugems_ch23.html
http://http.developer.nvidia.com/GPUGems3/gpugems3_ch28.html
Motion Blur:
http://http.developer.nvidia.com/GPUGems3/gpugems3_ch27.html
Physics:
Realtime Rigid Body: http://http.developer.nvidia.com/GPUGems3/gpugems3_ch29.html
Realtime Fluid Simulation: http://http.developer.nvidia.com/GPUGems3/gpugems3_ch30.html
http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter47.html
Wednesday, April 1, 2015
Cocos2d-x wide screen 해상도 설정하기
Cocos2d-x의 기본 해상도는 960x640이다. 이것은 아이폰4S의 해상도이다.
그런데 이것을 안드로이드 폰의 와이드 해상도인 800x480 (WVGA)이나 1280x720 (HD)으로 15:9/16:9 해상도를 맞추려고 하면 해상도 자체의 aspect ratio를 변경해야 한다.
그래서 기존에 아이폰간의 멀티 해상도를 지원하기 위해서 setDesignResolution, setContentScaleFactor를 조절하라고 되어 있는 함수를 쓰면 안된다.
아래와 같이 GLViewImpl::create대신에 GLViewImpl::createWithRect로 glview의 FrameSize를 변경시켜야 한다.
bool AppDelegate::applicationDidFinishLaunching() {
...
glview = GLViewImpl::createWithRect("My Game", Rect(0, 0, 800, 480));
그런데 이것을 안드로이드 폰의 와이드 해상도인 800x480 (WVGA)이나 1280x720 (HD)으로 15:9/16:9 해상도를 맞추려고 하면 해상도 자체의 aspect ratio를 변경해야 한다.
그래서 기존에 아이폰간의 멀티 해상도를 지원하기 위해서 setDesignResolution, setContentScaleFactor를 조절하라고 되어 있는 함수를 쓰면 안된다.
아래와 같이 GLViewImpl::create대신에 GLViewImpl::createWithRect로 glview의 FrameSize를 변경시켜야 한다.
bool AppDelegate::applicationDidFinishLaunching() {
...
glview = GLViewImpl::createWithRect("My Game", Rect(0, 0, 800, 480));
...
Subscribe to:
Posts (Atom)