And __declspec( dllexport) is a non-standard (i.e. compiler specific) feature in Microsoft's compilers. There's some information here on it.
- Viewing Profile: Reputation: nobodynews
Community Stats
- Group Members
- Active Posts 2,350
- Profile Views 2,023
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
#5045655 Need help understanding odd C++ semantic
Posted by nobodynews
on 22 March 2013 - 11:48 AM
#5041377 What tools do programmers make to help game designers, artist and programmers?
Posted by nobodynews
on 09 March 2013 - 09:31 PM
Level Designers/Editors are one tool/group of tools that programmers make.
Is the editor suppose to do this:
1) First make the map in the editor
2) Once map is done, program will generate a code in Java based on what the map looked like in the editor.
3) Programmer can export the Java code of the map created by the artist so programmer can add the code of the map
into their program.
Almost certainly not. The editor would in all likelihood spit out a file (or set of files). The game would read the generated files and perform actions depending on what was in files.
#5041373 Scaling images
Posted by nobodynews
on 09 March 2013 - 09:24 PM
You probably want to look into using the SDL_SoftStretch function. If you have a source 16x16 SDL_Surface* called (for example) image_16square and a destination 64x64 SDL_Surface* called (for example) image_64square you would call it like this:
SDL_SoftStretch(image_16square, NULL, image_64square, NULL);
Untested. This uses SDL 2.0. If you're using SDL 1.2 you should specify. Basically you'd lock both the 16x16 source surface and the 64x64 destination surface. Then you'd go through every pixel in the 16x16 surface and set the equivalent 4 pixels in the destination surface to the same value as that pixel.
#5032671 OOP with vectors
Posted by nobodynews
on 15 February 2013 - 09:17 AM
There are almost certainly better solutions to your problem than what I'm about to suggest, but the quickest and dirtiest solution is to pass in a reference (I'd suggest by const) to the same vector of entities:
::updateLogic(const std::vector<Entity *> &entities) { ... }
Or just std::vector<Entity> (you say a vector of pointers to instances, but the code you show is just a vector of instances so I'm not sure what you're actually doing). There are pitfalls to this method and you'll probably want to check that the entity which is being acted upon is not the same as the entity you're currently cycling through in the function body.
All that said, I highly suggest you explain *why* you want to do this and we can suggest better solutions.
#5028227 What is the difference in these 2 variables?
Posted by nobodynews
on 02 February 2013 - 09:38 PM
Microsoft offers a clear explanation here. The important part is under the initializing value types section. Basically, the first way doesn't initialize the variable and you must initialize variables bofore you can use them in C#. So you have to assign a value to the variable before you could use it or you'll get a compiler error. The second way calls the default constructor for an int type which that links says is equivalent to doing this: int a = 0;
I doubt there's any performance difference between the two methods.
#5013853 a few questions
Posted by nobodynews
on 23 December 2012 - 10:59 PM
I think NoAdmiral was suggesting not using graphics but text like on the command line. "ASCII graphics" would be a common search term. That way you don't need to learn graphics programming on top of everything else. It was just an alternative suggestion to get closer to your end goal of MMORPG by skipping some steps that you might find more boring.
#5011492 I need help with vectors of vectors.
Posted by nobodynews
on 16 December 2012 - 09:31 PM
mv[i].push_back(bool());
Of course a better solution is to make this function:
std::vector<std::vector<bool>> Create2DVectorOfBools(int x, int y)
{
std::vector<bool> temp(y, false);
std::vector<std::vector<bool>> mv(x, temp);
return mv;
}
What this does is first creates a 1d vector of bools of length y and initializes every element in it to 'false' (see here for info on every constructor of std::vector http://msdn.microsoft.com/en-us/library/zzw4bwhd.aspx )
Then it creates a vector of vector of bools of length x and initializes every element in it to 'temp' (which, as stated, was initialized to length y).
Then it returns a copy of the resulting 2d vector.
#5005404 SFML application on exit dosent return 0
Posted by nobodynews
on 29 November 2012 - 01:08 PM
A few observations. First, tat's quite a lot of globals you have there. You have the following objects that aren't created in main():
objWindow, objFps, objTextures, objFunctions, ,objMainMenu, objOptions, objSquad, objSquadCreation, objAudio
The problem could be in any one of these or even objApp. My theory is that because many of the obj* objects are created and use objApp that there's an issue with how you're storing objApp in the other objects. objApp is destroyed before the globals and this could be causing issues somehow. So, two things you should do. First, create a block around objApp like this:
int main() {
srand(time(NULL));
{ // Add this!
Application objApp;
// the rest of your code here
} // Add this! ObjApp is destroyed here instead of after the return
return 0;
}
If the problem is when objApp is destroyed, then you'll get an error before you reach the return statement. Otherwise the problem is when one of the globals is destroyed.
Second thing you should do is post the code of Application and one or two of the objects that use objApp.
#5002519 Sleep and Electricity
Posted by nobodynews
on 19 November 2012 - 07:11 PM
You seem to be confused a little about how circuitry works so here's a quick crash course.Electricity always moves by definition at a fixed speed in a given medium, so we can't just "stop" the signal and wait for something to happen. I imagined that the CPU was just one big circuit and that the electricity always flows but the circuit may cut off a loop or the circuit not to be actualized until a voltage from outside the system (i.e. the graphics device) re-activates it.
Consider first a diode ( http://en.wikipedia.org/wiki/Diode ). A diode's behavior depends upon the source voltage. At low voltages a diode will consume a very low amount of electricity (an ideal diode consumes NO electricity because at infinite resistance no electricity can flow). At high voltage the diode does consume electricity (at which point the diode can be modeled like a normal resistor). Diodes aren't really used in CPUs though, it's just a simpler concept than...
The transistor ( http://en.wikipedia.org/wiki/Transistor ). You can imagine a transistor as behaving like a dam. A dam has a reservoir that's normally filled with water. The dam doesn't have to let any of the water out of the reservoir, a gate must be open first. If the gate is opened then if there's any water at the source of the reservoir then it can drain out. No water at the source and no water flows out the drain, regardless of whether the gate is open.
A transistor works the same way. A transistor has a 'gate', a 'source', and a 'drain'. In this case the gate is opened or closed depending on whether there's voltage there above a certain threshold. If any electricity is present at the source, it can flow through the drain when the gate is open. Like a diode, if the gate is closed then there shouldn't be any electricity usage. Of course also like a diode that's for an 'ideal' transistor'. A real transistor will leak some current, even with a closed gate. So if you shut off enough transistors for some reason this would result in much less current (and this power) being consumed.
Many processors support a standby mode where the CPU is made almost entirely inactive, until an interrupt is triggered awakening the processor. That said, I'm not sure if this processor feature is necessarily *used* by Microsoft in their OS. If it is, it's definitely not going to be used when a random program calls 'sleep', but when the OS decides to go standby mode at which time pretty much nothing is going to happen until the OS wakes up again.
And of course, what frob said about reducing clock frequency.
#4996572 How to start?
Posted by nobodynews
on 02 November 2012 - 10:01 AM
My default suggestion for beginners is C# or Python, but Action Script would be fine as well. But above all I suggest you don't give up. There is no best path but the only path that gaurantee's failure is to quit. So don't worry so much about doing things right or wrong. If you have questions we're here to help.
Good luck.
#4987459 How to manage input from more than one potential source?
Posted by nobodynews
on 06 October 2012 - 12:10 PM
Doesn't seem that sloppy to me given what you want to do.I thought of using an integer for this, but that just seems sloppy... Like if I press key_w, held_amt++, if I press key_up, held_amt++, if I press mouse_2, held_amt++. Then when I release one of them, I do held_amt--, check if it is equal to zero, and then if it is, stop running...
I don't know, this just seems very sloppy to me.
What you could do is have an enum of possible actions (Action) mapped to an integer to count the number of inputs that are applied to that action like this:
std::map<Action, int> ActionBindings;
And for the callback system you want to associate a key with an action in another map like this:
std::map<Key, Action> KeyBindings;
When OnKeyUp/Down is called, map from the Key to the Action and then from the Action to the count for that Action. Then in the part of the code that performs actions just check for which actions are currently occurring and do actions based on that. Hope this helps.
#4970621 TouchInput structure
Posted by nobodynews
on 17 August 2012 - 11:46 AM
if( ( touchstore[ i ].dwID == message[ mindex ].dwID ) && ( ( message[ mindex ].dwTime > touchstore[ i ].dwTime ) || (message [mindex].dwTime < (touchstore[ i ].dwTime - WrapAroundTimeDelta) )) )
Where WrapAroundTimeDelta is something like 86400000 milliseconds (24 hours) in the past.
#4962482 How much slower is boost::shared_ptr
Posted by nobodynews
on 23 July 2012 - 10:03 PM
#4961814 AUTO_PTR issue.
Posted by nobodynews
on 21 July 2012 - 07:09 PM
#4961753 Having problem using SDL_mixer
Posted by nobodynews
on 21 July 2012 - 02:03 PM
- Home
- » Viewing Profile: Reputation: nobodynews

Find content