[QUOTE=Felipe;34398009]Where do I start if I want to learn C++?[/QUOTE]
Use learncpp.com if you haven't programmed before.
[QUOTE=Felipe;34398009]Where do I start if I want to learn C++?[/QUOTE]
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.
[url]http://www.youtube.com/antirtfm[/url]
[QUOTE=sim642;34398087]Use learncpp.com if you haven't programmed before.[/QUOTE]
Thank you!
[editline]26th January 2012[/editline]
[QUOTE=WolfeClaw;34398114]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.
[url]http://www.youtube.com/antirtfm[/url][/QUOTE]
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.
[QUOTE=Doritos_Man;34395193]Code::Blocks is the best IDE for C and C++ correct?[/QUOTE]
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.
[QUOTE=Darkest_97;34400466]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.[/QUOTE]
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.
[QUOTE=lord0war;34403685]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.[/QUOTE]
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 [url]http://headfirstlabs.com/books/hfcsharp/[/url]
I guarentee you'll be using Visual Studio for programming C#. (for pretty much all tutorials you'll come across)
[QUOTE=WTF Nuke;34401742]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.[/QUOTE]
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 [i]moving[/i] 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,D3DFMT_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.
[QUOTE=ROBO_DONUT;34404389]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 [i]moving[/i] 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.[/QUOTE]
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?
[QUOTE=Lord Ned;34405545]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?[/QUOTE]
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.
[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;
}[/code]
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!
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)[/code]
And I have zero idea as to why this is :\ Thoughts?
You have to link to SFML in "Game Project".
[QUOTE=DSG;34407294]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![/QUOTE]
double *poly1[3];
That is an array of [i]pointers[/i] 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 [i]either[/i] 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. :(
[QUOTE=dajoh;34409766]You have to link to SFML in "Game Project".[/QUOTE]
Welp, that's pretty lame, but it worked. Thanks~
[QUOTE=Lord Ned;34406106]Why not just draw everything bigger on a bigger screen?[/QUOTE]
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
[img]http://i.imgur.com/tOdNy.jpg[/img]
1024x768
[img]http://i.imgur.com/Va6xw.jpg[/img]
[QUOTE=Lord Ned;34406106]
If you're working on a 2D game, can't you draw it using an Orthographic projection that causes the objects to be bigger?[/QUOTE]
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;
[QUOTE]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.[/QUOTE]
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?
[QUOTE=Dragoshi1;34419917]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?[/QUOTE]
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 [i]like[/i] 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
[i]...etc.[/i]
}
[/code]
Think of it as a mix of plain English and whatever programming languages you know.
[QUOTE=Sir Whoopsalot;34420525]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?[/QUOTE]
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[/code]
In C# what do I have to do to parse [url]http://apps.ohlulz.com/rtmpgui/xanList.php[/url]?
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++;
}[/CODE]
[QUOTE=affail;34423156]In C# what do I have to do to parse [url]http://apps.ohlulz.com/rtmpgui/xanList.php[/url]?
I've got [CODE]-snip-[/CODE][/QUOTE]
[url]http://stackoverflow.com/questions/55828/best-practices-to-parse-xml-files[/url]
Sorry, you need to Log In to post a reply to this thread.