• Advertisement

dream rz

Member
  • Content count

    7
  • Joined

  • Last visited

Community Reputation

0 Neutral

About dream rz

  • Rank
    Newbie

Personal Information

  • Interests
    Programming
  1. So, it is really a dilemma. For the last few years, I was always “shape pickup”. To tell the truth, just about enough of this.
  2. Of course, I know this way. high efficiency, imprecise. int circle_x , circle_y , circle_radius; int mouse_x , mouse_y; int test_x = mouse_x - circle_x;//get distance difference int test_y = mouse_y - circle_y; int i = sqrt(test_x * test_x + circle_y * circle_y);//get square root if(i <= circle_radius);//mouse pointer in a circle
  3. There appears to be no better way. On the basis of the theory of click detection, looking for other ways to do this. Anyway, thank you.
  4. Yes, as you said. that's exactly what I mean. but.......but......... I want a more efficient means. applications run faster................. only taking small area in internal memory....................... Because in the game, FPS is very high(60 or ????). work to every frame. so, there may be a better solution to the problem??
  5. Any 2D graphics engine. SDL2, openframeworks(use OpenGL) ............ textures is rectangular and loading a PNG image as a texture. this PNG is a button, maybe it's various shapes. the mouse must click the effective alpha channel. alpha >= 100 maybe.
  6. A texture rectangle, texture type is RGBA. the alpha channel like this: (0=0,x=255) [0][0][0][0][0][0][0] [0][0][x][x][0][0][0] [0][x][x][x][0][0][0] [0][x][x][x][x][x][0] [0][0][0][x][x][x][0] [0][0][0][x][x][0][0] [0][0][0][0][0][0][0] I want a function to picking. now I have a very clumsy solutions: //system Init............. //.......... //pixel buffer to texture....... (texture is handle, a number.cannot get pixel matrix.) //.......... BYTE pixel_alpha[7][7];//save alpha channel matrix //.......... texture.draw(30,30);//draw the picture in the window x=30 , y=30 //.......... if(picking(GetMouseX,GetMouseY))MessageBox("click!"); // picking functio //.......... /*picking function*/ bool picking(int x,int y) { int mouse_to_image_x, mouse_to_image_y;//get mouse position in the image mouse_to_image_x = 30 - x; mouse_to_image_y = 30 - y; if((mouse_to_image_x < 0 && mouse_to_image_x > 7) && (mouse_to_image_y < 0 && mouse_to_image_y > 7))return false;//mouse is not in the image for(int i = 0; i < 7 * 7; i++) { if(pixel_alpha[mouse_to_image_x][mouse_to_image_y] == 255)return true;//in the image and alpha channel is 255 } return false; } //============================================================================================= but...... 1.an excessive amount of memory in alpha channel matrix. 2.i think efficiency is not high. so, how to do? not is ray picking, What is this technology called?
  • Advertisement