1. Post #361
    Gold Member
    BackwardSpy's Avatar
    May 2008
    6,430 Posts
    I think you have to loop until bytesRead == 0
    Well, that's what I tried doing at one point, and it works in some cases and not others. It occasionally will get me the output line by line, but sometimes it'll just spam me with the entire output each iteration of the loop. It's really odd :/
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  2. Post #362
    PLEASE DON'T EAT ME!
    Doritos_Man's Avatar
    June 2009
    2,899 Posts
    Code::Blocks is the best IDE for C and C++ correct?
    Reply With Quote Edit / Delete Windows 7 United States Show Events Funny Funny x 3Agree Agree x 2Disagree Disagree x 2 (list)

  3. Post #363
    Gold Member
    esalaka's Avatar
    July 2007
    10,130 Posts
    Nah, vim.
    Reply With Quote Edit / Delete Windows 7 Finland Show Events Dumb Dumb x 3Programming King Programming King x 1Disagree Disagree x 1 (list)

  4. Post #364
    PLEASE DON'T EAT ME!
    Doritos_Man's Avatar
    June 2009
    2,899 Posts
    Nah, vim.
    But for windows?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  5. Post #365
    Gold Member
    BackwardSpy's Avatar
    May 2008
    6,430 Posts
    Code::Blocks is the best IDE for C and C++ correct?
    "Best" is subjective, personally I prefer (as do many people) Visual Studio 2010. Of course, if you're looking for a decent Linux IDE then yes, Code::Blocks may well be your best choice.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Agree Agree x 2Disagree Disagree x 1 (list)

  6. Post #366
    dajoh's Avatar
    March 2011
    625 Posts
    Code::Blocks is the best IDE for C and C++ correct?
    It's alright, not nearly as good as Visual Studio though.

    Nah, vim.
    Vim is not an IDE.
    Reply With Quote Edit / Delete Windows 7 Sweden Show Events Agree Agree x 3Disagree Disagree x 2 (list)

  7. Post #367
    T3hGamerDK's Avatar
    January 2011
    2,551 Posts
    It's alright, not nearly as good as Visual Studio though.



    Vim is not an IDE.
    Id say that with the extensions for there exists for vim, it may as well be.
    Reply With Quote Edit / Delete Denmark Show Events Disagree Disagree x 4Dumb Dumb x 2Funny Funny x 1 (list)

  8. Post #368
    Gold Member
    Mr. Bleak's Avatar
    March 2011
    4,932 Posts
    Another very basic Python question.

    Would someone explain the difference between something like %-6.2f and plain old %.2f? I know the .2 means add 2 decimal points, but what do numbers that come before the decimal mean?
    Reply With Quote Edit / Delete Windows XP United States Show Events

  9. Post #369
    Felipe's Avatar
    October 2011
    83 Posts
    Where do I start if I want to learn C++?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  10. Post #370
    dajoh's Avatar
    March 2011
    625 Posts
    -snip-
    Reply With Quote Edit / Delete Windows 7 Sweden Show Events

  11. Post #371
    sim642's Avatar
    July 2010
    1,039 Posts
    Where do I start if I want to learn C++?
    Use learncpp.com if you haven't programmed before.
    Reply With Quote Edit / Delete Windows Vista Estonia Show Events

  12. Post #372
    WolfeClaw's Avatar
    February 2010
    5,566 Posts
    Where do I start if I want to learn C++?
    If you prefer watching videos and you're completely new to programming, there's a guy on Youtube that has a bunch of tutorials for learning C++, check him out.

    http://www.youtube.com/antirtfm
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Funny Funny x 2Agree Agree x 1 (list)

  13. Post #373
    Felipe's Avatar
    October 2011
    83 Posts
    Use learncpp.com if you haven't programmed before.
    Thank you!

    Edited:

    If you prefer watching videos and you're completely new to programming, there's a guy on Youtube that has a bunch of tutorials for learning C++, check him out.

    http://www.youtube.com/antirtfm

    Thanks to you too!
    Reply With Quote Edit / Delete Windows 7 United States Show Events Friendly Friendly x 1 (list)

  14. Post #374
    Gold Member
    esalaka's Avatar
    July 2007
    10,130 Posts
    Gee guys you don't have any sense of humor do you :saddowns:
    Reply With Quote Edit / Delete Windows 7 Finland Show Events

  15. Post #375
    Darkest_97's Avatar
    February 2011
    186 Posts
    When drawing 2d sprites in XNA(or any language I guess) should all of my sprites be big, and I scale them down when I draw them? If yes, why?

    I've always made my sprites the exact size they would be in game.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  16. Post #376
    Gold Member

    March 2005
    3,028 Posts
    Code::Blocks is the best IDE for C and C++ correct?
    It's the best IDE for C, because MSVC doesn't support modern C.
    It is my IDE of choice for C++ (when I'm not just using vim and GNU tools), too, because I prefer GCC as a compiler. Also, I'm an FOSS nut and I dislike Microsoft.

    Really, though, you don't really need half the bells and whistles modern IDEs have. They've gotten to the point where the difference between IDE 'A' and IDE 'B' is some obscure feature of marginal value.
    Coding should be about the theory and the code, not about how well your editor guesses what you're about to type.
    Reply With Quote Edit / Delete Windows 7 Show Events Agree Agree x 4Friendly Friendly x 1 (list)

  17. Post #377
    Team Hamster
    jalb's Avatar
    December 2009
    559 Posts
    When drawing 2d sprites in XNA(or any language I guess) should all of my sprites be big, and I scale them down when I draw them? If yes, why?

    I've always made my sprites the exact size they would be in game.
    I'd think that depends on what you're doing. The indie retro games scale up their graphics to be pixelated. Some games have really HQ graphics and scale them down but have some sort of graphical effect over them so it doesn't look terrible. I'd think for the most part you'd want your graphics to be the same size as they are in game.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  18. Post #378
    Gold Member
    WTF Nuke's Avatar
    March 2009
    4,460 Posts
    Got any ideas how to check collisions between 2 moving objects? 2d, I want one object to be pushed (the player), but I'm not sure how to check.
    Reply With Quote Edit / Delete Windows 7 Canada Show Events

  19. Post #379
    lord0war's Avatar
    June 2010
    1,812 Posts
    I really want to learn C#, because I heard it was a good beginner language. Does anyone know any good tutorials for it? And what program should I use to code it? My only experience in coding is a half year in school where we did basic stuff with java in BlueJ.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  20. Post #380
    HQRSE FUCKER
    ief014's Avatar
    September 2009
    3,053 Posts
    I really want to learn C#, because I heard it was a good beginner language. Does anyone know any good tutorials for it? And what program should I use to code it? My only experience in coding is a half year in school where we did basic stuff with java in BlueJ.
    There are tons of C# tutorials on the internet that can be easily accessed with a google search. However, books are the best tutorials. If you have a few bucks to spare I recommend http://headfirstlabs.com/books/hfcsharp/

    I guarentee you'll be using Visual Studio for programming C#. (for pretty much all tutorials you'll come across)
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Friendly Friendly x 1 (list)

  21. Post #381
    Gold Member

    March 2005
    3,028 Posts
    Got any ideas how to check collisions between 2 moving objects? 2d, I want one object to be pushed (the player), but I'm not sure how to check.
    What sort of collision?
    Bounding box/sphere, arbitrary convex polygon/volume, or per-pixel?
    If you aren't sure, I'd recommend axis-aligned bounding boxes (AABB), as it's simple and it's usually good enough as long as you aren't doing serious physics or anything. You specify a rectangle for each object, and you test the extents of each against the other. If you find that they overlap in both the x- and y- axes, then there's a collision.
    I'd explain in more detail, but there's plenty of resources for this already online. Now that you know what to google for, I think you can probably get started. I can elaborate on how AABB collisions are handled if you run into problems.

    For specifically handling moving objects, it's typically done just like static objects, but you process iterations between the start and end of the frame with a fixed timestep and put some upper limit on the velocity of objects (i.e. a 'terminal velocity'). You can do more sophisticated things and find more exact solutions, but the fixed timestep approach is usually adequate.
    Reply With Quote Edit / Delete Windows 7 Show Events Friendly Friendly x 1 (list)

  22. Post #382
    AntonioR's Avatar
    April 2011
    1,015 Posts
    DirectX Problem
    --------------------

    I wanted to make a render target that is bigger than my backbuffer (800,600).

    g_engine->p_device->CreateTexture(1024,768,1,D3DUSAGE_RENDERTARGET,D3 DFMT_R5G6B5,D3DPOOL_DEFAULT,&this->p_RenderTexture,NULL);

    But when I render on it it seems it is still the same size like the backbuffer. What is wrong here ? I googled it a bit, but I couldn't find a clear solution.
    Reply With Quote Edit / Delete Windows XP Croatia Show Events

  23. Post #383
    Gold Member
    WTF Nuke's Avatar
    March 2009
    4,460 Posts
    What sort of collision?
    Bounding box/sphere, arbitrary convex polygon/volume, or per-pixel?
    If you aren't sure, I'd recommend axis-aligned bounding boxes (AABB), as it's simple and it's usually good enough as long as you aren't doing serious physics or anything. You specify a rectangle for each object, and you test the extents of each against the other. If you find that they overlap in both the x- and y- axes, then there's a collision.
    I'd explain in more detail, but there's plenty of resources for this already online. Now that you know what to google for, I think you can probably get started. I can elaborate on how AABB collisions are handled if you run into problems.

    For specifically handling moving objects, it's typically done just like static objects, but you process iterations between the start and end of the frame with a fixed timestep and put some upper limit on the velocity of objects (i.e. a 'terminal velocity'). You can do more sophisticated things and find more exact solutions, but the fixed timestep approach is usually adequate.
    I got AABB collision, but I was just not sure how to test moving objects. I already have my code timestepped, so the maximum velocity is really miniscule at max I think 6 pixels on high speed objects (which this isn't). I assume I could just step both X and Y on both boxes, then see if there is a collision and if there is move back whichever one is lower?
    Reply With Quote Edit / Delete Windows 7 Canada Show Events

  24. Post #384
    Gold Member
    Lord Ned's Avatar
    April 2006
    3,702 Posts
    How are you sure it's the same size? The backbuffer doesn't get drawn to a quad and then your screen, so it's probably only going to show the upper/left anyway.

    Why do you need to create it bigger?
    Reply With Quote Edit / Delete Windows 7 United States Show Events Funny Funny x 1 (list)

  25. Post #385
    AntonioR's Avatar
    April 2011
    1,015 Posts
    How are you sure it's the same size? The backbuffer doesn't get drawn to a quad and then your screen, so it's probably only going to show the upper/left anyway.

    Why do you need to create it bigger?
    I render my scene on the render target, and then I render it on my backbuffer scaled down. Only the 800x600 part of the original scene gets rendered on the render target.

    What I want to accomplish is to render larger scenes(1024x768) on a smaller window(800x600,640x480). So I thought would just render it on a large render target, and then just scale it down to fit the screen/window size.

    I am not sure if this is the right way since I don't know how others handle different screen resolutions in their games.
    Reply With Quote Edit / Delete Windows XP Croatia Show Events

  26. Post #386
    Gold Member
    Lord Ned's Avatar
    April 2006
    3,702 Posts
    Why not just draw everything bigger on a bigger screen?

    If you're working on a 2D game, can't you draw it using an Orthographic projection that causes the objects to be bigger?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  27. Post #387
    DSG
    Gold Member
    Dennab
    October 2009
    5,953 Posts
    Warning: I'm a straight up noob at C and pretty much any "real" programming in general.

    Code:
    #include <stdio.h>
    #include <math.h>
    #include "checkit.h"
    void poly_add2(double poly1[], double poly2[], double result[])
    {
    	result[0] = poly1[0]+poly2[0];
    	result[1] = poly1[1]+poly2[1];
    	result[2] = poly1[2]+poly2[2];
    }
    void poly_mult2(double poly1[], double poly2[], double result[])
    {
    	result[0] = poly1[0]*poly2[0];
    	result[1] = (poly1[1]*poly2[0])+(poly1[0]*poly2[1]);
    	result[2] = (poly1[2]*poly2[0])+(poly1[1]*poly2[1])+(poly1[0]*poly2[2]);
    	result[3] = (poly1[1]*poly2[2])+(poly1[2]*poly2[1]);
    	result[4] = poly1[2]*poly2[2];
    }
    void test_cases(void)
    {
    	double poly1[3] = {2, 3.1, 2.7};
    	double poly2[3] = {9, 1.1, 4.7};
    	double sol1[3];
    	double sol2[5];
    
    	poly_add2(poly1, poly2, sol1);
    	poly_mult2(poly1, poly2, sol2);
    
    	checkit_double(sol1[0], 11);
    	checkit_double(sol1[1], 4.2);
    	checkit_double(sol1[2], 7.4);
    
    	checkit_double(sol2[0], 18);
    	checkit_double(sol2[1], 30.1);
    	checkit_double(sol2[2], 37.11);
    	checkit_double(sol2[3], 17.54);
    	checkit_double(sol2[4], 12.69);
    }
    int main(void)
    {
    	double *poly1[3];
    	double *poly2[3];
    	double *polysum[3];
    	double *polyproduct[5];
    
    	test_cases();
    
    	printf("Enter the coefficients for the first polynomial of degree two: \n");
    	scanf("%lf %lf %lf", &poly1[0], &poly1[1], &poly1[2]);
    	printf("Enter the coefficients for the second polynomial of degree two: \n");
    	scanf("%lf %lf %lf", &poly2[0], &poly2[1], &poly2[2]);
    
    	poly_add2(poly1[3], poly2[3], polysum[3]);
    	poly_mult2(poly1[3], poly2[3], polyproduct[5]);
    
    	printf("sum: %f + %fx + %fx^2\n", &polysum[0], &polysum[1], &polysum[2]);
    	printf("product: %f + %fx + %fx^2 + %fx^3 + %fx^4\n", 
    		&polyproduct[0], &polyproduct[1], &polyproduct[2], 
    		&polyproduct[3], &polyproduct[4]);
    
    	return 0;
    }
    Instead of asking for a straight solution to making this work, I'd like to know what's specifically wrong here with the arrays so I know how to properly work with them in the future. Note that I'm not allowed to use for/loops here so that's not really an option. Help appreciated!
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  28. Post #388
    Interesting that you say that. Friend.
    NorthernGate's Avatar
    August 2007
    3,378 Posts
    So, I've got a project that uses a DLL I made which has SFML statically linked to it:

    Game Project.exe -> Game API.dll -> SFML.lib(s) (C++ btw)

    Game API.dll compiles fine and what not, but when I try to use it in Game Project, it throws a linker error for SFML:

    Code:
    error LNK2001: unresolved external symbol "__declspec(dllimport) public: float __thiscall sf::Time::AsSeconds(void)const " (__imp_?AsSeconds@Time@sf@@QBEMXZ)
    And I have zero idea as to why this is :\ Thoughts?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  29. Post #389
    dajoh's Avatar
    March 2011
    625 Posts
    You have to link to SFML in "Game Project".
    Reply With Quote Edit / Delete Windows 7 Sweden Show Events Agree Agree x 1 (list)

  30. Post #390
    Gold Member

    March 2005
    3,028 Posts
    Warning: I'm a straight up noob at C and pretty much any "real" programming in general.

    Instead of asking for a straight solution to making this work, I'd like to know what's specifically wrong here with the arrays so I know how to properly work with them in the future. Note that I'm not allowed to use for/loops here so that's not really an option. Help appreciated!
    double *poly1[3];

    That is an array of pointers to doubles, not an array of doubles. Also note that the variable of an array is basically the pointer to the first element in the array, so 'a[i]' is the same as '*(a+i)'. In this context, 'a' can be either an array or a pointer. There are some exceptions where the two are not equivalent, but they behave similarly in many contexts.


    This is a horribly shitty explanation. I'm sorry. I can't brain today. :(
    Reply With Quote Edit / Delete Windows 7 Show Events Friendly Friendly x 2 (list)

  31. Post #391
    Interesting that you say that. Friend.
    NorthernGate's Avatar
    August 2007
    3,378 Posts
    You have to link to SFML in "Game Project".
    Welp, that's pretty lame, but it worked. Thanks~
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  32. Post #392
    AntonioR's Avatar
    April 2011
    1,015 Posts
    Why not just draw everything bigger on a bigger screen?
    The problem here is handling different screen resolutions. I want to draw a scene of the same size(1024,768) on different screen resolutions.

    Take Facewound for example. Here are screenshots when running the game in 640x480 and 1024x768. It is obviously the same scene, and if we count the tiles (32x32), we see that the original scene is 1024 pixels wide and it is somehow rendered on 640x480.

    In my game if I change the screen resolution, the size of the scene that will be rendered depends on the size of the bacbuffer.So if it is 640x480, it just renders the upper left corner of the size 640x480. But I want the whole 1024x768 be rendered on 640x480 and not just the upper left part.

    640x480


    1024x768


    If you're working on a 2D game, can't you draw it using an Orthographic projection that causes the objects to be bigger?
    I am using ID3DXSprite object to render sprites, I am not rendering textured quads using Orthographic projection (I don't know how to do that, so if anyone knows a good article on that subject...).
    Reply With Quote Edit / Delete Windows XP Croatia Show Events

  33. Post #393
    Gold Member
    Sir Whoopsalot's Avatar
    August 2010
    22,481 Posts
    As part of a Java school assignment, I have to work several GUI elements into a single window. Already have an image and a label attached to it but when I want to insert the text field, it takes up the entire screen, also covering the label.
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events

  34. Post #394
    Gold Member
    Dragoshi1's Avatar
    March 2008
    5,795 Posts
    I have a college Project(one every week) that uses RAPTOR, a free programming, er...program?

    The thing is, my Professor dude doesn't explain how to use RAPTOR very well, and his tutorials aren't exactly helpful, coupled with the fact I have never programmed before (the class is intro to computer programming, need it for Game Design stuff), and have ZERO knowledge of anything involving programming, and the RAPTOR program.

    Here is what he wants us to do;

    The Requirements
    Create a weekly payroll program for hourly-rated employees.
    All employees are paid the same hourly rate, $18.00 per hour.
    Regular weekly pay is the product of hours worked times the
    hourly rate, but overtime applies, too. Overtime occurs if an
    employee works more than forty hours in a week. Employees
    who have worked overtime are paid "time and a half" for the
    hours in excess of forty hours. Finally, income tax at 25% of
    gross pay is deducted from all paychecks.

    Your RAPTOR program should prompt for the weekly hours
    worked and then output a payroll report showing:

    the weekly hours worked.
    the regular weekly pay.
    the overtime pay (could be zero).
    the weekly gross pay.
    the income tax deducted.
    the weekly net pay.

    NOTE: All pay items should display as currency.

    YOUR ASSIGNMENT
    Part 1
    Work through an algorithm for the payroll program and
    submit pseudocode for this algorithm.

    Part 2
    Use your pseudocode to create the RAPTOR flowchart
    program.
    I don't understand what pseudocode is exactly, or how to go about doing this thing.

    Anyone know how to dumb down an explanation for a pure beginner to this stuff?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  35. Post #395
    Gold Member
    Sir Whoopsalot's Avatar
    August 2010
    22,481 Posts
    I have a college Project(one every week) that uses RAPTOR, a free programming, er...program?

    The thing is, my Professor dude doesn't explain how to use RAPTOR very well, and his tutorials aren't exactly helpful, coupled with the fact I have never programmed before (the class is intro to computer programming, need it for Game Design stuff), and have ZERO knowledge of anything involving programming, and the RAPTOR program.

    Here is what he wants us to do;



    I don't understand what pseudocode is exactly, or how to go about doing this thing.

    Anyone know how to dumb down an explanation for a pure beginner to this stuff?
    I may be mistaken here but isn't pseudocode code that's written specifically to make it easier for the user to read as opposed to the compiler?
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events

  36. Post #396
    Gold Member
    Dragoshi1's Avatar
    March 2008
    5,795 Posts
    I have no idea. Until before the class, I didn't even know the word "pseudocode".
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  37. Post #397
    Wyzard's Avatar
    June 2008
    1,243 Posts
    Pseudocode means writing a series of steps that's structured like a program, but isn't actually written in any particular programming language. Think of it as an informal outline of a program's flow.

    For example, you could write something like:

    Code:
    if (employee has worked more than 40 hours) {
        subtract 40 to determine how much overtime
        ...etc.
    }
    Think of it as a mix of plain English and whatever programming languages you know.
    Reply With Quote Edit / Delete Linux United States Show Events

  38. Post #398
    Gold Member
    Octave's Avatar
    January 2009
    2,530 Posts
    I may be mistaken here but isn't pseudocode code that's written specifically to make it easier for the user to read as opposed to the compiler?
    Yes, it just lays out the general functions of the code in a half english, half code way like so (from wikipedia)
    Code:
    function factorial is:
    input: integer n such that n >= 0
    output: [n  (n-1)  (n-2)    1]
    
        1. if n is 0, return 1
        2. otherwise, return [ n  factorial(n-1) ]
    
    end factorial
    Reply With Quote Edit / Delete Mac United States Show Events

  39. Post #399
    affail's Avatar
    January 2012
    23 Posts
    In C# what do I have to do to parse http://apps.ohlulz.com/rtmpgui/xanList.php?

    I've got
    Code:
    xDoc.Load("http://apps.ohlulz.com/rtmpgui/xanList.php");
        this.Text = "XanPlayer  remote list";
        int c = xDoc.GetElementsByTagName("item").Count;
        tsslStreamCount.Text = c.ToString() + " streams";
        int i = 0;
    
        while (i < c)
       {
            xanRows.Rows.Add(new Row());
            xanRows.Rows[i].Cells.Add(new Cell("", false));
            xanRows.Rows[i].Cells.Add(new Cell(xDoc.GetElementsByTagName("title")[i].InnerText));
            xanRows.Rows[i].Cells.Add(new Cell(xDoc.GetElementsByTagName("link")[i].InnerText));
            xanRows.Rows[i].Cells.Add(new Cell(xDoc.SelectSingleNode("/Channels/item/link/@swfUrl[i]").Value));
            xanRows.Rows[i].Cells.Add(new Cell(xDoc.SelectSingleNode("/Channels/item/link/@pageUrl[i]").Value));
            xanRows.Rows[i].Cells.Add(new Cell(xDoc.SelectSingleNode("/Channels/item/link/@playpath[i]").Value));
            i++;
         }
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  40. Post #400
    Gold Member
    jaybuz's Avatar
    May 2006
    5,516 Posts
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events