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 :/
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 :/
Code::Blocks is the best IDE for C and C++ correct?
Nah, vim.
But for windows?
"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.
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.
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?
Where do I start if I want to learn C++?
-snip-
Use learncpp.com if you haven't programmed before.
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
Thank you!
Edited:
Thanks to you too!
Gee guys you don't have any sense of humor do you :saddowns:
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.
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.
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.
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.
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)
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.
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.
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?
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.
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?
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!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; }
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:
And I have zero idea as to why this is :\ Thoughts?Code:error LNK2001: unresolved external symbol "__declspec(dllimport) public: float __thiscall sf::Time::AsSeconds(void)const " (__imp_?AsSeconds@Time@sf@@QBEMXZ)
You have to link to SFML in "Game Project".
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. :(
Welp, that's pretty lame, but it worked. Thanks~
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
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...).
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.
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?
I have no idea. Until before the class, I didn't even know the word "pseudocode".
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:
Think of it as a mix of plain English and whatever programming languages you know.Code:if (employee has worked more than 40 hours) { subtract 40 to determine how much overtime ...etc. }
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
In C# what do I have to do to parse http://apps.ohlulz.com/rtmpgui/xanList.php?
I've gotCode: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++; }