Jump to content

  • Log In with Google      Sign In   
  • Create Account

Soaps79

Member Since 08 Jul 2010
Offline Last Active Apr 17 2012 12:28 AM

Topics I've Started

shared_ptr in VS 2008

24 October 2011 - 09:50 PM

Sorry for the lame question, but I can't find a definitive answer anywhere.

I wrote a system that I really like using C++ in VS 2010. I #include'd <memory>, and had access to std::shared_ptr. I am now trying to bring the system into a team project I am working on in VS 2008. I read that shared_ptr and other classes/libraries were not originally in VS2008, but were added in SP1. My VS About window says:

Version 9.0.21022.8 RTM
Microsoft .NET Framework Version 3.5 SP1

Shouldn't I have access to shared_ptr's? I tried:
[source lang="[b]cpp[/b]"]#include <memory>using std::shared_ptr;[/source]
and
[source lang="[b]cpp[/b]"]#include <memory>using std::tr1::shared_ptr;[/source]
Both told me that shared_ptr is not a member of the namespace. Any help would be much appreciated, thank you.

[C++] Problems with templates and friends

14 August 2011 - 12:42 PM

I have an idea for a Tween class that looks great on paper, but I am running into trouble trying to implement it. I want to be able to create Tween objects that take in a variable, and adjust it in different ways across a given time span. I then want to be able to have objects instantiate Tweens which will run automated. Essentially I want to be able to:
[source cpp]// give object a Tween* vectorvector<Tween*> tweenVec;// somewhere within the Object's code// to tween position from its current (1, 1) to (100, 100) over 1000ms Tween<float>* tempTween = new Tween<float>( &m_position.X, 100, 1000 ) tweenVec.add( tempTween ); tempTween = new Tween<float>( &m_position.Y, 100, 1000 ) tweenVec.add( tempTween );// then in the Object's update code: if ( !tweenVec.empty() ){ for each tween t t->update( currentTime ) if t->isFinished // delete the object and remove the pointer from the vector}[/source]

I thought, through my limited understanding of friends, that if I specified the Tween class as a friend in the Object's declaration code that it could access protected members. I tried making a Tween<T> a friend, but then it wanted me to also make Object a template, which is understandable but very undesirable.

How would someone go about implementing this so object could have a vector of Tween pointers that have access to its protected data? Would knowing which data types it will work on be helpful? As in, explicitly making it friends with Tween<int>, Tween<float> etc? Also, will all of this be undone when I make derived Tweens with specific agorithms?

Research topics regarding game programming

22 July 2011 - 01:06 PM

This isn't exactly a programming question, but very related. I am in my third year of school for game programming, and have to write a semester-long (12ish pages) research paper for English class. I would really like to use that time to research something useful to my career, so I am trying to figure out a topic in programming. Since it's a paper rather than code exploration, it would have to be more theory than application.

My first thought was on programming paradigms. We started in procedural and are now working in mainly OO, but I know little to nothing about other approaches. I can't see spending time exploring the others as anything but a good thing.

Another idea would revolve around scripting and why it is important to game development. This would encompass, among other things, how it's important to open the development to non-low-level-programmer designers.

An extension to that would be a paper on how to approach designing architecture with the designers in mind, encompassing scripting, tools, level builders, etc.

I have written lots of code in C++/DX, and have some experience in C#/XNA and a tiny bit with Lua/binding. The paper would probably be language-agnostic, but I thought it would help to know where I'm at.

What I am asking of this community is for any ideas that I haven't thought of. You guys know the next logical steps for what I should be learning, and I was just looking for some ideas to research. Thanks for any suggestions.

[DX9][C++] Using D3DXFillTexture to create GUI panels

13 July 2011 - 01:18 PM

I am currently working on a dynamic GUI system using C++ and DirectX. I have the majority of it planned out on paper, and am just starting to code it. I've gotten caught up in the discovery of D3DXFillTexture, which is what brought me here.

I may not be understanding how this works, but this is what I want to do and how I am attempting it. I could set the tones with these function calls (light grey in this example):

[source lang="c++"]VOID WINAPI ColorFillGrey (D3DXVECTOR4* pOut, const D3DXVECTOR2* pTexCoord, const D3DXVECTOR2* pTexelSize, LPVOID pData){ *pOut = D3DXVECTOR4(150, 150, 150, 255);}void Panel::Init(){...D3DXFillTexture (m_texture, ColorFillGrey, NULL))...}[/source]

This would fill my box with a light grey color. Then when I go to draw it, I would apply the color that the user chose for the Panel.
[source lang="c++"]// SpriteHandler is a LPD3DXSPRITEg_engine->getSpriteHandler()->Draw( m_texture, &m_rect, NULL, NULL, m_bkgColor );[/source]

The MSDN describes this color (5th) parameter as "The color and alpha channels are modulated by this value." This leads me to believe it will act as a "tint", but I may be way off. The reason I am trying to get this to work is that I would like to use different ColorFill functions depending on the algorithm I would like to apply, such as rounded corners, gradients, etc, then apply the desired color to those greyscale values.

What I am asking is "Am I understanding this correctly?" It seems like it should be working, but the square it draws is always a solid white, no matter what values I pass into the Vector4. Does anyone here have experience with this function that could share some insight? I see that it is used in shader stuff a lot, so maybe I'm going going deeper than I need to with this. Any other suggestions on how to make a dynamic Panel would be great as well.

If I can't get it to work, I go back to DrawPrimitive using TRIANGLELISTs to make colored rectangles, but it seems it would cut out the possibility of applying gradients, etc.

Font Class in C++/DirectX Engine

09 February 2011 - 03:36 PM

I was just looking for some feedback on what you guys typically use for your Font classes. The first project I did we used LPD3DXFONTs, which worked okay. The next book I read about 2D engine development used a bitmapped font like a sprite sheet. This is what I am using in my current project, but I am having a lot of troubles with the tracking (using Bitmap Font Builder to export a binary file and parsing it in the engine to determine spacing). The next book I read for a Game Architecture class wrapped a Win GDI HFONT.

The reason I stopped using D3DXFONT was that I couldn't get them to draw during my render cycle, only after on the top layer. However, I think that may have been a problem on my end, so I could go back to it if need be. I liked the ease of use of it, but I hate the idea that you have to rely on the player having that font installed on their machine already.

So our current project is to make an engine, and I was just looking for input on what this community uses most often.

PARTNERS