Pages: 1 2 »
  Print  
Author Topic: A Few Alternate Functions  (Read 30978 times)
Offline (Male) RetroX
Posted on: June 11, 2008, 04:37:05 pm

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
Here are a few functions I made in GML to be used as alternates to not-done-yet functions.  Most are pretty simple, but hey.
frac(x)
argument0=string(argument0);
for (i=string_length(argument0);i>0;i+=1;)
 {
 if string_char_at(i+1)!='.' then
  {
  array[i]=string_char_at(i);
  }
 else
  {
  array[i]='0';
  }
 }
string='';
for (i=0;i<string_length(argument0);i+=1;)
 {
 string+=array[i];
 }

return real(string);

draw_point(x,y)
draw_line(argument0,argument1,argument0,argument1);

draw_triangle(x1,y1,x2,y2,x3,y3,outline)
if argument6=true then pr_type=pr_linestrip else pr_type=pr_trianglelist;
draw_primitive_begin(pr_type);
draw_vertex(argument0,argument1);
draw_vertex(argument2,argument3);
draw_vertex(argument4,argument5);
if pr_type=pr_linestrip then draw_vertex(argument0,argument1);
draw_primitive_end();

draw_arrow(x1,y1,x2,y2,size);
draw_line(argument0,argument1,argument2,argument3);
draw_primitive_begin(pr_trianglelist);
draw_vertex(argument2,argument3);
x2=argument2+cos(degtorad(point_direction(argument2,argument3,argument0,argument1)+45))*argument4;
y2=argument2-sin(degtorad(point_direction(argument2,argument3,argument0,argument1)+45))*argument4;
draw_vertex(x2,y2);
x3=argument2+cos(degtorad(point_direction(argument2,argument3,argument0,argument1)+45))*argument4;
y3=argument2-sin(degtorad(point_direction(argument2,argument3,argument0,argument1)+45))*argument4;
draw_vertex(x3,y3);
draw_vertex(argument2,argument3);
draw_primitive_end();

draw_point_color(x,y,col1)
col=draw_get_color();
draw_set_color(argument2);
draw_line(argument0,argument1,argument0,argument1);
draw_set_color(col);

draw_triangle_color(x1,y1,x2,y2,x3,y3,col1,col2,col3,outline)
if argument9=true then pr_type=pr_linestrip else pr_type=pr_trianglelist;
draw_primitive_begin(pr_type);
draw_vertex_color(argument0,argument1,argument6);
draw_vertex_color(argument2,argument3,argument7);
draw_vertex_color(argument4,argument5,argument8);
if pr_type=pr_linestrip then draw_vertex(argument0,argument1);
draw_primitive_end();

« Last Edit: June 11, 2008, 04:38:55 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 (Unknown gender) ludamad
Reply #1 Posted on: June 12, 2008, 12:46:36 pm
Developer
Joined: May 2008
Posts: 1256

View Profile Email
All those functions already exist, the front page isn't updated.
Logged
Offline (Male) Josh @ Dreamland
Reply #2 Posted on: June 12, 2008, 01:15:30 pm

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
XD

I'm sorry, I've been devoting more time to the actual project than to its progress page. :P

Maybe that's a good thing anyway.

Thank you though, that was still a nice thought and good thinking.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) RetroX
Reply #3 Posted on: June 17, 2008, 07:22:55 pm

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

Well, I guess that's a good thing.
But you might want to add in a "expand/collapse all" button.  Though I could just click "show hidden elements" in Web Developer, it might be useful to others.

But at least we have the draw_arrow function I made.
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 (Female) serprex
Reply #4 Posted on: August 17, 2008, 03:48:49 pm
Smooth ER
Developer
Joined: Apr 2008
Posts: 106

View Profile WWW
That frac(x) is even worse than my x%1 method
Logged
Offline (Male) RetroX
Reply #5 Posted on: September 05, 2008, 06:14:43 pm

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
Just shut the hell up, serprex. >_>
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? :(
Post made October 17, 2008, 03:48:24 am was deleted at the author's request.
Offline (Male) Josh @ Dreamland
Reply #7 Posted on: October 17, 2008, 06:40:24 pm

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
double frac(double x) { return x-(int)x; }
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) OniLink10
Reply #8 Posted on: October 19, 2008, 12:32:09 am
Member
Joined: Jul 2008
Posts: 68

View Profile Email
double frac(double x) { return x-(int)x; }
Pwnage.
Logged
Offline (Male) RetroX
Reply #9 Posted on: October 25, 2008, 08:28:49 pm

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

I didn't know C++ when I made this.
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 (Unknown gender) score_under
Reply #10 Posted on: October 26, 2008, 03:41:26 pm

Member
Joined: Aug 2008
Posts: 308

View Profile
Quote
>_>

I didn't know C++ when I made this.
GML for frac(x)
Code: [Select]
return (argument0-floor(argument0));
Logged
Offline (Male) Rusky
Reply #11 Posted on: October 27, 2008, 06:06:35 pm

Resident Troll
Joined: Feb 2008
Posts: 954
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
no, gml for frac(x) is
Code: [Select]
frac(x):p
Logged
Offline (Unknown gender) score_under
Reply #12 Posted on: November 02, 2008, 12:44:46 pm

Member
Joined: Aug 2008
Posts: 308

View Profile
Not when you can't use frac(x) :o
An alternative to draw_text(): Trawl through Microsoft's documentation, try to find their GD functions, draw some text onto a bitmap using them, draw that bitmap with 2 triangles in openGL. But this would also completely ruin the cross-platform aspect of Enigma.
Logged
Offline (Male) RetroX
Reply #13 Posted on: November 03, 2008, 03:39:24 pm

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
Why not just use sprites like a sane person?  They look better anyways.
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 (Unknown gender) score_under
Reply #14 Posted on: November 03, 2008, 03:47:28 pm

Member
Joined: Aug 2008
Posts: 308

View Profile
Why not just use sprites like a sane person?  They look better anyways.
Not if you're doing something that requires user input... you'd need to make a This-Time-It's-Interpreted GM program to dump all 255 characters of a font as a strip >.< (Since I'm too lazy to do it in Win32 API... but wait, SDL_TTF sounds feasible, or even... :o implement that in cpp<{ }> tags! Yes, I hope they get standardised in engima like that.)
Logged
Pages: 1 2 »
  Print