Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - RetroX

106
Issues Help Desk / Re: Function pointers
« on: March 28, 2011, 04:39:08 PM »
I honestly don't see why surfaces have been implemented yet.  Who cares if Intel won't support it?  We need it for the Linux version, anyways.

107
Issues Help Desk / Re: Function pointers
« on: March 27, 2011, 08:14:31 AM »
Scripts are not exactly C++ functions.  How they are defined is an implementation that can be changed, and you shouldn't take advantage of this unless it's not going to change.  argument0-N are global vars, not passed as parameters.

By "real" C++ functions, I mean that you can define things in whitespace as true C++ functions.  You'll have a slight pain getting instance variables, but it'll still work.

108
Issues Help Desk / Re: Function pointers
« on: March 26, 2011, 10:19:28 PM »
Ah, didn't know that it came out yesterday.  Hasn't reached the Arch repositories yet.  Apparently, it was flagged today, so, it'll probably be updated by tomorrow afternoon.

109
Issues Help Desk / Re: Function pointers
« on: March 26, 2011, 06:16:52 PM »
There will be script_execute, but it won't likely be what you expect.

In ENIGMA, script names refer to an integer of that's script ID.  ENIGMA sets the global variables argument0-(N-1) and the script uses them.

If you want function pointers, use actual functions, not scripts.  And when you do, take into consideration what you're trying to accomplish - do you really need them?

On a random note, the GCC 4.6 will likely come out within the next three days, and it supports lambda functions with the std=gnu++0x flag.

110
Off-Topic / Re: Test
« on: March 26, 2011, 06:05:07 PM »
Not really.  Just kind of curious.

111
Off-Topic / Re: Test
« on: March 26, 2011, 02:50:05 PM »
Updated it.  Personally tied between 3 and 7.

112
Announcements / Re: Recent Events
« on: March 26, 2011, 09:57:24 AM »
Does the Android option in ENIGMA actually build for android out of the box currently?

As far as I'm aware Linux never used executables in the same way that Windows does...
They are identical formats; it's just how they are packaged.  ELF is designed so that an executable will be placed in a predefined "binaries" directory and run as a command, where needed "DLLs" (SOs) are placed in other directories, and everything is installed as a set of dependencies (only install what you need, and if two programs need the same thing, only get one copy).  All of the software is sorted into the proper places in the system and set up in a way so that the user can't easily modify them and neither can any remote user.

For example, under Linux, I simply run "firefox" in a terminal to open Firefox.  When I create a "launcher," (known as a shortcut in Windows), it just runs the command when I click it.  The system knows where to find Firefox as a program, and Firefox knows where to find its needed files because they are all in preset places in the system.


Windows EXEs, on the other hand, are designed to be self-contained in individual directories where each user can run them by just double-clicking them.  Windows EXEs can be run by command-line, but most of them are designed to just run out of where they were installed.  This means, however, that Windows EXEs often repeat their contents - all media players that use, for example, a DLL that loads MP3, will have their own copy, rather than having a single copy somewhere in the system that they both use.  This guarantees that they will work with the version that they have without requiring updates for new DLL versions.

Under Windows, I go to Firefox's installation directory and run firefox.exe from there.  When I create a shortcut, it just links to this one file, and clicking it opens the file (which will open Firefox).  Firefox knows where all of its stuff is because it's all included in its directory.


ELFs can be run just like Windows EXEs, however, they are not set up this way by default, and it's often discouraged.  However, for smaller-scale games, this is an easier way to do things.

In addition, Windows EXEs can be run like ELFs to an extent - PATH will pull DLLs from places other than the running directory if they are not found there.

113
Off-Topic / Test
« on: March 25, 2011, 03:13:54 PM »
Which one looks the best?



The third for me.

114
Announcements / Re: Recent Events
« on: March 24, 2011, 07:12:27 PM »
Holy cow, Enigma has native support for PThreads!!
I don't think that the engine itself uses them.  By default, the G++ will have support, though.

115
General ENIGMA / Re: Builds, Packages, Releases, etc.
« on: March 24, 2011, 07:11:12 PM »
The Ubuntu package has been fixed.  Update the source from the maverick to the natty repo - see the first post.

116
Announcements / Re: Recent Events
« on: March 23, 2011, 05:47:34 PM »

Would you like to try your hand at it?

117
Proposals / Re: Function approval process
« on: March 16, 2011, 05:09:29 PM »
It's just the reverse of what I have for the script.  One second.

EDIT: To get the list, pull the list of keywords, functions, etc. from LGM and shove them into a file named "enig."  Then, copy this file (should be named "gm") and shove it in the same directory.  Run this bash script in that directory to get a list of functions.  Finished functions are prefixed with "FINISHED:", while unfinished ones are prefixed with "UNFINISHED:".

I can update the wiki page if you want, but there's the script if anyone else feels like it.

To get just the unfinished:
Code: [Select]
./list.sh | grep '^UNFINISHED' | sed -r 's/UNFINISHED:[[:space:]]*//'
To get just the finished:
Code: [Select]
./list.sh | grep '^FINISHED' | sed -r 's/FINISHED:[[:space:]]*//'

118
General ENIGMA / Re: Hey
« on: March 15, 2011, 03:38:00 PM »
Well, we're the first result for "ENIGMA game maker" and "ENIGMA dev," so, that must mean something.

119
Function Peer Review / Re: Fede-lasse's functions
« on: March 14, 2011, 08:34:29 PM »
Yeah, but I figured that I'd let everyone who was viewing the topic know.  I felt like it would have been kind of rude to just omit them altogether.

120
Function Peer Review / Fede-lasse's functions
« on: March 12, 2011, 10:59:21 AM »
Because he didn't post them in their own topic, and I can't move topics:

Code: [Select]
//bool place_snapped(double hsnap,double vsnap)
bool place_snapped(double hsnap,double vsnap) {
  return (bool)(X == X%hsnap) && (Y == Y%vsnap);
}

//int move_random(double hsnap,double vsnap)
int move_random(double hsnap,double vsnap) {
  X = floor(random(room_width)/hsnap)*hsnap;
  Y = floor(random(room_height)/vsnap)*vsnap;
  return (int)0;
}

//int move_snap(double hsnap,double vsnap)
int move_snap(double hsnap,double vsnap) {
  X = floor(X/hsnap)*hsnap;
  Y = floor(Y/vsnap)*vsnap;
  return (int)0;
}

//int move_wrap(double hor,double vert,double margin)
int move_wrap(double hor,double vert,double margin) {
  //not sure whether two IFs are faster than one big calculation in a single IF
  if (hor) {
    if (X < -margin || X > room_width+margin) {
      X = -(X-room_width);
    }
  }
  if (vert) {
    if (Y < -margin || Y > room_height+margin) {
      Y = -(Y-room_height);
    }
  }
  return (int)0;
}

//int move_towards_point(double x,double y,double sp)
int move_towards_point(double x,double y,double sp) {
  DIRECTION = point_direction(X,Y,x,y);
  SPEED = sp;
  return (int)0;
}

Note that these functions have already been committed (in working forms), but I'll post them anyways:
Code: [Select]
//double distance_to_point(double x,double y)
double distance_to_point(double x,double y) {
  return (double)point_distance(median(BBOX_LEFT,x,BBOX_RIGHT),median(BBOX_TOP,y,BBOX_BOTTOM),x,y);
}

//double distance_to_object(int obj)
double distance_to_object(int obj) {
  double _edgeX,_edgeY;
  _edgeX = median(BBOX_LEFT,obj.X,BBOX_RIGHT);
  _edgeY = median(BBOX_TOP,obj.Y,BBOX_BOTTOM);
  if (_edgeX > obj.BBOX_LEFT && _edgeX < obj.BBOX_RIGHT && _edgeY > obj.BBOX_TOP && _edgeY < obj.BBOX_BOTTOM) {
    return (double)0;
  }
  return (double)point_distance(_edgeX,_edgeY,median(obj.BBOX_LEFT,X,obj.BBOX_RIGHT),median(obj.BBOX_TOP,Y,obj.BBOX_BOTTOM));
}