Our new Indie Games subforum is now open for business in G&T. Go and check it out, you might land a code for a free game. If you're developing an indie game and want to post about it,
follow these directions. If you don't, he'll break your legs! Hahaha! Seriously though.
Our rules have been updated and given
their own forum. Go and look at them! They are nice, and there may be new ones that you didn't know about! Hooray for rules! Hooray for The System! Hooray for Conforming!
SELECT * FROM posts WHERE tid = 'PA PROGRAMMING THREAD'
Posts
Try now.
Apparently that is admin-only in Drupal core. :rotate: Had to add a module to allow users to edit it on their own.
The PhalLounge :: Chat board for Phalla discussion and Secret Santas :: PhallAX 2013
Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
Ah, very nice. :^:
Stack Exchange | http://www.mpdevblog.blogspot.com
http://compass-style.org/help/tutorials/spriting/
"If you're going to play tiddly winks, play it with man hole covers."
- John McCallum
(The document my talk is based on was sent 3 weeks ago, btw)
It's a socket server... but I thought that's what Node was in the first place
Hm hm? Socket.IO has browser api, yo.
Yeah, it is to support cross-browser Web Sockets.
Making real socket connections with a browser client.
The PhalLounge :: Chat board for Phalla discussion and Secret Santas :: PhallAX 2013
Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
After some Googling and work, I now have a selector that, when it changes, updates a particular record in the database with its changed state. The thing is that I hard-coded in the job ID that I wanted to change for testing purposes.
How can I make it so that when the variable goes off to the request processor code, it includes the changed state from the selector, and the ID of the job to change?
Code is below:
<cfset dbConnection = "#dbConnection#"> <script language="JavaScript" src="jquery.js" type="text/javascript"></script> <script type = "text/javascript">jQuery(document).ready(function(){ $("#idm").change(function() { var formval = { idm:$(this) .val()}; $.ajax({ type: "POST", url: "request_processor.cfm", dataType: "json", data: formval, success: function(response){ $('#contentdiv').fadeIn(2000).append(check.gif); } }); }); }); </script> <CFQUERY NAME="myJobs" DATASOURCE="#dbConnection#"> SELECT * FROM Jobs WHERE ID = 35 </CFQUERY> <CFOUTPUT query="myJobs"> <div align="center" id="databox"> <select id="idm"> <CFQUERY NAME = "otherColors" DATASOURCE="#dbConnection#"> SELECT * FROM Colors WHERE Color <> "#State#" </CFQUERY> <option value="#State#">#State#</option> <cfloop query="otherColors"> <option value="#Color#">#Color#</option> </cfloop> </select> <p id="contentdiv"> </p> </div> </CFOUTPUT>I feel like this might not be super-clear, so here's where I want this to end up:
var ud = Lua.lua_touserdata(state, 1); unsafe { var ptr = (int*)ud.ToPointer(); var id = *ptr; }In addition, it also saves the user from themselves. An end user can't accidentally go:
and screw up scripting state.
<TABLE BORDER = "1"> <CFIF (myJobs.RecordCount GT 0)> <CFOUTPUT QUERY="myJobs"> <TR> <CFIF session.admin.equals(True)><TD>#Username#</TD></CFIF> <TD>#Event#</TD> <TD>#PType#</TD> <TD>#OtherDim#</TD> <TD><a href="/Offices/ATIDev/posterprinting/files/#FileName#">#FileName#</a></TD> <TD> <select id="idm" job=#ID#> <CFQUERY NAME = "otherColors" DATASOURCE="#dbConnection#"> SELECT * FROM Colors WHERE Color <> "#State#" </CFQUERY> <option value="#State#">#State#</option> <cfloop query="otherColors"> <option value="#Color#">#Color#</option> </cfloop> </select> </TD> <TD><a href="delete.cfm?ID=#ID#">Delete this job</a></TD> </TR> </CFOUTPUT> </TABLE> <CFELSE> <b>No jobs!</b><br><br> </CFIF> <a href="menu.cfm">Back to main menu</a> </BODY> </HTML> <script language="JavaScript" src="jquery.js" type="text/javascript"></script> <script type = "text/javascript">jQuery(document).ready(function(){ $("#idm").change(function() { <!--- var formval = { idm:$(this) .val(), 35}; ---> var formval = {num: 1, IDM: $(this).val(), id: $(this).attr("job")}; $.ajax({ type: "POST", url: "request_processor.cfm", dataType: "json", data: formval, success: function(response){ $("p").text(JSON.stringify(response)); } }); }); }); </script>So, my new question: I've realized that the jQuery function is only keyed to run off of the "idm" selector. How can I make it so it applies to every selector on the page? (Or a class of selectors (I am pretty sure I can give them all names like "selector_#jobID#"))
You always want to use full userdata for reasons like that; you can also get notified when Lua cleans userdata up so you can let Lua hold on to references to your stuff and you can make a strong link between native and Lua objects
I hope I don't come off like a dick here, but your terminology is really mixed up and it's making it hard for me to follow what you're asking.
id = is an attribute that should uniquely identify an HTML element on a page, as in <select id="idm">
element = the actual HTML element on the page, i.e. the above select tag is an element with id "idm."
selector = the string you pass in to the jQuery $() function to select elements. '#idm' is a selector for elements with the id "idm." '.blue' is a selector for elements with the class "blue." "p#idm.blue" would be a selector for elements of the type "p" of id "idm" and class "blue."
There is no easy way to assign a variable id to elements and select all of them because selectors don't work that way. What you could do is give them all the same class (like "job_element") and then give them varying ids, then use $('.job_element') to select all of them and pull their id from that.
Yeah, right now whenever I create a script instance I am actually keeping it in the Lua registry hashed by it's .NET side hashcode...but I may re-think that. I actually don't want Lua to ever control object lifetime, which is why I'm doing it that way. In fact, the map of objects in the Lua state are all weak references. One of them goes "not alive" anymore, I actually wipe the Lua instance out of the registry as well.
Ah, well it depends on your goals while doing the interface. Mine were to let Lua code use native C++ objects and also to implement native C++ classes while being able to pass the object around in Lua and back to the native code, so userdata use and lifecycle were a must. I actually cheat by defining lua_pushuserdata(), which also lets me ensure a unique userdata per-state.
One of the issues with destroying objects from the native side is that the Lua side representation might be stashed away somewhere to be used later. How are you handling that?
I am using my interface quite a bit different than you are, so that's why some of my constraints are different. I'm not allowing class overrding Lua side or anything like that. My scripting system is more event driven, with object instances either being passed as event arguments, or retrieved through some sort of global function (a lot like the WoW API).
What I do is allow each class binding to specify if Lua is allowed to control lifetime, and even then I let the native code always clean up (since I'm not GCed I have to), I just null out the pointer to my object in the userdata, the glue code then throws errors if it finds a null. This does require you to track every userdata you create though
I think a lot of the difference in approach here is that I am trying to wrangle two different GC's. I need them to play nice, so I have to play a few tricks.
if you don't count a halfdozen failed attempts at home-grown 2D rendering engines in a handful of languages over the past years
this one actually works
once I add in character naming and make the map a little bigger I will post it
http://pygame.org
It's just soooo easy.
I had a friend, passed away, who used to learn languages by first making a *solved* tic-tac-toe implementation, then would move on to tetris, and would finally make a rogue-like before he would feel comfortable with his knowledge of a language.
Whenever he was screwing around with game ideas, it was always with pygame . It just makes all those really monotonous jobs and architectural questions EASY.
Joe's Stream.
Also, here is my Frankenstein reference type...behold, a FlexReference!
public class FlexReference { #region Fields private readonly object _refLock = new object (); private object _hardRef; private int _refCount; private GCHandle _weakRef; #endregion #region Constructors public FlexReference (object inst) : this (inst, false) { } public FlexReference (object inst, bool takeHardRef) { _weakRef = GCHandle.Alloc (inst, GCHandleType.Weak); if (takeHardRef) { AddRef (); } } #endregion #region Properties public bool IsAlive { get { return _hardRef != null || (_weakRef.AddrOfPinnedObject () != IntPtr.Zero && _weakRef.Target != null); } } public object Target { get { if (_hardRef != null) { return _hardRef; } if (_weakRef.AddrOfPinnedObject () == IntPtr.Zero || _weakRef.Target == null) { return null; } return _weakRef.Target; } } #endregion #region Public Methods public void AddRef () { if (!IsAlive) { throw new InvalidOperationException ("Cannot addref an already dead instance"); } Interlocked.Increment (ref _refCount); lock (_refLock) { if (_hardRef == null) { _hardRef = _weakRef.Target; } } } public void DecRef () { if (_refCount == 0) { return; } Interlocked.Decrement (ref _refCount); if (_refCount < 1) { lock (_refLock) { _hardRef = null; } } } #endregion }Event though you are wrong and scum you should check out:
http://www.libgosu.org/
http://rubygame.org/
They are recommended when people ask for Ruby pygame equivalents
In my opinion the hardest aspects are always
1) The concept of a camera and rendering offset for all actors on the stage
2) Spritesheets because no matter how many people try, spritesheets are always clunky and annoying to build and implement
3) Anchor points for rendered objects other than top-left
I've got #1 down. #2 in Canvas is going to be... something
Geometry calcs are a bit of a dick in the butt unless you're used to doing it all the time.
Pretty fun overall, but my professor these days expects me to work on it and add features for my semester projects and I'd just rather not work on it anymore.
Moved on to processor simulations!
Right. If you are just doing the work of creating a game engine to make a game engine, then absolutely, have a blast. If you actually want to make a game, there are better options to actually make a game available to you.
The AI was some of the most fun for me, but I have recurring dreams of going back and making the entire thing
a) some type of MVC
b) more readable/understandable from an architectural standpoint.