Nice, abusing me in your picture. :)
Nice, abusing me in your picture. :)
C#
Edited:
I went on to learn C++, then dabble in C, but I wish I spent more time with C# - as I'd like to create desktop applications and not just APIs and libraries for other developers to use.
It's not like I can't do that with C++ and the Windows API or make desktop applications with C++/CLI and .NET, but C# is much more friendly for these things, imo.
Love2D?
Edited:
(I'm assuming he wants to make games quickly and since he knows lua pretty well already..)
I believe he's speaking of the language's lightweight philosophy, as well as being a scripting language in the first place being a limitation for his personal development, in which in many ways he is correct.
That's actually how I got into lua/learned about the language. But making small 2D game projects over and over is kinda getting old.
In fact if I'm gonna do anything with Love2D again it'll probably be to finish off my last project, which I used to post vids of in here quiet often.
Text boxes! :D
It's surprisingly difficult to have a simple console application with "start", "think" and "finish" events in C#.
Code:class Program { private static Thread thdserver; private static bool bExit; public static void Main(string[] args) { SetConsoleCtrlHandler(new HandlerRoutine(ConsoleCtrlCheck), true); bExit = false; thdserver = new Thread(RunServer); thdserver.Start(); while (!bExit) { Thread.Sleep(0); } thdserver.Join(); } private static void RunServer() { bool exit = false; while (!exit) { ServerRoot.Create(); while (!ServerRoot.Instance.Finished) { lock (ServerRoot.Instance) ServerRoot.Instance.Think(); if (bExit) break; } lock (ServerRoot.Instance) ServerRoot.Instance.Shutdown(); exit = !ServerRoot.Instance.Restart; } } private static void HandleExit() { bExit = true; lock (ServerRoot.Instance) ServerRoot.Instance.Shutdown(); } private static bool ConsoleCtrlCheck(CtrlTypes ctrlType) { switch (ctrlType) { case CtrlTypes.CTRL_C_EVENT: HandleExit(); break; case CtrlTypes.CTRL_BREAK_EVENT: HandleExit(); break; case CtrlTypes.CTRL_CLOSE_EVENT: HandleExit(); break; case CtrlTypes.CTRL_LOGOFF_EVENT: case CtrlTypes.CTRL_SHUTDOWN_EVENT: HandleExit(); break; } return true; } #region unmanaged // Declare the SetConsoleCtrlHandler function // as external and receiving a delegate. [DllImport("Kernel32")] public static extern bool SetConsoleCtrlHandler(HandlerRoutine Handler, bool Add); // A delegate type to be used as the handler routine // for SetConsoleCtrlHandler. public delegate bool HandlerRoutine(CtrlTypes CtrlType); // An enumerated type for the control messages // sent to the handler routine. public enum CtrlTypes { CTRL_C_EVENT = 0, CTRL_BREAK_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT = 5, CTRL_SHUTDOWN_EVENT } #endregion }
Does anyone know any good C# tutorials? I tried looking toward microsoft but they have a clusterfuck of information, and youtube has a bunch of people using a drag and drop interface, which I try to avoid.
I got Visual Studio 2010 ultimate, and I have no clue what all this shit does.
You can use a mutex for this, the locking you're doing there isn't really doing anything ;)
the designer is fine for most cases
If you're going to be writing WinForms stuff, it seems to be the best way to go about writing your applications, given you're smart enough to follow user experience guidelines.
That "drag and drop" deal isn't really full on WYSIWYG, so much as it is a way of speeding up UI development. You'll still need to code all of the actions for all of the elements, and a general program flow for anything.
The locking is there because ConsoleCtrlCheck and hence HandleExit comes in from a different thread to the main one (and the one I'm creating). Locking the instance in HandleExit causes the thread to jump back to the one running Think on the instance so that it can shutdown properly - if I don't do this, windows will go ahead and terminate whatever thread it likes without telling me and everything gets messed up.
Still locking an instance of an object isn't a good idea, what if in another thread somewhere in your system that instance gets added to a collection or spun out to another thread? Mutex and lock in c# are practically the same, Mutex is just cleaner for this particular use :D
ohloh crawled my mod a while back it seems, though i didn't notice until i googled "hl2sb" due to laziness in finding my google code page
http://www.ohloh.net/p/hl2sb-src:
of course ohloh's project analysis projections for these sorts of things are generally always outrageously high
Um, yeah.
Wow, yesterday I seriously got things done
And today I've done nothing![]()
I can't code shit and my deadline is tomorrow... it's 2° Celsius here and my finger tips are freezing.. fuck.
In case you're wondering, I live in Egypt. What's next? fucking snow?
riots
Work on the API is going great.
GetForums is 100% working. Implementing it and authentication is pretty simple.
(Highlighted Code)Code:-(void)testFacepunchAPI { FPAPI *apiInstance = [FPAPI sharedInstance]; [apiInstance authenticateWithUsername:@"i300" password:@"colbert2012" andCallbackDelegate:self]; } // Called when Authentication is completed -(void)facepunchAPIAuthenticationComletedWithPayload:(NSDictionary *)payload { FPAPI *apiInstance = [FPAPI sharedInstance];` [apiInstance getForumsWithCurrentSessionAndCallbackDelegate:self]; } // Called when GetForums is completed -(void)facepunchGetForumsCompletedWithForums:(NSArray *)forums { FPCategory *firstCategory = [forums objectAtIndex:0]; NSLog(@"The first category returned by the API is: %@", firstCategory.name); // Outputs // The first category returned by the API is: General Discussion }
Edited:
Woo!
At least those keep you warm.![]()
What does this do differently from:
?enum Foo { Bar, Baz };
Strongly typed enumerations vs. just being "named" integers.
Edited:
I need to stop posting. :( The last few WAYWOs I've ended up being one of the most frequent posters and a good portion of my posts are jokes and some light progress here and there.
Gotcha. Seems like quite a small, albeit useful feature... I wish Microsoft would hurry up and update VS2010 to use the rest of this new stuff. Unless it's changed very recently, they're not even supporting lambda functions yet, which makes me a very sad panda.
It bases it on LOC and the COCOMO algorithm, which is a great way to exploit people. Also, it probably is a considerable figure somewhere in the millions, you just didn't write all that code. Most of it's from the Source SDK, Lua, and any other libraries you used and committed.
It was just a poke at the project, really. I was talking to turb about how I think HL2:SB is actually comprised of less code than his project Twostroke.
Edited:
There's multitudes more LOC for the Source Engine Lua API than the Lua C API inside of the repository.
They don't even fully support C99 yet, let alone C++11; which is somewhat laughable considering the improvements C99 brings.
I'm not surprised, MSVC has always been pretty terrible compared to most (all?) other C compilers.
If only their debugger wasn't so god damned amazing.
My VS2010 supports lambdas. They don't have "complete" support for lambdas yet (whatever that means) but they're definitely in there. I've been using them for months now.
Running VS2010 Ultimate.
Hm, maybe I missed one of the updates. I'll play with it tomorrow and see (it's 5:34am right now, I don't even know why I'm still up...)
This is a wonderful resource, Puska. I'm trying desperately to understand the mathematical notation (with limited success), and trying to implement the code (with limited understanding). I'm assuming the sign() function is this sort of thing, I'll be the first to admit I am not proficient with the Cs.
Once I have a bit more time I'm going to sit down with this and figure out what everything does, but thanks a ton for the help!
Depends on how you approach it but generally, children get to process them first, then they pass it on to the parent.
If you want to check if a control was clicked you'll need to check if any of it's children are clicked.
The only C++11 compiler out there right now that doesn't is clang, and that's a combination of Apple's blocks and ObjC being their priority on that front. Also no one wanted to work on it, but the next version of clang (3.1) should have them. Finally.
GCC doesn't implement the full C99 standard either: link. As for C99 features, you've got enough features in terms of the preprocessor etc. that it doesn't matter all that much. yeah declaring a int within a for loop is pretty swag but honestly if you're writing C99 and want to use the Win32 SDK you should just be using clang anyhow (NOTE: Clang uses C99 by default, so 'deal with it')
If anything, I wouldn't be surprised if there was some crazy stealth update to the C compiler with VS2011 that makes the compiler C11 compliant, considering VLAs are now optional, as are a bunch of stuff that other compilers never really got around to implementing properly, and was pretty much the number one issue with MSVC's basic C support. (I've got no idea why they would put a static_assert in there though, considering the new generics system is anything close to reasonable :/)
It works by getting a random number from -1 to 1. When you square it it gets closer to zero, proportionally to how small it already is. 0.5 for example gives 0.25 when 0.1 gives 0.01
Then what it does is reverse it. Meaning that the smaller it got, the greater the result is (for the positive part that is. Works the same for negative).
Then he just transforma it to the range you've given.
Et voilą
Added a number-only textbox (and a separator I guess) and now the edit box is complete!
Actually, I think I need to come up with better colours for it.
It's almost readable like a programming language![]()
Merged the two compilers and linker into a single executable which takes a dictionary file instead of a bunch of random command line arguments. It's much cleaner and friendlier to work with now. :3
Also, the engine's been fleshed out enough to so I can make simple games like this in it.
Thread-per-client model for servers is not the best option. :/
Runs out of memory when there are 1359 simultaneous clients.
Shit.
like, everything. not just the text ._.
Edited:
http://i.imgur.com/iJqV3.jpg bam