1. Post #361
    ASK ME ABOUT MY PLAYBOOK INSTEAD OF COLLEGE
    icantread49's Avatar
    April 2011
    1,616 Posts
    programming-too-much alert
    does this really happen to people? i mean i've been programming for years and i've never found myself ending my sentences like this;
    Reply With Quote Edit / Delete Windows XP United States Show Events Agree x 22Funny x 3Disagree x 2Zing x 1Programming King x 1 (list)

  2. Post #362
    Andrew McWatters
    Dennab
    March 2011
    4,658 Posts
    #define bad new
    /* maybe you're just a */ bad Coder();
    Reply With Quote Edit / Delete Windows 7 United States Show Events Programming King Programming King x 21Funny Funny x 1Zing Zing x 1 (list)

  3. Post #363
    Gold Member
    Ortzinator's Avatar
    May 2005
    1,645 Posts
    does this really happen to people? i mean i've been programming for years and i've never found myself ending my sentences like this;
    So are people agreeing to the first sentence or the second?
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree x 7Funny x 4Disagree x 1Artistic x 1Programming King x 1 (list)

  4. Post #364
    Gold Member
    ZenX2's Avatar
    February 2009
    4,651 Posts
    Okay, working on Text-Based User Interface, so far I've got buttons
    Also nothing moves and there's no parenting
    Reply With Quote Edit / Delete Windows 7 United States Show Events Programming King Programming King x 1 (list)

  5. Post #365
    Gold Member
    efeX's Avatar
    April 2009
    2,332 Posts
    does this really happen to people? i mean i've been programming for years and i've never found myself ending my sentences like this;
    seriously. people just say it to say it;
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 11Programming King Programming King x 1 (list)

  6. Post #366
    Gold Member
    ZenX2's Avatar
    February 2009
    4,651 Posts
    I'm thinking of trying a new way of handling entities. Most of the time I just through them all in a table and tell them what index they're at, then iterate through it to do stuff.
    Any suggestions?
    Reply With Quote Edit / Delete Windows 7 United States Show Events Programming King Programming King x 1 (list)

  7. Post #367
    Gold Member
    Rohans's Avatar
    September 2010
    151 Posts
    Okay, working on Text-Based User Interface, so far I've got buttons
    Also nothing moves and there's no parenting

    Made this a long time ago. The code is ugly and slow.
    Reply With Quote Edit / Delete Windows 7 Canada Show Events Programming King Programming King x 10 (list)

  8. Post #368
    RUBY OVERLORD
    swift and shift's Avatar
    November 2011
    2,115 Posts

    Made this a long time ago. The code is ugly and slow.
    nostalgia



    Edited:

    I wonder if I still have any of my old freepascal crap anywhere
    Reply With Quote Edit / Delete Mac Australia Show Events Programming King Programming King x 2 (list)

  9. Post #369
    Gold Member
    Octave's Avatar
    January 2009
    2,528 Posts
    Just finished redoing my interpreted language's parser and interpreter, nothing impressive to show for it, but the benchmarks are getting better - 100000 fibonacci numbers in about 139 ms
    Reply With Quote Edit / Delete Linux United States Show Events Winner Winner x 1Programming King Programming King x 1 (list)

  10. Post #370
    Gold Member
    synthiac's Avatar
    June 2007
    1,062 Posts
    play the raw PCM files
    and uh why do you need libvgmstream for this?

    unless you mean adpcm then well okay
    Reply With Quote Edit / Delete Windows 7 United States Show Events Programming King Programming King x 1 (list)

  11. Post #371
    Gold Member
    robmaister12's Avatar
    January 2008
    4,951 Posts
    Picking up work on my FreeType bindings again and testing on linux. Apparently POSIX uses 32 bit ints and 64 bit long/long long/pointers while Windows uses 32 bit int/longs and 64 bit long long/pointers. A lot of values in FreeType are longs and sizeof(long) is determined at compile time and not runtime... any ideas?
    Reply With Quote Edit / Delete Linux United States Show Events Programming King Programming King x 1 (list)

  12. Post #372
    RUBY OVERLORD
    swift and shift's Avatar
    November 2011
    2,115 Posts
    use types like int32_t, int64_t
    Reply With Quote Edit / Delete Mac Australia Show Events Programming King Programming King x 1 (list)

  13. Post #373
    Gold Member
    robmaister12's Avatar
    January 2008
    4,951 Posts
    use types like int32_t, int64_t
    Determine size on the C# side, should have clarified that.
    Reply With Quote Edit / Delete Linux United States Show Events Programming King Programming King x 1 (list)

  14. Post #374
    Gold Member
    Chandler's Avatar
    February 2006
    1,402 Posts
    I'm running into so many problems with CMake, it's driving me up a wall. Anything beyond "grab these files and compile them" seems to take a huge number of additional functions and hand-crafted parsing within CMake's world.

    (I'm sorry for complaining about this shit, but I just spent an hour trying to get a basic regex parsing to work so I could force breakpoints into a file because CMake doesn't seem to be working with any breakpoints I insert for visual studio. I'm so sick of CMake's shit, I'm getting ready to start up my own build system again, so help me... )
    Reply With Quote Edit / Delete Windows 7 United States Show Events Programming King Programming King x 1 (list)

  15. Post #375
    Jaykin' Bacon: Episode Three
    Jimbomcb's Avatar
    February 2005
    21,306 Posts
    rewriting - yet again - the tf2 websockets spectator, except better. Have the 'master server' pretty much done and supporting feeds from multiple servers just need to finish up the websockets side and start on the browser side of the project
    Reply With Quote Edit / Delete Show Events Winner Winner x 6Programming King Programming King x 1 (list)

  16. Post #376
    Gold Member
    robmaister12's Avatar
    January 2008
    4,951 Posts
    Picking up work on my FreeType bindings again and testing on linux. Apparently POSIX uses 32 bit ints and 64 bit long/long long/pointers while Windows uses 32 bit int/longs and 64 bit long long/pointers. A lot of values in FreeType are longs and sizeof(long) is determined at compile time and not runtime... any ideas?
    Turns out IntPtr.Size works, as the Windows binary I built was 32 bit - It probably won't work with a native 64bit binary but I'll test that later - what's important now is that I have it working on both Windows and Linux.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Programming King Programming King x 1 (list)

  17. Post #377
    Gold Member
    Bluefire's Avatar
    August 2007
    323 Posts
    and uh why do you need libvgmstream for this?

    unless you mean adpcm then well okay
    Yeah, its mostly for adpcm, as well as the ability to decode all the other game audio formats.
    Reply With Quote Edit / Delete Windows 7 Canada Show Events Programming King Programming King x 1 (list)

  18. Post #378
    Interesting that you say that. Friend.
    NorthernGate's Avatar
    August 2007
    3,378 Posts
    Was bored and set my Render component to easily animate sprite sheets. I haven't really got any images to show it off because making a gif for a flashing box seems like a lot of effort. But the code looks nice and simple:

    var i = _test.Use<Render>();
    i.IsAnimated = true; // The Render Component needs to have animations turned on, otherwise it'll just draw the whole texture
    i.Animation = 2; // You can set which animation is being played (Different animations are stored along the y-axis, while frames for each animation are stored on the x-axis)
    i.FramesPerSecond = 5.25f; // You can also change the rate of the animation by setting how many frames are displayed per second, I found this to be a bit more intuitive and productive than an arbitrary 'Speed' property.
    

    I was going to do it so it loaded multiple images for animation instead, but that seemed like more effort for some reason.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Programming King Programming King x 1 (list)

  19. Post #379
    Gold Member
    ZenX2's Avatar
    February 2009
    4,651 Posts




    Edited:

    This will prove itself to be useful
    Reply With Quote Edit / Delete Windows 7 United States Show Events Funny Funny x 13Programming King Programming King x 1 (list)

  20. Post #380
    Gold Member
    Jookia's Avatar
    July 2007
    6,534 Posts
    I'm running into so many problems with CMake, it's driving me up a wall. Anything beyond "grab these files and compile them" seems to take a huge number of additional functions and hand-crafted parsing within CMake's world.

    (I'm sorry for complaining about this shit, but I just spent an hour trying to get a basic regex parsing to work so I could force breakpoints into a file because CMake doesn't seem to be working with any breakpoints I insert for visual studio. I'm so sick of CMake's shit, I'm getting ready to start up my own build system again, so help me... )
    PM me before you do sometehing dangerous. I know CMake.
    Reply With Quote Edit / Delete Linux Australia Show Events Programming King Programming King x 1 (list)

  21. Post #381
    Gold Member
    Chandler's Avatar
    February 2006
    1,402 Posts
    PM me before you do sometehing dangerous. I know CMake.
    It's not so much that I don't know CMake, but trying to do a lot of work in loops, which saves a bunch of time ends up taking a lot more time because I can't do shit that makes sense like set a scoped variable to a function to be called. Tcl lets you do this, which would make more sense given cmake's syntax :|
    Reply With Quote Edit / Delete Windows 7 United States Show Events Programming King Programming King x 1 (list)

  22. Post #382
    Gold Member
    SamPerson123's Avatar
    September 2007
    3,411 Posts
    I've been getting back into programming after not making anything for a long time, mostly because of the class I'm taking.

    This was our first assignment worth mentioning. I thought it was interesting enough to post it here.

    Code:
    public class IndirectlyOrderedArray {
    
        private String[] a;
        private int[] k;
        private int size;
    
        public IndirectlyOrderedArray(int size) {
            this.size = size + 1;
            a = new String[this.size];
            k = new int[this.size];
            k[0] = -1;
        }
    
        public boolean insert(String node) {
            int dataLoc;
            for (dataLoc = 1; dataLoc < size && a[dataLoc] != null; dataLoc++);
            if (dataLoc == size) {
                return false;
            }
            for (int index = 0; index != -1; index = k[index]) {
                if (k[index] == -1 || a[k[index]].compareTo(node) > 0) {
                    k[dataLoc] = k[index];
                    k[index] = dataLoc;
                    a[dataLoc] = node;
                    return true;
                }
            }
            return false;
        }
    
        public boolean delete(String node) {
            for (int index = 0; k[index] != -1; index = k[index]) {
                if (a[k[index]].equals(node)) {
                    a[k[index]] = null;
                    k[index] = k[k[index]];
                    return true;
                }
            }
            return false;
        }
    
        public String showOrdered() {
            String out = "";
            for (int i = k[0]; i != -1; i = k[i]) {
                out += a[i] + " ";
            }
            return out;
        }
    
        public String showUnordered() {
            String out = "";
            for (int i = 0; i < size; i++) {
                out += a[i] + " " + k[i] + "\n";
            }
            return out;
        }
    }
    It does kind of bother me that there isn't anything in the first index, but the assignment specifically said to leave it empty.

    It's supposed to make it so that an array can stay in order without having to copy the contents around all of the time. Since the indices each point to the next element, it never has to change more than two to stay in order.

    This was much more fun than I thought it would be, I'm just glad to be programming again.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Programming King Programming King x 2 (list)

  23. Post #383
    Gold Member
    Jookia's Avatar
    July 2007
    6,534 Posts
    It's not so much that I don't know CMake, but trying to do a lot of work in loops, which saves a bunch of time ends up taking a lot more time because I can't do shit that makes sense like set a scoped variable to a function to be called. Tcl lets you do this, which would make more sense given cmake's syntax :|
    Why don't we have both?
    Reply With Quote Edit / Delete Linux Australia Show Events Programming King Programming King x 1 (list)

  24. Post #384
    Gold Member
    ZenX2's Avatar
    February 2009
    4,651 Posts
    I think I stumbled upon something I shouldn't have


    Edited:



    Some actual progress on le menu

    The exit button actually works!

    Edited:

    The terminal is 80x30 characters right now, I can't shake the feel that the characters are a bit too tall
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 1Programming King Programming King x 1 (list)

  25. Post #385
    Gold Member
    Electroholic's Avatar
    June 2011
    2,213 Posts
    Holy shit gesture recognition is hard to program. I'm trying to make it so if the fingers are dragged together the camera pans but if they are pinched, it zooms. I thought it would be easy but I cant get it :(
    Reply With Quote Edit / Delete Windows 7 Canada Show Events Programming King Programming King x 1 (list)

  26. Post #386
    hOnK :o)
    i300's Avatar
    December 2009
    3,987 Posts
    Holy shit gesture recognition is hard to program. I'm trying to make it so if the fingers are dragged together the camera pans but if they are pinched, it zooms. I thought it would be easy but I cant get it :(
    It's funny because gesture recognition is built into the iOS API and it is super simple to implement.

    Native code woo!
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 1Programming King Programming King x 1 (list)

  27. Post #387
    Gold Member
    Lord Ned's Avatar
    April 2006
    3,702 Posts
    Holy shit gesture recognition is hard to program. I'm trying to make it so if the fingers are dragged together the camera pans but if they are pinched, it zooms. I thought it would be easy but I cant get it :(
    Can you get both touch position as points?

    You could start by checking the x/y position of both points. If they've both increased 'significantly' on one axis from when both points were first registered, than it's a swipe.

    If they've increased on opposite axis' or the distance between them has shrunk 'significantly' from their start position, it's probably a scale.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Programming King Programming King x 1 (list)

  28. Post #388
    Gold Member
    Electroholic's Avatar
    June 2011
    2,213 Posts
    Can you get both touch position as points?

    You could start by checking the x/y position of both points. If they've both increased 'significantly' on one axis from when both points were first registered, than it's a swipe.

    If they've increased on opposite axis' or the distance between them has shrunk 'significantly' from their start position, it's probably a scale.
    The problem is, I'm completely shit at math so I don't know how to check if both fingers have moved in the same direction/distance within a tolerance level;
    Reply With Quote Edit / Delete Windows 7 Canada Show Events Programming King Programming King x 1 (list)

  29. Post #389
    Gold Member
    Chandler's Avatar
    February 2006
    1,402 Posts
    Why don't we have both?
    The developers of CMake said "oh we don't want to use tcl, it's bad" then wrote their own syntax. Obviously tcl makes a lot more sense for a command language (and has proper scopes )

    I'm taking a look at that ninja build system though. It (or a modified fork of it) might actually be what I'm looking for.
    Reply With Quote Edit / Delete Mac United States Show Events Programming King Programming King x 1 (list)

  30. Post #390
    hOnK :o)
    i300's Avatar
    December 2009
    3,987 Posts
    The problem is, I'm completely shit at math so I don't know how to check if both fingers have moved in the same direction/distance within a tolerance level;
    If both fingers' X increased, they're probably moving right. If both fingers' X decreased, left.

    Y Increase == Down, Y Decrease == Up.

    And so on.

    Pinching would be that one finger is moving diagonally down (x decrease, y increase) and one is moving diagonally up (x increase, y decrease).
    Reply With Quote Edit / Delete Windows 7 United States Show Events Programming King Programming King x 1 (list)

  31. Post #391
    Gold Member
    ThePuska's Avatar
    October 2005
    3,335 Posts
    I'm interested, but do they make you actually stay in it and do course work? I just want to see a few of the lectures, to be honest.
    Read the ToS:

    By accessing and/or using the Class Sites or Online Courses, you agree to be bound by the Terms of Use, whether you are:

    a "Visitor," meaning you simply browse the Class Sites, including, without limitation, through a mobile or other wireless device, or otherwise use the Class Sites without being registered, or
    a "Student," meaning that you have registered with KnowLabs for a User ID and User Password (defined below) and will complete the homework assignments and exams, or
    an "Attendee," meaning that you have registered with KnowLabs for a User ID and User Password (defined below) and that you intend to audit the Online Courses, i.e., attend or view lectures online without completing the homework assignments, exams or other course work.
    The term "User" refers to a Visitor, Student or Attendee.


    ...

    The Class Sites are available to any User. However, access to the Online Courses is restricted to Attendees or Students that have a registered User Account. By registering, you agree that:

    you are registered for the course only once and will not set up multiple User Accounts; and
    you will abide by the Terms of Use.

    Additional requirements apply to Students. As a Student, in addition to the points above, you agree that:

    you are registering with the intent to attend lectures, complete homework assignments, take and submit exams and other activities related to taking the class, and subject to satisfactory performance determined in the sole discretion of the instructors, you may be awarded a letter of completion signed by the instructors upon conclusion of the applicable Online Course;
    you acknowledge that any letter of completion awarded will not be affiliated with any college or university and will not stand in the place of a course taken at an accredited institution;
    you acknowledge that instructors of any Online Course will not be involved in any attempts to get the course recognized by any educational or accredited institution; and
    you will abide by the Student Conduct Policy listed below.
    You can register as an "attendee" and follow the lectures without participating in the coursework.
    Reply With Quote Edit / Delete Windows 7 Finland Show Events Programming King Programming King x 1 (list)

  32. Post #392
    Aw yeah got cross compiling working on Linux. Now I'm officially platform-independent!



    Also can any of you test how well the windows version works? I can only test it in wine and it seems to work pretty well: http://67.177.47.177/notss13.tar.gz

    (The linux binaries are in there too!)

    WASD: move
    F: toggle fullbright
    QE: change selected tile
    OP: Load/Save current map to maps/default.nmap
    Works great on Windows 8
    Reply With Quote Edit / Delete Windows 8 Netherlands Show Events Funny Funny x 4Friendly Friendly x 1Programming King Programming King x 1 (list)

  33. Post #393
    RUBY OVERLORD
    swift and shift's Avatar
    November 2011
    2,115 Posts
    Working on my presentation I'm going to give at MelbJS on wednesday night about Twostroke.

    I thought it'd be a cool idea to have some examples showing how Javascript source code gets parsed into an AST and then compiled into bytecode:





    Reply With Quote Edit / Delete Mac Australia Show Events Artistic Artistic x 8Programming King Programming King x 1 (list)

  34. Post #394
    mutated's Avatar
    October 2010
    1,473 Posts
    So I am working on a two-player text-based fighting game in Java. It's a rewrite of some of my old code, which was a terrible exercise in object-oriented programming (even if it was kind of fun to play).

    The basic concept is simple: you give your character a name, a race, a weapon, an armor type, and a consumable item, then you take turns fighting each other and see who runs out of health the soonest.

    Most of the shit in this thread flies right over my head but rest assured you're inspiring, WAYWO.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Informative Informative x 1Programming King Programming King x 1 (list)

  35. Post #395
    RUBY OVERLORD
    swift and shift's Avatar
    November 2011
    2,115 Posts
    Oh yeah, the presentation is written in Javascript and running on Twostroke as well ;)

    Edited:

    automerge fuck
    Reply With Quote Edit / Delete Mac Australia Show Events Programming King Programming King x 2 (list)

  36. Post #396
    Gold Member
    Jookia's Avatar
    July 2007
    6,534 Posts
    The developers of CMake said "oh we don't want to use tcl, it's bad" then wrote their own syntax. Obviously tcl makes a lot more sense for a command language (and has proper scopes )

    I'm taking a look at that ninja build system though. It (or a modified fork of it) might actually be what I'm looking for.
    You can use tcl scripts using cmake's execute_process or add_custom_command.
    Reply With Quote Edit / Delete Linux Australia Show Events Programming King Programming King x 1 (list)

  37. Post #397
    Gold Member
    Darwin226's Avatar
    January 2009
    3,883 Posts
    Working on my presentation I'm going to give at MelbJS on wednesday night about Twostroke.

    I thought it'd be a cool idea to have some examples showing how Javascript source code gets parsed into an AST and then compiled into bytecode:





    Looks awesome.
    How exactly are you going from AST to bytecode?
    Reply With Quote Edit / Delete Windows 7 Croatia Show Events Programming King Programming King x 1 (list)

  38. Post #398
    RUBY OVERLORD
    swift and shift's Avatar
    November 2011
    2,115 Posts
    Looks awesome.
    How exactly are you going from AST to bytecode?
    recursing down the AST: https://github.com/charliesome/twost...piler/tsasm.rb

    So if I have to compile an AST like this:

    Code:
    Add:
        Number: 1
        Multiply:
            Number: 2
            Number: 3
    I'd send that node to a method that compiles 'Add' nodes. That method would then send both of its child nodes to the method that compiles them, and so forth. Basically you're doing a DFS over the AST.

    Pseudo-code:

    Code:
    compile_node(node):
        if node is Add:
            compile_add(node)
        else if node is Multiply:
            compile_multiply(node)
        else if node is Number:
            compile_number(node)
    
    compile_add(node):
        compile_node(node.left)
        compile_node(node.right)
        output "add"
    
    compile_multiply(node):
        compile_node(node.left)
        compile_node(node.right)
        output "mul"
    
    compile_number(node):
        output "push", node.number
    In the end, you would get something like this:

    Code:
    push 1
    push 2
    push 3
    mul
    add
    Reply With Quote Edit / Delete Mac Australia Show Events Useful Useful x 1Programming King Programming King x 1 (list)

  39. Post #399
    Gold Member
    Chandler's Avatar
    February 2006
    1,402 Posts
    You can use tcl scripts using cmake's execute_process or add_custom_command.
    Might as well be writing my own build system at that point
    Reply With Quote Edit / Delete Mac United States Show Events Programming King Programming King x 1 (list)

  40. Post #400
    Gold Member
    Darwin226's Avatar
    January 2009
    3,883 Posts
    recursing down the AST: https://github.com/charliesome/twost...piler/tsasm.rb

    So if I have to compile an AST like this:

    I'd send that node to a method that compiles 'Add' nodes. That method would then send both of its child nodes to the method that compiles them, and so forth. Basically you're doing a DFS over the AST.

    Pseudo-code:

    In the end, you would get something like this:
    Nifty.
    Reply With Quote Edit / Delete Windows 7 Croatia Show Events Programming King Programming King x 1 (list)