[code=cpp]
#ifdef _WINDOWS
bool CRenderPipeline ::CreateAPIInte rface(HWND hWnd)
{
if(settingsMana ger->GetVar("r_rend erPath") == "DIRECT3D9" )
{
MessageBox(NULL , L"Direct3D9 mode activated!", L"", MB_OK);
renderInterface = new CRendererDX9;
renderInterface->InitializeGrap hicsSubsystem(h Wnd, settingsManager );
}
else...
User Profile
Collapse
-
Fun with constructors, inheritance
Hello all, been a bit frustrated as of late with one of C++ programming projects. The problem goes like this:
I have a game engine-type thing going that has support for several different rendering APIs (not all simultaneously running, obviously, but you can switch between them at runtime with my console system.) Now in order for everything to play nice, I have a 'pipeline' class that acts as a layer of abstraction between the core... -
I'm pretty much passing the output from the c_str() member function inside the
string class to the atowhatever functions. It does work, but it seems inefficient to me.
I s'pose it's also worth noting that I don't need 100% polymorphism here-- how the contents of the variables are used is fixed as the methods and assumed 'types' are hardcoded, but the contained value can be indexed and modified arbitrarily via a console system....Leave a comment:
-
That does seem like it would work, however my question would then be "is this any faster than just converting to/from a string using the atof/atioi, etc. functions?"
Any advice? That's pretty much what I'm doing now (string->'casting'->type) but was trying to speed this up if possible....Leave a comment:
-
Actually I already am-- the storage part isn't the problem. That was admittedly unclear, my apologies. What I am trying to do is have a sort of function that will return an object of the type that I specified in the template argument(s). For example let's say I want to have a specific instance/specialization of the aforementioned CGlobalVariable base class. Now let's say I want to have a 'ReturnValue' function that directly returns a copy or pointer...Leave a comment:
-
Questions regarding template specialization (?)
Perhaps a veteran C++ programmer might be able to help me with this--
I'm basically trying to set up a linked list of objects that are templated. Now ordinarily I'd just derive from a 'master class' but here I'd like to be able to directly return one of the templated (meaning I store an object of the template aargument type, for example an integer, float or boolean) data members upon request. Could I just overload a virtualized function... -
It's sort of implied by what is/isn't supported. Obviously you won't defend anything that you believe to be inferior as a whole, which is reasonably obvious, but point I'm trying to make is that you do give that impression.
I was more referring to the lines of customization/modification, hence the earlier Ubuntu reference. I would actually gander that most vendors don't support Linux due to lack of user base. In fact,...Leave a comment:
-
Aren't those two answers kind of the same, though?
Without it being doubly-linked and assuming you aren't using any other lists, it's impossible directly.Leave a comment:
-
Ah-- I should have caught that since I've been working on a chunk/block-based memory manager/allocator myself! Good point.Leave a comment:
-
[code=cpp]
int main()
{
CMemoryPool testingPool(655 36, 1024);
return 0;
}
[/code]
Lovely, I know. Basic synopsis of what this is/means:
-I've obviously instantiated an instance of my memory pool class, the constructor there accepts two arguments: size of a block in the pool (64kb here) and the total number of blocks in the pool. (1024, for a grand total size of 64MB)
...Leave a comment:
-
Yep. Look for an ASCII table that lets you convert between letters/codes and then just use a bunch of if statements to see if it (the passed-in char) corresponds to any digit. I think there's something in the STL that does something similar, head on over to www.cplusplus.c om and look at the reference for ctype.h, I THINK. Should be something like isalpha() (that can be used too, in a pinch) or isnumber() or something along those lines. Then printf...Leave a comment:
-
Issues w/CRT on program exit?
Doing some work on the ol' memory manager this evening and recently I've been having read access violations occur after the actual program exit. The problematic line appears as follows, it appears to have to do with the value passed from my main function:
[code=cpp]
mainret = _tmain(__argc, _targv, _tenviron);
[/code]
I'm no CRT expert, would anyone be able to give me some guidance as to what's going wrong here? I'm also... -
[biglongrant]
Yeah, that would work if we're talking Windows 98. Problem is that most Linux users switched due to its/ME's crappiness and assumed Microsoft hasn't fixed anything because they, and I quote, (more or less) "suck at coding and life in general." I think XP has BSOD'd on me two (2) times over the past 5-6 years and both of which occured while I was attempting to update some of my graphics card drivers. (and before...Leave a comment:
-
Methinks you've discovered why the security method is actually effective. It's statistically very difficult to get your file to *exactly* the right size when you factor in all the little optimizations/variations/base size requirements/storage overhead for some functions/variables. (lol @ huge number of slashes there XD)
Maybe try adding two plain chars, no pointers or anything, if that fails perhaps you can add some dummy assembly...Leave a comment:
-
The catch is the compiler doesn't necessarily *know* where the Windows and DirectX headers are at. While you didn't specify what compiler you use, there should be a set of options for your current project along the lines of "Additional Include Directories" (VC2005) or similar. Tell it the location of said headers in there. What I prefer to do (and this also makes your code a bit more release-friendly) is copy the main folders of any and...Leave a comment:
No activity results to display
Show More
Leave a comment: