Jump to content


Photo

Circular Radar


  • Please log in to reply
2 replies to this topic

#1 DZiW

DZiW

    GMC Member

  • GMC Member
  • 727 posts

Posted 10 December 2010 - 03:21 PM

Ok, guys. This is my old gm6 snippet to draw animated radar (not as minimap).
draw_set_color(c_green);
  for (i=1;i>0;i-=0.01) {
   draw_set_alpha(i*.33);
   draw_line(512,176,512-160*sin(image_index+i),176+160*cos(image_index+i));
  } // end_for
draw_set_alpha(1)
It's very non-optimized and the rest, but it works ok. Later I changed sin/cos to length_dir but I saw no better performance.
The question is how to make it better for once I did find some solution with primitives and it worked even better, but as far as I could not save all the data from my external hdd I can't find it anymore; minimaps are everywhere.

A link to a better example or even a relevant hint would nicely do.
TY

Edited by DZiW, 10 December 2010 - 03:25 PM.

  • 0

#2 ragarnak

ragarnak

    GMC Member

  • Retired Staff
  • 19468 posts
  • Version:GM8

Posted 10 December 2010 - 03:44 PM

A link to a better example or even a relevant hint would nicely do.

To the first part : why are you not simply drawing a circle ?

To the second part : draw a triangle-fan. Define the first vertex in the center and the rest along the circles edge.

[edit]
Ah, I just noticed that Alpha statement in there and that you are not drawing the full circle ...

In that case just use the "trianglefan" primitive (with "draw_vertex_color") and do not draw the full circle.

Edited by ragarnak, 11 December 2010 - 01:27 AM.

  • 0

#3 Dark Matter

Dark Matter

    RPG Expert

  • GMC Member
  • 3196 posts
  • Version:GM:Studio

Posted 10 December 2010 - 09:18 PM

Is this what you're looking for?
  • 1




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users