1. Post #721
    SirCrest is my life, so is yours.
    Goz3rr's Avatar
    October 2009
    7,319 Posts
    I've finally done something I'm vaguely proud of, a right click menu on the cursor:

    But ruined it by doing this:

    Because goto.

    Why not use break?
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events Disagree Disagree x 5Funny Funny x 2Agree Agree x 2Dumb Dumb x 1 (list)

  2. Post #722

    February 2009
    36 Posts
    Why not use break?
    Good question. I did, but it only took it out of the first nested for loop, so I just did goto instead. I suppose I could break and then set i = tilesHigh to take it out of bounds and stop that loop but bleh.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  3. Post #723
    open.gl
    Overv's Avatar
    February 2007
    7,431 Posts
    Why not use break?
    Because he needs to break out of multiple loops. Goto is a perfectly acceptable solution here. Writing hacks like the one specified above just clutters the code.
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events Agree Agree x 16 (list)

  4. Post #724
    Liquid Helium's Avatar
    October 2010
    114 Posts
    I don't know about other people but in that situation I put the loops in a function and then use return to break out of them all.
    Reply With Quote Edit / Delete Windows 8 United Kingdom Show Events Dumb Dumb x 2 (list)

  5. Post #725
    open.gl
    Overv's Avatar
    February 2007
    7,431 Posts
    I don't know about other people but in that situation I put the loops in a function and then use return to break out of them all.
    And by doing this, you introduce function call overhead and other complexities instead of the simple jump instruction it could have been.
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events Agree Agree x 11 (list)

  6. Post #726
    T3hGamerDK's Avatar
    January 2011
    2,551 Posts
    Previous page crashes my HTC One X phone using Firefox.
    Reply With Quote Edit / Delete Denmark Show Events

  7. Post #727
    SirCrest is my life, so is yours.
    Goz3rr's Avatar
    October 2009
    7,319 Posts
    Does anyone else has moments where you're looking at your code/program and go, 'Aha! I need to fix that!', and then you stop debugging to change it and forgot what it was?
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events Agree Agree x 12Funny Funny x 1Disagree Disagree x 1Dumb Dumb x 1 (list)

  8. Post #728
    AtomiCasd's Avatar
    June 2011
    588 Posts
    Sometimes I get blackouts just by changing file and I end up starting at the screen for 5-10 seconds.
    Reply With Quote Edit / Delete Windows 7 Norway Show Events Agree Agree x 1 (list)

  9. Post #729
    Gold Member
    Robber's Avatar
    January 2006
    6,085 Posts
    Because he needs to break out of multiple loops. Goto is a perfectly acceptable solution here. Writing hacks like the one specified above just clutters the code.
    What about this?
    yLoop:
    for (int y = 0; y < height; y++) {
    	for (int x = 0; x < width; x++) {
    		break yLoop;
    	}
    }
    
    Reply With Quote Edit / Delete Windows 7 Austria Show Events Disagree Disagree x 8Dumb Dumb x 1Programming King Programming King x 1Agree Agree x 1 (list)

  10. Post #730
    Gold Member
    robmaister12's Avatar
    January 2008
    4,969 Posts
    What about this?
    yLoop:
    for (int y = 0; y < height; y++) {
    	for (int x = 0; x < width; x++) {
    		break yLoop;
    	}
    }
    
    works in Java, doesn't work in C#.

    Edited:

    I was looking into using bezier curves to render road lately. You could project two bezier curves on the terrain to create a triangle strip VBO using a shape like this



    Then you can use the strip to render roads that can be modified at runtime. This is the best approach since it support alpha blending and normal mapping, unlike other implementations I've seen before.
    Yeah, I was thinking about doing something like that when I got to road generation (which will probably be after building/structure placement), but with only a single bezier curve and a fixed road width. I'd also have to flatten the terrain under the road (which might look messy if I just drag vertices down)
    Reply With Quote Edit / Delete Windows 7 United States Show Events Informative Informative x 1 (list)

  11. Post #731
    Gold Member
    HiredK's Avatar
    November 2006
    421 Posts
    I'm running into so many problems lately it's unbelievable. I can't believe that native GLSL doesn't support C macros while HLSL has already been doing it for a long time now. Finally I decided to switch to nVidia CG but the damn website is down
    Reply With Quote Edit / Delete Windows 7 Canada Show Events

  12. Post #732
    Team Hamster
    jalb's Avatar
    December 2009
    559 Posts
    From the people who brought you Terrifying Mike, I present to you... Debug Mode


    if we spent nearly as much time programming as we do making these stupid videos, maybe this wouldn't happen
    Reply With Quote Edit / Delete Windows 7 United States Show Events Funny Funny x 22 (list)

  13. Post #733
    Map in a box's Avatar
    July 2009
    7,201 Posts

    malloc is fun.
    Reply With Quote Edit / Delete Windows XP United States Show Events Artistic Artistic x 15Funny Funny x 3Late Late x 1Programming King Programming King x 1 (list)

  14. Post #734
    Gold Member
    Jawalt's Avatar
    August 2007
    3,478 Posts
    Code:
    function tabletolua(rt, key, nhigh)
        tstr = ""
    
        if key then
            if type(key) == "string" then
                if nhigh then
                    key = "[\"" .. key .. "\"]"
                end
            elseif type(key) == "number" then
                key = "[" .. key .. "]"
            end
            tstr = tstr .. key .. " = {"
        end
    
        for k,v in pairs(rt) do
            if type(v) == "table" then
                tstr = tstr .. "\n"
                tstr = tstr .. tabletolua(v, k, true) .. ","
            elseif type(v) == "number" then
                tstr = tstr .. "[\"" .. k .. "\"] = " .. v .. ","
            end
            tstr = tstr .. "\n"
        end
    
        if key then
            tstr = tstr .. "}"
        end
    
        return tstr
    end
    This is a terribly written function, but what it does is a pretty neat idea I think. I'm writing a config file manager for my game since some settings have to be set before the window is created, and I want to be able to save changes made in-game back to the config file.

    So what I did is the only logical thing. I hacked together a quick function that supports saving Lua tables back to files in valid Lua code. This is no where near finished, but I don't need it to be. It took me ~5 minutes and it serves it's purpose.

    tldr; I can load lua files as config files and save them back for next time in lua.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Artistic Artistic x 1 (list)

  15. Post #735
    Gold Member
    thomasfn's Avatar
    July 2008
    2,960 Posts
    Attempting to decode the Riven movie files now. They're quicktime mov files, using the cinepak video codec and the IMA 4:1 audio codec.

    So far I've managed to create the parser which decodes the mov files using the spec, now I gotta figure out how to decode the audio and video into usable data.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  16. Post #736
    Gold Member
    GamingRobot32's Avatar
    January 2012
    154 Posts

    Getting some weird things while trying to make terrain
    Reply With Quote Edit / Delete Windows 7 United States Show Events Artistic Artistic x 14 (list)

  17. Post #737
    quality poster
    Dennab
    August 2009
    12,242 Posts

    Getting some weird things while trying to make terrain
    floating islands! that's neat lookin

    do you have some kind of angle cutoff so that edges that extend beyond 90 degrees aren't smoothed? ie could you make the bottom of the little islands smooth, but have the tops/edges remain sharp
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 5Dumb Dumb x 1 (list)

  18. Post #738
    Gold Member
    GamingRobot32's Avatar
    January 2012
    154 Posts
    floating islands! that's neat lookin

    do you have some kind of angle cutoff so that edges that extend beyond 90 degrees aren't smoothed? ie could you make the bottom of the little islands smooth, but have the tops/edges remain sharp
    There is a cutoff but its only if the z cord is greater then 128, that's why its flat on top.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  19. Post #739
    Facepunch's Local Lycanthrope
    Contron's Avatar
    December 2008
    1,768 Posts
    So a while ago I made a post about my rudimentary image format I was working on, some of you may remember it.

    Today I thought I'd work on it some more, and so far, the results have been pretty good. It's lossless, and compared to TGA, there is a 250% reduction in filesize.

    I took a raw image from a poster export from Source Filmmaker, and converted it:



    The file in question (compressed to JPG obviously)

    When converted to PNG, the filesize was still larger than my image format (but only by 50kb )

    Edit:

    Even when the TGA was compressed, it was still 1MB larger.
    Reply With Quote Edit / Delete Windows 7 Jersey Show Events Programming King Programming King x 4Funny Funny x 1 (list)

  20. Post #740
    Kate Adams
    COBRAa's Avatar
    June 2009
    976 Posts
    Because he needs to break out of multiple loops. Goto is a perfectly acceptable solution here. Writing hacks like the one specified above just clutters the code.
    I wish you could do something like this:

    for(int x = 0; x < 99; x++)
        for(int y = 0; y < 99; y++)
        {
            if(something)
                break 2;
        }
    
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Disagree x 5Funny x 2Agree x 2Optimistic x 1Dumb x 1Useful x 1 (list)

  21. Post #741
    Gold Member
    Darwin226's Avatar
    January 2009
    4,079 Posts
    Reply With Quote Edit / Delete Windows 7 Croatia Show Events Winner Winner x 1 (list)

  22. Post #742
    Paid for a title.
    Maurice's Avatar
    June 2005
    6,175 Posts
    I wish you could do something like this:

    for(int x = 0; x < 99; x++)
        for(int y = 0; y < 99; y++)
        {
            if(something)
                break 2;
        }
    
    Question is, would it go through the rest of the x loop?
    Edit: Actually probably not.
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Disagree Disagree x 5 (list)

  23. Post #743
    RUBY OVERLORD
    swift and shift's Avatar
    November 2011
    2,115 Posts
    I wish you could do something like this:

    for(int x = 0; x < 99; x++)
        for(int y = 0; y < 99; y++)
        {
            if(something)
                break 2;
        }
    
    I find this is less clear than breaking to a label.
    Reply With Quote Edit / Delete Mac Australia Show Events Agree Agree x 20Informative Informative x 1 (list)

  24. Post #744
    no-named's Avatar
    July 2008
    740 Posts
    Managed to make and draw a model. I have to look into what the black line going around it is caused by, though

    Reply With Quote Edit / Delete Windows 7 Denmark Show Events Funny Funny x 1Artistic Artistic x 1 (list)

  25. Post #745
    laylay's Avatar
    November 2007
    599 Posts
    I wish you could do something like this:

    for(int x = 0; x < 99; x++)
        for(int y = 0; y < 99; y++)
        {
            if(something)
                break 2;
        }
    
    I would just not write something that required me to break out of multiple loops, there's always a better way to structure something.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Agree Agree x 8Disagree Disagree x 1Dumb Dumb x 1 (list)

  26. Post #746
    Gold Member
    thomasfn's Avatar
    July 2008
    2,960 Posts
    Not sure why the video only has half a book in, and the colour translation is off, but here is the first frame of a random .mov file from the riven archives!



    No external code used to decode it either, all my own code.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Winner Winner x 12Informative Informative x 1 (list)

  27. Post #747
    For a second I waited for the picture to load..
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events Agree Agree x 14Funny Funny x 5 (list)

  28. Post #748
    olavst's Avatar
    November 2011
    76 Posts
    Working on plugin support for ScreenCloud



    So far so good
    Reply With Quote Edit / Delete Linux Norway Show Events Programming King Programming King x 2Informative Informative x 1 (list)

  29. Post #749
    Tamschi's Avatar
    December 2009
    3,255 Posts
    I worked a bit on more my OpenTK wrapper:



    Loading works without direct calls to GL members, drawing is handled by a Visual class that keeps references to the necessary objects (not really part of the wrapper).

    It's very similar to OOGL I guess, maybe a bit more generic and very incomplete.

    The mesh isn't mine, I just wrote a library for the file format a while back.
    There are animations too but I don't know how to calculate skeletal animation.
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Artistic Artistic x 1 (list)

  30. Post #750
    Gold Member
    thomasfn's Avatar
    July 2008
    2,960 Posts


    Fixed the image cut-off, and now (although I only took a screenshot) it actually loads and draws all the frames of the movie rather than just the first! All I have to do now is fix the colours and the weird patches of shit.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Winner Winner x 10Programming King Programming King x 1 (list)

  31. Post #751
    Richy19's Avatar
    May 2010
    5,384 Posts
    Does anyone know how to use OpenTK/GL in a GTK# window?
    I found GLwidget but I cant get it to compile with it.
    Reply With Quote Edit / Delete Linux United Kingdom Show Events

  32. Post #752
    origamiguy's Avatar
    September 2011
    181 Posts
    Tracked out more of Pushing Onwards, and changed my music storage system from an array of notes to an array of 16-note patterns and an array of pattern IDs (similar to how most music trackers work).

    Pushing Onwards rendered by the GameBoy sound hardware (or rather VisualBoyAdvance's close approximation)
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Artistic Artistic x 2Winner Winner x 1 (list)

  33. Post #753
    Eudoxia's Avatar
    July 2009
    6,009 Posts
    Coloring individual edges:



    The problem here is that many neurites have been identified as being the same.
    Reply With Quote Edit / Delete Linux Uruguay Show Events Artistic Artistic x 3Programming King Programming King x 2 (list)

  34. Post #754
    asdfghjkl.
    Erasus's Avatar
    May 2011
    2,117 Posts
    Hello! I know this has probably been asked loads and loads, but I'm really interested and now I think if I'm going to start coding now is the time to age-wise.

    So what would you guys recommend for me to start coding with? I'm really interested but I just get distracted when looking for something to code with, can you guys help? I've got Unity and VS.. I've been told thats good. But how would I go about learning it?


    Also, I'm sorry about asking this, I'm just so confused and I don't know where else to ask.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  35. Post #755
    www.bff-hab.de
    Dennab
    February 2009
    7,832 Posts
    Hello! I know this has probably been asked loads and loads, but I'm really interested and now I think if I'm going to start coding now is the time to age-wise.

    So what would you guys recommend for me to start coding with? I'm really interested but I just get distracted when looking for something to code with, can you guys help? I've got Unity and VS.. I've been told thats good. But how would I go about learning it?


    Also, I'm sorry about asking this, I'm just so confused and I don't know where else to ask.

    Assembly, best trade of speed and difficulty.
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Funny Funny x 8Disagree Disagree x 1Dumb Dumb x 1 (list)

  36. Post #756
    Gold Member
    Smashmaster's Avatar
    April 2005
    1,506 Posts
    Eh, that's like answering "I want to paint! How should I start?" with "Stab yourself and bleed on some canvas!"
    Reply With Quote Edit / Delete Windows 7 United States Show Events Funny Funny x 14Artistic Artistic x 4 (list)

  37. Post #757
    www.bff-hab.de
    Dennab
    February 2009
    7,832 Posts
    Well, fine.

    Objective-C, best trade of difficulty and popularity.
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Dumb Dumb x 14Disagree Disagree x 1 (list)

  38. Post #758
    Gold Member
    Lexic's Avatar
    March 2009
    6,123 Posts
    Hello! I know this has probably been asked loads and loads, but I'm really interested and now I think if I'm going to start coding now is the time to age-wise.

    So what would you guys recommend for me to start coding with? I'm really interested but I just get distracted when looking for something to code with, can you guys help? I've got Unity and VS.. I've been told thats good. But how would I go about learning it?


    Also, I'm sorry about asking this, I'm just so confused and I don't know where else to ask.
    Why don't you try doing these to get you into the swing of things? 1, 2. (3+ never happened)
    Reply With Quote Edit / Delete Mac United Kingdom Show Events Agree Agree x 1 (list)

  39. Post #759
    quality poster
    Dennab
    August 2009
    12,242 Posts
    Eh, that's like answering "I want to paint! How should I start?" with "Stab yourself and bleed on some canvas!"
    but it was a joke! right luke? right??

    @erasus, look up LOVE2D, go on the wiki and start learning lua. imo its a great way to do it because it gives you visual results and teaches you the basics of programming without having to get into overly complex syntax and things like that.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Optimistic Optimistic x 1Agree Agree x 1 (list)

  40. Post #760
    Gold Member
    Darwin226's Avatar
    January 2009
    4,079 Posts
    Hello! I know this has probably been asked loads and loads, but I'm really interested and now I think if I'm going to start coding now is the time to age-wise.

    So what would you guys recommend for me to start coding with? I'm really interested but I just get distracted when looking for something to code with, can you guys help? I've got Unity and VS.. I've been told thats good. But how would I go about learning it?


    Also, I'm sorry about asking this, I'm just so confused and I don't know where else to ask.
    Depends on how stubborn you are. If you give up easily, you'll need to slowly develop the sense for programming over time. That can be achieved by trying a lot of different languages or starting with some pseudo-programming like Flash, Game Maker, Unity maybe.
    If you want to just write some code, a very simple solution is Microsoft Small Basic.

    If you ARE stubborn, you can try something like Python. It's a relatively simple language and it is pretty widely used today.
    Other options I would recommend are Lua, C# and JavaScript (web development or not).

    If you are interested in any of those things, ask and I can provide more detail.
    Reply With Quote Edit / Delete Windows 7 Croatia Show Events