Pages: [1]
  Print  
Author Topic: A random function  (Read 1719 times)
Offline (Male) RetroX
Posted on: June 10, 2009, 06:17:41 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
draw_arrow()

Add "int draw_arrow(double x1,double y1,double x2,double y2,double size)" to the fnames.txt file.

Add the following to ENIGMAsystem\SHELL\Graphics_Systems\OpenGL\GMstdraw.h:
int draw_arrow(double x1,double y1,double x2,double y2,double size)
{
        enigma::untexture();
       
      double dir_left=point_direction(x1,y1,x2,y2);
      
        glBegin(GL_LINES);
        glVertex2f(x1, y1);
        glVertex2f(x2, y2);
        glEnd();
      
      double ALx= cos((dir+135)/180.0*pi)*(size/2);
      double ALy=-sin((dir+135)/180.0*pi)*(size/2);
      double ARx= cos((dir+135)/180.0*pi)*(size/2);
      double ARy=-sin((dir+135)/180.0*pi)*(size/2);
      
        glBegin(GL_TRIANGLES);
        glVertex2f(x2, y2);
        glVertex2f(x2+ALx, y2+ALy);
      glVertex2f(x2+ARx, y2+ARy);
        glEnd();
       
        return 0;
}


I looked for a simple and random function in the list that needed to be done, and here it is.
« Last Edit: June 22, 2009, 08:14:39 PM by RetroX » Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) KaBob799
Reply #1 Posted on: June 23, 2009, 04:25:06 PM

Member
Location: Texas
Joined: Apr 2008
Posts: 3
MSN Messenger - kabob799@gameplague.com
View Profile WWW
Yay
Logged
Offline (Female) serprex
Reply #2 Posted on: July 27, 2009, 09:53:36 AM
Smooth ER
Developer
Joined: Apr 2008
Posts: 106

View Profile WWW
Code: [Select]
double draw_arrow(double x1,double y1,double x2,double y2,double sz){
enigma::untexture();
double dir=atan2(y2-y1,x2-x1);
glBegin(GL_LINES);
glVertex2f(x1,y1);
glVertex2f(x2,y2);
glEnd();
glBegin(GL_TRIANGLES);
glVertex2f(x2,y2);
glVertex2f(x2-cos(dir-pi/6)*(sz/2),y2-sin(dir-pi/6)*(sz/2));
glVertex2f(x2-cos(dir+pi/6)*(sz/2),y2-sin(dir+pi/6)*(sz/2));
glEnd();
return 0;}
FTFY again
« Last Edit: July 27, 2009, 09:55:13 AM by serprex » Logged
Offline (Male) RetroX
Reply #3 Posted on: July 27, 2009, 11:05:38 AM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
>_>
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Pages: [1]
  Print