Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Member Since 30 Dec 2000
Offline Last Active Yesterday, 11:18 PM

#5171412 multiple source files and global varaibles.......................

Posted by nobodynews on 04 August 2014 - 09:10 AM

My problem is with my global variables which I was trained to utilize the most.

I'm curious what you mean by this. I've only heard train and globals used together when saying you should train yourself to not use them.

#5169646 Do GL and DX 'go through' the Windows GDI?

Posted by nobodynews on 27 July 2014 - 07:52 PM



In Windows Vista, all Windows applications including GDI and GDI+ applications run in the new compositing engine, Desktop Window Manager which is built atop the Windows Display Driver Model.




Direct3D 9Ex, Direct3D 10, and Direct3D 11 are only available for Windows Vista and newer because each of these new versions was built to depend upon the new Windows Display Driver Model that was introduced for Windows Vista


So, for at least Windows Vista and newer operating systems, GDI and DirectX are built on top of the Windows Display Driver Model, DirectX more directly. I'm not sure what Windows did before Vista, but I'm almost 100% certain DirectX bypassed GDI.

#5167522 C++ smart pointer usage

Posted by nobodynews on 17 July 2014 - 11:29 PM

I'm not sure what you did that 'broke all of [your] functions that had that vector being passed in', but you should be able to just pass in the std::vector of std::unique_ptrs as a reference. I tested it to be sure (and utilized typedefs; I'd suggest doing the same if you'd like fewer nested brackets):

#include <iostream>
#include <memory>
#include <vector>

class Planet
    int X;
    int Y;

typedef std::unique_ptr<Planet> Planet_ptr;
typedef std::vector<Planet_ptr> Planet_vctr;

void Function1(Planet_vctr &alteredVector)
    Planet_ptr p(new Planet);

    alteredVector.push_back( move(p) );

void Function2(const Planet_vctr &constVector)
    if (constVector.size())
        std::cout << "Not Empty!\n";
        std::cout << "Empty!\n";

int main() {
    Planet_vctr aVector;

Without delving into how you're using the pointers, I wouldn't be able to offer a suggestion on whether to use unique_ptr or shared_ptr. I found this explanation from Stack Overflowfairly coherent that might help you.

#5159360 remapping the keyboard (esp {} () )

Posted by nobodynews on 09 June 2014 - 04:39 PM

if you dont like to answer me dont answer not a problem, byt do not spamm me with useles and not interesting pseudo- philosophy

If you don't like the answers you get not a problem, but do not spam the boards with useless and not interesting pseudo-philosophy yourself. You could just as easily ignore answers that you don't like, but instead you're wasting your time arguing with people about how they shouldn't respond as they see fit because you want to ask questions as you see fit. IMO that's kind of hypocritical of you.

#5148617 Need help with installation of program

Posted by nobodynews on 21 April 2014 - 04:15 PM


I didn't even think about the permissions. I was having the installer put it into the program files folder in the windows directory. Could I perhaps have the program write to the public folder in users? If so would the following statement be correct?:


What you really want to do is query windows for the appropriate path to use. Look into using the function SHGetKnownFolderPath with a KNOWNFOLDERID of "FOLDERID_Documents". Then you'll for sure use the correct path for each user instead of hoping its what you expect.

#5147742 How to stop users from manipulating Game Save Data

Posted by nobodynews on 17 April 2014 - 04:00 PM

Does it mean to parse each character of the textfile to be a 1 or a 0?

It does not mean that. It means instead of having a text file you write the data in machine-readable form instead of humanly readable form. Consider, say, a .jpg file. That is an example of a binary file. I'm not a java programmer, but I found a small tutorial on how to do binary file i/o here that might help you.

#5147659 What's the point of floats in C?

Posted by nobodynews on 17 April 2014 - 09:34 AM

You must have read something that was about variadoc parameters, e.g. printf. That only applies to functions that can take an arbitrary number of parameters. Normal functions don't do that unless the function specifically says to use doubles. An explanation for why is here. The other thing you might be confused about is how the literal 0.0 is a double. If you want a float literal you have to specifiy 0.0f. I don't know why the language design went with double as default over float as default for literals.

#5147435 c++ oo syntax behind the scenes behavior

Posted by nobodynews on 16 April 2014 - 12:58 PM

fascinating! i thought local declarations did a new in the background and a dispose on return, using the heap.

Things only go on the heap if they are explicitly allocated, either directly or indirectly. If the object you create on the stack uses allocation with new, then that data would go on the heap. The pointer to that data would be on the stack. If the object you created was on the heap then both the pointer and the other data would both go on the heap. Its basically recursive. Say you created an object on the heap and called a member function. If that member function has local variables then they would be pushed onto the stack even though the object itself was allocated on the heap. This is due to the way the compiler treats executable code.

would object1 go on the stack when main was called? or is main a special case and it goes in the data segment?
main is exactly like any other function except it is called by the operating system rather than your program.

object1 (its member var storage space) would go in the data segment?
That would go in the data segment. While I said that main is a special case, it's slightly more complicated than I implied. main is actually called indirectly by the operating system in most environments. The operating system will generally call a function implemented in the run-time library. You can read a little about it here. That link mentions that the run-time library will initialize global variables before main is called. If the operating system called main directly then none of the constructors for the global variables would be called, among other things.

#5147399 How to stop users from manipulating Game Save Data

Posted by nobodynews on 16 April 2014 - 11:18 AM

Who's more entitled? The person who wants to use something they bought the way they want to use it or the person that doesn't let someone use the product the way they want to use it?

#5142973 Help to understand my own misstake?

Posted by nobodynews on 28 March 2014 - 07:57 PM



std::map::at takes a key, not an index. What your first try was actually accomplishing was returning the value associated with key=0. In the words of that reference:


std::out_of_range if the container does not have an element with the specified key


You didn't have key=0 in your std::map hence that exception. std::map::begin, however, returns an iterator to the first std::pair in the std::map container. The key isn't used at all. As long as there is one item in your std::map the iterator method will work.

#5141142 Is hatred for unity justified?

Posted by nobodynews on 21 March 2014 - 07:28 PM

So, what games has your professor made?

#5137872 detect corrupt savegame file - best practices

Posted by nobodynews on 10 March 2014 - 12:40 PM

Yeah go with a checksum. If you want something a little more robust than a simple "add up all the bytes" method, consider a CRC checksum. It shouldn't be too hard to find a free implementation, but there's one I found here along with an explanation: http://www.barrgroup.com/Embedded-Systems/How-To/CRC-Calculation-C-Code

#5135154 does a dll much differ to a lib?

Posted by nobodynews on 27 February 2014 - 01:47 PM

lib files are basically collections of obj files. dll files use Portable Executable format which is modified from COFF format. obj files use COFF format. Wikipedia says "While extended versions of COFF continue to be used for some Unix-like platforms, primarily in embedded systems, perhaps the most widespread use of the COFF format today is in Microsoft's Portable Executable (PE) format. Developed for Windows NT, the PE format (sometimes written as PE/COFF) uses a COFF header for object files, and as a component of the PE header for executable files."

#5105059 Can I use Visual C++ 2010 Express to release free Indie games?

Posted by nobodynews on 28 October 2013 - 09:57 AM

"I'm fairly sure that I'm not allowed to actually SELL the games that I make with it" Yes you can

#5085676 Stringstreams and escape characters

Posted by nobodynews on 13 August 2013 - 04:35 PM

You may want a string splitting function. This question on Stack Overflow should give you some ideas. I would suggest that you adapt this response to split based on a deliminator such as '/'. You would just convert the string to the correct type instead of returning a std::vector of strings. Or take the std::vector of strings and convert those as needed. You have options is all I'm saying.