cursor()
커서의 모양을 지정합니다.
cursor(kind) 형태로 사용할 경우
화살표, 십자가, 손모양 파라메터에 나온 종류 중에서 고를 수 있습니다.
cursor(img) 형태로 사용할 경우
PImage에 저장한 그림으로 커서 모양을 사용할 수 있습니다.
cursor(img,x,y) 형태로 사용할 경우
x,y 를 지정하여 클릭할 경우 커서 내 어떤 부분이 클릭 될지 결정할 수 있습니다.
x,y 값은 커서 이미지의 크기보다 작은 값이 되어야 합니다.
예) 사용자가 불러들인 img의 크기가 16*16 이고 클릭시 그 이미지 중앙 지점이
실제 클릭된 부분으로 하고 싶을 경우 curosr(img,8,8) 과 같이 적으면 됩니다.
예제 코드)
PImage img;
void setup()
{
size(400,400);
img=loadImage("cursor_img.png");
}
void draw()
{
if (mouseX < 200)
cursor(CROSS);
else
cursor(img,8,8);
}
사용자 지정 이미지 사용시에는 16*16 또는 32*32 픽셀 이미지를 불러들여 사용할 것을 추천하며
웹과 같은 다른 환경에서 제대로 동작하지 않을 경우 x,y 값을 반드시 이미지 픽셀 크기보다 작게 설정하길 바랍니다.
웹과 같은 다른 환경에서 제대로 동작하지 않을 경우 x,y 값을 반드시 이미지 픽셀 크기보다 작게 설정하길 바랍니다.
P2D, P3D 렌더 설정에서는 OpenGL이 기본 커서에 대한 접근을 가능하게 해놓지 않았으므로 (Issue 3791) 기본 커서로 사용하길 바랍니다.
Name | cursor() | ||||||||
---|---|---|---|---|---|---|---|---|---|
Examples | // Move the mouse left and right across the image // to see the cursor change from a cross to a hand void draw() { if (mouseX < 50) { cursor(CROSS); } else { cursor(HAND); } } | ||||||||
Description | Sets the cursor to a predefined symbol or an image, or makes it visible if already hidden. If you are trying to set an image as the cursor, the recommended size is 16x16 or 32x32 pixels. It is not possible to load an image as the cursor if you are exporting your program for the Web, and not all MODES work with all browsers. The values for parameters x and y must be less than the dimensions of the image. Setting or hiding the cursor does not generally work with "Present" mode (when running full-screen). With the P2D and P3D renderers, a generic set of cursors are used because the OpenGL renderer doesn't have access to the default cursor images for each platform (Issue 3791). | ||||||||
Syntax | cursor(kind) cursor(img) cursor(img, x, y) cursor() | ||||||||
Parameters |
| ||||||||
Returns | void | ||||||||
Related | noCursor() |
학습 목적으로 작성한 글이므로 자세하지 않거나 틀린 부분이 있을 수 있습니다.
자세한 정확한 정보는 원문을 보고 확인하시길 바랍니다.
댓글 없음:
댓글 쓰기