• What do you need help with? V. 3.0
    4,884 replies, posted
how do i import an rsa private key to .net to decrypt shit
Hello guys! I am currently trying XNA 4.0 and I am wondering if there is a best image format for sprites ? I'm using .png at the moment and it seems a bit slow : 20 FPS with 10 000 sprites (128*128). Is it what I should expect from XNA or is there a way to improves this ?
[QUOTE=amazer97;31283268]No, what I meant was I'm a beginner at OpenGL. I've been programming for around 2 years now, but the book doesn't really specify what libraries you need, or where to get them / what versions to get. I was wondering if someone else who completed the Superbible 4th Edition knew what I need exactly.[/QUOTE] Most (All?) compilers come with the OpenGL libraries, so no need to do anything special there. You may want to install the GLEW library, but apart from that you're already set! [editline]23rd July 2011[/editline] [QUOTE=pedrus24;31286900]Hello guys! I am currently trying XNA 4.0 and I am wondering if there is a best image format for sprites ? I'm using .png at the moment and it seems a bit slow : 20 FPS with 10 000 sprites (128*128). Is it what I should expect from XNA or is there a way to improves this ?[/QUOTE] Apart from actually loading the images in the first place, image format should make no difference in the end. When the image is loaded, the pixel data is all loaded into memory in the same way, making it format independent. At least, that's how I'd assume it works, I don't have much experience with XNA so I have no idea if it does something wonky with different formats.
[QUOTE=pedrus24;31286900]Hello guys! I am currently trying XNA 4.0 and I am wondering if there is a best image format for sprites ? I'm using .png at the moment and it seems a bit slow : 20 FPS with 10 000 sprites (128*128). Is it what I should expect from XNA or is there a way to improves this ?[/QUOTE] It doesn't matter. You should use the smallest possible image size without losing quality. PNG will do just fine. XNA will store all the image formats the same way in memory, so the actual format is only there when you load them up.
[QUOTE=Icedshot;31276849]isnt it atan? if you have [code] tan x = o/a [/code] then surely [code] x = atan (o/a) [/code][/QUOTE] I'm really rusty on trig, that's probably right.
Someone teach me C++, python and some shell scripting. I've just started a job where I'm expected to use all three, yet I have used none of them before...
[QUOTE=lazyV;31287338]Someone teach me C++, python and some shell scripting. I've just started a job where I'm expected to use all three, yet I have used none of them before...[/QUOTE] That is not going to happen in the short time you'll need them. Learning even one language takes a long time. Why'd you take the job if you can't use those, did you not know that was required or something?
[QUOTE=Chris220;31287467]That is not going to happen in the short time you'll need them. Learning even one language takes a long time. Why'd you take the job if you can't use those, did you not know that was required or something?[/QUOTE] It's an intern job. There's a 6 week intensive training course which I'm doing now. I'm just panicking a little since they are assessing as we go along.
Attempt 2 : How can I check for existing .txt files in a specified folder using C++ and then open it? I know how to open it with std::ifstream, but only when I know the exact name of the file.
[QUOTE=AntonioR;31288077]Attempt 2 : How can I check for existing .txt files in a specified folder using C++ and then open it? I know how to open it with std::ifstream, but only when I know the exact name of the file.[/QUOTE] The C and C++ standard libraries don't "know" directories. I recommend using boost's Filesystem library, as it will be (at least close to) standard in the future.
[QUOTE=AntonioR;31288077]Attempt 2 : How can I check for existing .txt files in a specified folder using C++ and then open it? I know how to open it with std::ifstream, but only when I know the exact name of the file.[/QUOTE] If this is for your game and you are already using SFML then I suggest you look into this [url]http://www.sfml-dev.org/forum/viewtopic.php?t=5064[/url]
[QUOTE=AntonioR;31288077]Attempt 2 : How can I check for existing .txt files in a specified folder using C++ and then open it? I know how to open it with std::ifstream, but only when I know the exact name of the file.[/QUOTE] You should look for the C functions opendir and readdir. Three different answers. There you have choice.
Directories are not a problem here. I store maps in a folder I know and then load them like in the code below. The problem is I want to read ALL the .txt files in that folder no mater their names. I don't want to be restricted to naming maps "level1.txt","level2.txt" like you see below. [code] bool load = true; std::ostringstream filename; int i=0; while (load==true) { filename.str(""); filename << "Levels/level" << i << ".txt"; FILE* fp = NULL; fp = fopen(filename.str().c_str(),"r"); if (fp!=NULL) { //do some funky stuff i++; } else load=false; } [/code] Edit: Actually I am not using ifstream here, but I doesn't mater.
It looks like scandir should do what you want (to get the files list of a directory right?) : [CODE]#include <dirent.h> main(){ struct dirent **namelist; int n; n = scandir(".", &namelist, 0, alphasort); if (n < 0) perror("scandir"); else while(n--) printf("%s\n", namelist[n]->d_name); }[/CODE]
[QUOTE=pedrus24;31288796]You should look for the C functions opendir and readdir.[/QUOTE] [QUOTE=pedrus24;31289155]It looks like scandir should do what you want (to get the files list of a directory right?) : -code snip-[/QUOTE] dirent.h is part of the POSIX API and isn't part of non-POSIX platforms like Windows without third-party stand-in replacements (e.g. Cygwin). [QUOTE=AntonioR;31289066]Directories are not a problem here. I store maps in a folder I know and then load them like in the code below. The problem is I want to read ALL the .txt files in that folder no mater their names. -code snip- Edit: Actually I am not using ifstream here, but I doesn't mater.[/QUOTE] It is a problem of directories - you want to list all the files in a particular directory. The standard library of C++ (and that of C, which standard library is part of C++ too) does not support the concept of directories and thus does not offer any standard solutions to manipulating directories. I do not recommend using the POSIX API or the Windows API to do this. Not only are those APIs not readily portable, but they are C APIs, not C++ APIs. The reason I recommended boost's filesystem library is because the API is indeed C++, and as an added boon, it is considered for inclusion in the standard C++ library in the future. (by the way, you are leaking file handles in your code example unless you snipped it. If you had used C++ file streams, the file handles would be automatically closed.)
How would I do collision detection in C#, XNA, with images
[QUOTE=Staneh;31295324]How would I do collision detection in C#, XNA, with images[/QUOTE] you can either use rectangles or do pixel detection
If I pushmatrix then set the camera matrix and render stuff and then I popmatrix and draw hudelememts in xy space, would it work as a regular hud? or did i miss something? Also would it affect the performance?
[cpp]vector<string> filesystemPOSIX::findPathChildren(const string& path) const[/cpp] Any idea how I could return an error code with that?
...Throw an exception? I'm not sure of what you mean.
Well, findPathChildren can fail in the event that opendir fails. Otherwise, it returns a directory listing. My current code goes like: [cpp]vector<string> filesystemPOSIX::findPathChildren(const string& path) const { vector<string> children; DIR* stream = opendir(path.c_str()); if(stream == 0) { logPOSIXError(errno); // Can't really do anything about this, just return an empty vector. return children; } ...[/cpp]
Throw an exception.
Is it really a wise idea to do that? I mean, I may have other errors in future and then I'd need multiple types of exceptions. I also vaguely remember that I may of read that I should use exceptions sparingly.
You shouldn't throw exceptions for things that will happen routinely, but it's reasonable to throw one in this case. It really is an exceptional condition: being unable to open a directory is a situation you have to handle, but it's not the common case and should typically not happen at all when the program is used as expected. You could maybe make a POSIXException class that takes an errno code as a constructor argument and uses strerror() to look up the corresponding message.
[QUOTE=Jookia;31306469]Is it really a wise idea to do that? I mean, I may have other errors in future and then I'd need multiple types of exceptions. I also vaguely remember that I may of read that I should use exceptions sparingly.[/QUOTE] Exceptions have a bad reputation because people generally don't use them correctly. Although I think C++ exceptions were badly implemented. They should have only let you throw exceptions not anything you want to.
does anyone maybe knows , how to unload the current dynamic library without closing the thread? If i just unload it using FreeLibary it will try to go to the return address and then it find out the module is gone. If i just unload it using FreeLibraryAndExitThread it will close the current thread that also hapends to be the main thread, (also not a thing that i want). i do not have access to the main thread, so i cant work from there. Any ideas ? EDIT: Current solution (if anyone find this using google) CreateThread -> Unload module from there.
[QUOTE=high;31307471]Exceptions have a bad reputation because people generally don't use them correctly. Although I think C++ exceptions were badly implemented. They should have only let you throw exceptions not anything you want to.[/QUOTE] Technically exceptions are anything you want them to be. C++ is still relatively low-level in that it allows you to do lots of stuff a higher-level language might prevent for the sake of implementation sanity or user-friendliness or something.
I tried to compile the freeglut library so I could use it for OpenGL, but it doesn't work. Would anyone be kind enough to upload a freeglut_static.lib file somewhere (multithreaded, one that doesn't rely on libc.lib.) for me?
[QUOTE=Richy19;31297319]you can either use rectangles or do pixel detection[/QUOTE] Can I get some more detail on this maybe?
[QUOTE=amazer97;31311311]I tried to compile the freeglut library so I could use it for OpenGL, but it doesn't work. Would anyone be kind enough to upload a freeglut_static.lib file somewhere (multithreaded, one that doesn't rely on libc.lib.) for me?[/QUOTE] Cant you just use SFML for the windowing? [editline]24th July 2011[/editline] [QUOTE=Staneh;31311315]Can I get some more detail on this maybe?[/QUOTE] [url]http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series2D/Coll_Detection_Overview.php[/url]
Sorry, you need to Log In to post a reply to this thread.