Warning: count(): Parameter must be an array or an object that implements Countable in /home/public/wp-includes/kses.php on line 704

Warning: count(): Parameter must be an array or an object that implements Countable in /home/public/wp-includes/kses.php on line 704
Learning C#

Learning C#

So over the spring break, I wrote a quick ~450 line C# program in order to learn the language. Within a day or two I had uScribble, an automatic screen-raster-renderer. To put it simply, it hijacks your mouse and draws things for you. Jumping from Java to C# was actually easier than I had thought. uScribble was basically a from-scratch copy of a similar Java application I had made in the past. There were various improvements, however. Before I get any farther, here is a picture of what it looks like, and what it can do:

Lorenz Attractors and Awesome-Smiley

 

 

First, I had the program draw a Lorenz attractor, and then reproduce a small graphic of a the “Awesome-Smiley”.  Some of the technical hurdles that I faced included figuring out how to hook the mouse cursor at a low level, both to send it movement and click instructions in addition to figuring out what its position and button states were, multithreading the application, and manipulating raster images in various ways (scaling, thresholding, etc). I had programmed similar functionality into the older Java version of this program, but lots of little things were different.

Building a decent graphical user interface (GUI) for the program was easier in C# than in Java, if only because C# lives and breathes inside Visual Studio (which makes GUIs a breeze), while I had programmatically created the Java GUI using Swing. It was easy to multithread the program in either language. I only had to create a function (or in Java, a class) which I then basically started as a new thread. Here is what the final GUI looks like:

uScribble

uScribble

I have yet to touch some of the more interesting features of the C# language. You can use lambda functions with it, which I imagine will make a few types of programs much easier to code. Memory access is another topic I should also explore in the future. Perhaps I will make a memory scanner that finds certain specific values in memory… (Cheat Engine, anyone?) Or perhaps I could program something for the XBox 360. Anyone want to buy me one?

In case you haven’t figured out the most natural use for such a program, let me say that it is really useful in trolling those online, multi-user drawing boards, like iScribble. So in the interest of making the world a more chaotic place, you can download my program here

This entry was posted in Art, C#, Programming. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

2 Comments


  1. Fatal error: Uncaught Error: Call to undefined function ereg() in /home/public/wp-content/themes/thematic/library/extensions/comments-extensions.php:349 Stack trace: #0 /home/public/wp-content/themes/thematic/library/extensions/discussion.php(10): thematic_commenter_link() #1 /home/public/wp-includes/comment-template.php(1694): thematic_comments(Object(stdClass), Array, 1) #2 /home/public/wp-includes/class-wp-walker.php(135): Walker_Comment->start_el('', Object(stdClass), 1, Array) #3 /home/public/wp-includes/comment-template.php(1661): Walker->display_element(Object(stdClass), Array, '5', 0, Array, '') #4 /home/public/wp-includes/class-wp-walker.php(365): Walker_Comment->display_element(Object(stdClass), Array, '5', 0, Array, '') #5 /home/public/wp-includes/comment-template.php(1985): Walker->paged_walk(Array, '5', 0, 0, Array) #6 /home/public/wp-content/themes/thematic/comments.php(34): wp_list_comments('type=comment&ca...') #7 /home/public/wp-includes/comment-template.php(1152): require('/home/public/wp...') #8 /home/p in /home/public/wp-content/themes/thematic/library/extensions/comments-extensions.php on line 349