Messages - p3lb0x [ switch to compact view ]

Pages: prev1 ... 3 4 5 6 7 [8] 9 10 11 12 13 ... 84next
36
Developer's Corner / Re: Your First Programming Language vs Now
« on: July 17, 2017, 10:33 AM »
What was your first programming language?
I think the first programming language I really did anything in was Lua for creating mods for the game Cortex Command.
Amounting to:

Eventually moved on to PHP for programming class in high school (and hating it immensely) and Assembly for the electronics class (though I used C for the final project)
This translated well into Assembly, then C, then C++ and C# at university.

Can you remember a snippet from that language?
Not really, I do dabble every now and then in Lua for various reasons (WoW interface mods being the latest IIRC)

What's your current language of choice?
I've become really partial to C# because of the convenience of having most common things handled for you through the .NET framework. And the syntax is pleasing to me. C++ is my bae, though.

How would you rewrite that snippet in your current language?
If I had to rewrite something similar to the Brolands mod in C# I would definitely take advantage of the OOP paradigm.
Here is the single file I had for pretty much all code used. Note uneven indentation, barely any refactoring of code blocks to functions and pointer being used instead of reference as Lua has no pointers.

37
DC Gamer Club / Re: Factorio - Automate All the Things!
« on: July 15, 2017, 04:05 PM »
One extra small thing to shove into Factorios already large pot of praise. I bought the game and sent the developers a small encouragement email and apology for pirating the game earlier (The Demo wasn't a good showcase of the late game in my opinion, and from what I heard). They responded humbly and thanked me for the praise. Definitely seem like nice and listening people.

38
It's very rough, just as soon as I figure out how to actually package it, I'll put it up. Sourcecode as well (probably gonna do a bit of clean up first).

Here you go, binary is in the root of the rar and source code is in the directory. It IS made using C# and .NET v4.5.2. So you'll need to get the redistributable from Microsoft if you don't have it already. In case you're running Linux it would have to be ported to mono or something, and I don't have that installed at the moment (and I am using WPF, so UI would have to be redone).

Instructions:
Select a sound
Select a color (no color picker, wasn't as trivial to do as the other stuff)
Select retrigger delay (How long it will wait before triggering again, set it to 0 for only triggering once)
Select a rectangle to "look" in (Might be a bit fidgetry, I think I accidentally set the "drag" area on the border of the rectangle, which can be a bit hard to hit).
Then hit start.

Notes:
The retrigger delay is not timed perfectly, don't expect it to be.
I am not sure what bugs there are if any, if there are any they shouldn't be bad for your PC.
Only wave sound files can be played. I just used what was built into .NET, I saw that I might have been able to use some Windows Media Player dependent calls, but I didn't.

Improvements:
Most of the things you mentioned like multiple regions, different colors, sounds, etc
Better UI
Fix the dragging of the selection window (maybe add a cancel as well? At the moment you can only accept new areas if you accidentally hit the selection for it)
Tasks are probably being used inappropriately, as I haven't done any desktop application GUI work in ages and probably forgot a lot of things.
Change the sound player to something that can accept more sound types.
Maybe add tolerance for colors?

Put it through VirusTotal: https://www.virustotal.com/en/file/fd9007fae0e85b6ad7e43a7f84b80b0087cb9e54b2ea303348f967f522a27057/analysis/1500138024/
Seems I am getting a false positive for git. And maybe because I am doing some pointer manipulation.

39


I have made this, is this about what you wanted in its simplest form?

edit: At the moment it can only play wave files, but that can pretty easily be changed, multiple files or checks isn't possible with how I set it up and the program would have to be done very differently (Although that is entirely possible to do with the code I have, I am just not that great at UI programming)

edit edit: I haven't tested it with very large resolution squares. Only in the 250x250 area. I am fairly certain that it won't perform very well at larger resolutions as it is checking every single pixel for a value at a frequency of 20 times a second.

edit edit edit: I also haven't tested it with multiple monitors as the monitors I have at the moment are way too ancient to interface with my videocard. But I am confident that way I am doing things can be fixed to work with multiple screens without too much work if it doesn't already.

edit edit edit edit: Tried it in a fairly large (1000x800'ish) area and it ran with no problems on my machine, but I am running a fairly beefy older generation i7.

40
I got the basic idea down, now I just need to wrap it in a UI.
bacon.pngwat.gif
(Disregard that I am hijacking the console window to draw the captured bitmap, this is just for testing)

I am not sure if I am handling this in the best way possible, I am basically taking a screenshot every X milliseconds, and running through the entire bitmap looking for a pixel with the color you want.

Pages: prev1 ... 3 4 5 6 7 [8] 9 10 11 12 13 ... 84next
Go to full version