ENIGMA Forums

General fluff => Announcements => Topic started by: Josh @ Dreamland on November 04, 2010, 09:42:40 am

Title: Long enough without an update
Post by: Josh @ Dreamland on November 04, 2010, 09:42:40 am
As usual, we've been trying to get all our ducks in a row. It looks something like this:

(http://dl.dropbox.com/u/1052740/JR53055-ducks-affeared.jpg)

More specifically, it looks like this:

(http://dl.dropbox.com/u/1052740/enigma/screens/fonts/font_wat.png)
(Or more recently, this: http://dl.dropbox.com/u/1052740/enigma/screens/fonts/Screenshot-Untitled%20Window-2.png)

And with that, here's what's been happening.

Resources
ENIGMA has gained two new resources lately, namely backgrounds (courtesy of HaRRiKiRi and TGMG) and fonts (my own doing). However, fonts must be added via font_add_sprite(), and backgrounds must be drawn manually. Ism is working on giving me a compression method, which I will use to re-zlib the font glyphs after I pack them. Also, before I ever got to post news on fonts, HaRRi added all the font functions (they still need finalized once it is convenient to test them; it's nothing more than 20 minutes of work, if only the issue I have foreseen now afflicts them). Maybe I'll do something about backgrounds soon...
To tie up a couple questions, by "pack them (the glyphs)," I mean stick them tightly together to conserve VRAM and increase the likelihood that they'll work on, say, the iPhone. I wrote a rectangle packing algorithm, which in the outdated screenshot above is packing the font glyphs a little too tightly. That has since been fixed, but what you see is the packed result of what was once a 256*256 font sheet.

Systems
As pictured vaguely above, r9k has been working on triangle-based collisions. These will evolve into polygon-based collisions with a little TLC. Thanks to some other changes mentioned later in this post, r9k was able to get simple triangle-triangle collision class, Triangle, working from within EDL.

Code
I fixed a few problems with the syntax checker and parser, and here's what they can do now:
Code: (EDL) [Select]
list a; var b = 10;
a.push_back(b);
show_message(string(a.size()));
rect* a = some_rect_function();
a.left = 0;

If that doesn't mean anything to you, just know that it puts a lot of power at the finger tips of those to whom it does. Since then, r9k found a problem seemingly regarding the difference between class and struct in my parser. I'll be looking into that shortly enough.
Technical details:
When resolving operator., ENIGMA isolates the left-hand side of the dot, and runs it through a stack-based coercer, which resolves a viable type to represent the expression. Any variables in the expression will be searched for starting from the script scope, then to the globalvar scope, then the object scope, and finally to the global scope. If no type is explicitly named or no variable is found, the coercer defaults to var. From there, the type is checked for a member by name of the right-hand side of the dot.
If one is found: The type is checked for any reference marks (such as * or []) that would indicate it's a pointer. If one's found, the dot becomes ->. Otherwise it's left alone.
If one is not found: The expression is placed in parentheses. If the right-hand side is a global local (a local found in all instances), the entire segment is rewritten as enigma::glaccess(expression)->varname, where glaccess() returns a pointer to the parent class containing all global locals. Otherwise, the expression is replaced with an accessor function, in this format enigma::varaccess_varname(expression). The compiler will later generate an accessor function to fit the bill. Additionally, the expression is cast to int to reduce the likelihood for compile error/warn.

Additionally, I finished with(), in the sense that "other" now works in it.

Finally, just yesterday I implemented all the mouse events. Most still need tested; they are bbox based for now.

Portability/Extensibility
Ism now uses my network of YAML files to provide build platform/API options to the user. So now, at least on Mac, you can select "iPhone" or "Android" to build for. I don't believe TGMG has capitalized on this yet (there is still work to do), but we should have the whole system working soon enough (implying the ability to switch between target OS/device from LGM).

Also, someone submitted a bug that ENIGMA wasn't working on Windows a while back; it's difficult to keep it working on both platforms. Today, I'm going to get mingw-get working with ENIGMA.exe, so we can finally have a respectable install process on Windows.

I'm also going to hit Ism up to call "make enigma" even when she thinks it doesn't need done.

Finally, I have been working on widgets for ENIGMA. The reason for this is so I can finally bring Build Mode to R4. Some of you may remember it from R3; It was by far the best idea introduced in the system. Widgets are looking like this so far:

(http://dl.dropbox.com/u/1052740/enigma/screens/widgets/buildmode-done.png)

Code: (EDL) [Select]
int   window = wgt_window_create(480, 96);
  int layout = wgt_layout_create(window,
    "OOOOOOO\n"
    "PUXYWHS\n"
    "FRGGIIS", 2, 2);
  int cbbobj, bpause, bfreeze, bundo, bredo, bstop, tegx, tegy, tegw, tegh, cbgrid, cbiso;
  wgt_layout_insert_widget(layout, "O", cbbobj =  wgt_combobox_create("object0|object1|object2|cat|hat|box|wall|toilet|cloud|mushroom"));
  wgt_layout_insert_widget(layout, "P", bpause =  wgt_button_create("Pause"));
  wgt_layout_insert_widget(layout, "F", bfreeze = wgt_button_create("Freeze"));
  wgt_layout_insert_widget(layout, "U", bundo =  wgt_button_create("Undo"));
  wgt_layout_insert_widget(layout, "R", bredo =  wgt_button_create("Redo"));
  wgt_layout_insert_widget(layout, "X", tegx =   wgt_textline_create("X",3));
  wgt_layout_insert_widget(layout, "Y", tegy =   wgt_textline_create("Y",3));
  wgt_layout_insert_widget(layout, "W", tegw =   wgt_textline_create("W",3));
  wgt_layout_insert_widget(layout, "H", tegh =   wgt_textline_create("H",3));
  wgt_layout_insert_widget(layout, "G", cbgrid = wgt_checkbox_create("Grid"));
  wgt_layout_insert_widget(layout, "I", cbiso =  wgt_checkbox_create("Iso"));
  wgt_layout_insert_widget(layout, "S", bstop =  wgt_button_create("Stop"));
  wgt_window_show(window);

Those functions will be available to the user and used by Build Mode's new system. Build Mode will be renamed to Design Mode to avoid ambiguity in communication.

Also, I did most of the GM dialogs (get_color, get_open_filename, show_menu, etc.). I also added, just to be original, my own show_menu_ext:

(http://dl.dropbox.com/u/1052740/enigma/screens/widgets/Screenshot-1.png)

Code: (EDL) [Select]
show_menu_ext(32,32,"test|of|menus|-|>Project|/Save|Close|<|[]Checkbox|[*]Checked|-|()Radio|(*)Radiod|etc")
So anyone that was hoping for a powerful widget interface in ENIGMA can rest easy. However, to answer someone's next question, no, you cannot place the widgets over your game screen. You need to make them their own window. Someone will probably code an in-game widgeting library later on. (Menus and color selections are, of course, their own windows, and do not need any special treatment to make).

Anyway, as you can see, the new widget library has no trouble re-creating R3 Build Mode's UI.

Lastly finally, Ism has been working on some DND functions. With that, we needed to fix isolated, system-invoked events such as Create to maintain a valid self-referential iterator so functions like action_set_motion (or whatever the hell it is; no one uses those directly) can accurately access the current instance's locals. For the continued success of this endeavor, I will need to finish my YAML-based instance block system (very similar to Rusky's proposal of components from long ago, only without unsightly pointer members; feel free to irritate the issue and we can discuss the intricacies of why I won't tolerate pointer members and why the low-level components are still tiered :P).

And on the subject of events, in fixing up the mouse wheel event, I added mouse_get_wheel_vangle(). It returns how many increments the mouse wheel has rolled vertically, even though most devices anymore do not have a wheel but a trackpad of sorts (Laptops, Apple Magic Mouse). Also, I've seen only two devices with a horizontal scroll wheel (Apple's Mighty Mouse scroll ball, some off-brand fucking-huge mouse with 36 buttons on each surface). That being the case, feel free to propose a better name.

Cheers.
Title: Re: Long enough without an update
Post by: TheExDeus on November 04, 2010, 11:15:37 am
Great update. Was getting worried.
About mouse wheels, I have one, most people have one, and most people use one. Also great that you added a function for mouse wheels, as GM itself only has some action. Which is weird.

Also, I will check out that widget thing. Does this mean I can make new windowy things for my game/program or they will work only in Design mode? Would be great if it worked for production level too.
Title: Re: Long enough without an update
Post by: Josh @ Dreamland on November 04, 2010, 11:57:56 am
It will work for production level, but I've not yet committed it. I'm looking for the best way to tie it into the current system; it will probably be given its own directory called Widget_Libraries (X11 has none, so I can't just tie in widgets to the Platforms/ directory).

They'll be up before you know it.
Title: Re: Long enough without an update
Post by: RetroX on November 04, 2010, 03:16:12 pm
mouse_get_wheel_scrolls() might be a better name.  vangle implies an absolute angle or an angle measure of some kind, which is not the case.
Title: Re: Long enough without an update
Post by: luiscubal on November 04, 2010, 03:48:47 pm
What are you using for the UI?
Title: Re: Long enough without an update
Post by: RetroX on November 04, 2010, 04:45:58 pm
GTK+, I believe.
Title: Re: Long enough without an update
Post by: luiscubal on November 04, 2010, 07:52:59 pm
ah, I see. The window title. I missed that detail.
Does the win32 version use GTK+ too or does it use native win32 api?
Title: Re: Long enough without an update
Post by: Josh @ Dreamland on November 04, 2010, 09:32:09 pm
Win32. The menu function was in fact ported from Win32 to GTK. I even used a couple enum{} wrappers so the code is nearly identical. Getting the Win32 version to tab-switch and resize dynamically is going to take much more work. The only reason I used GTK is because it's as native as you can get on GNOME.
Title: Re: Long enough without an update
Post by: freezway on November 04, 2010, 09:57:20 pm
good to see steady progress is being made. There should be a chat of what works and doesn't, like
|OSX|Windows|Linux|Notes
With() statement|Works, still testing/beta|Not started|Works, buggy|NOTES GO HERE
other function|status|status|status|NOTES GO HERE

note: this is an example and may not reflect the state of the enigma project
Title: Re: Long enough without an update
Post by: TheExDeus on November 05, 2010, 06:31:44 am
I think something as general as With() statement works on all, or doesn't work on all. What you want is something more platform specific, like this window widget, or drawing functions (if directx is put in or something similar).
Title: Re: Long enough without an update
Post by: freezway on November 05, 2010, 08:03:47 am
I think something as general as With() statement works on all, or doesn't work on all. What you want is something more platform specific, like this window widget, or drawing functions (if directx is put in or something similar).

AHEM, please read the ENTIRETY of the prev. post, then post.
Title: Re: Long enough without an update
Post by: TheExDeus on November 05, 2010, 09:15:09 am
Quote
AHEM, please read the ENTIRETY of the prev. post, then post.
I did, and you wrote that the example doesn't reflect the state of enigma project. Which is not my point. I just thought that the example itself should of been different.
Title: Re: Long enough without an update
Post by: Josh @ Dreamland on November 05, 2010, 09:17:57 am
I'm confident in saying that aside from iPhone support, nothing will ever work in Mac that doesn't work better in Linux. :P

And yeah, with() is platform-independent entirely.

But I'm not gonna skewer anyone over it.
Title: Re: Long enough without an update
Post by: TGMG on November 05, 2010, 10:08:46 am
I'm confident in saying that aside from iPhone support, nothing will ever work in Mac that doesn't work better in Linux. :P

And yeah, with() is platform-independent entirely.

But I'm not gonna skewer anyone over it.
Up until recently Mac key press and release worked better than linux :p although that is fixed now :)
Title: Re: Long enough without an update
Post by: Josh @ Dreamland on November 05, 2010, 10:24:09 am
I call that a fluke.

... :P
Title: Re: Long enough without an update
Post by: RetroX on November 05, 2010, 08:55:17 pm
#ifdef PLATFORM_LINUX
  break;
#endif
Title: Re: Long enough without an update
Post by: Josh @ Dreamland on November 06, 2010, 10:18:55 am
I need to offer preprocessors in ENIGMA. But I'm NOT using C's.
I'll make a post under proposals.

Done. http://enigma-dev.org/forums/index.php?topic=676
Title: Re: Long enough without an update
Post by: The 11th plague of Egypt on November 10, 2010, 03:42:59 pm
Maybe you can recycle some of the functions I added to my dll (http://enigma-dev.org/forums/index.php?topic=637.msg7635#new), there's a lot of stuff for triangle collisions and distances.