Jump to content
  • Advertisement

steven31dd

Member
  • Content Count

    63
  • Joined

  • Last visited

Community Reputation

115 Neutral

About steven31dd

  • Rank
    Member
  1. steven31dd

    Font Cutting Sprites

    well instead of having LPDIRECT3D9,LPDIRECT3DEVICE9, etc part of the graphics class I had them as global sitting on top of graphics.cpp. but yea I didn't have that buffer which fixed the problem, thanks Evil Steve. sweet, now I can continue my game/editor, the directx api is not so steep as I thought.
  2. steven31dd

    Font Cutting Sprites

    If this isn't it then I am missing something, It's called right when Game.Render() starts.(I know structure could be better but this literally would be the first game I have ever made). void CGraphics::StartRender() { d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(120,120,255), 1.0f, 0); d3ddev->BeginScene(); d3dspt->Begin(D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_DEPTH_FRONTTOBACK); } could it also be the fact that I'm pointing LPD3DXSPRITE to font as well as my sprites?? or the fact that I've made the directx functions global inside my graphics.cpp file?
  3. steven31dd

    Font Cutting Sprites

    Can someone tell if I'm either using font or sprite wrong?
  4. I was working on testing a key press function, and I noticed that the font has been cutting through my sprites. update method does seem to do its job, i also did sprite flush to see if that would work, but no. check it out for yourself. CGame::CGame(DWORD FrameLimit) { dwFPSLimit = FrameLimit; //luaVM = lua_open(0); tab = Paused = false; } void CGame::Initialise(CPlayer &player, CFile &file) { file.InitPlayer(&player); file.InitSprite(&sprite); //lua_dostring(luaVM, strLuaInput); } void CGame::LoadGraphics(CGraphics &graphics,CPlayer &player) { graphics.LoadFont(30); graphics.LoadSprite(&sprite.Tex, L"Mark.png"); graphics.LoadSprite(player.GetPTexture(), L"PlayerSpot.png"); } void CGame::Update(CPlayer &player, CFile &file) { GetCursorPos(&MousePos); if(KEY_DOWN(VK_ESCAPE) && Paused == false) Paused = true; else if(KEY_DOWN(VK_ESCAPE) && Paused == true) Paused = false; if(Paused == false) { //file.SavePlayer(&player); //file.SaveSprite(&sprite); } } void CGame::Render(CGraphics &graphics,CPlayer &player) { dwCurrentTime = GetTickCount(); if ((dwCurrentTime - dwLastFrameTime) < (1000 / dwFPSLimit)) // 1000 miliseconds in a second. { return; } dwLastFrameTime = 0; graphics.StartRender(); if(Paused == true) graphics.DrawFont(0,0, 600, L"PAUSE", 30); graphics.DrawSprite(player.GetTexture(), 32, 32, 1, 1, 0, player.GetPositionX(), player.GetPositionY(), player.GetZLayer()); graphics.DrawSprite(sprite.Tex, 32, 32, 1, 1, 0, sprite.X, sprite.Y, sprite.Z); graphics.EndRender(); dwLastFrameTime += (1000 / dwFPSLimit); } edit: fixed image link
  5. steven31dd

    classes

    Alright this makes things much clearer, generally I wasn't able to find how classes in games were implemented. looks like I'm gonna have to go back to the old drawing board and concept a better engine. thanks rip-off I am starting to get a better hang of this.
  6. steven31dd

    classes

    Ah I see now, because I treated them like pointers and not global's, it was acting up, ok this opens up more opportunities which is good. I thank you guys for the help, especially since I didn't have actually code to show. This was something I wanted to know for some time, because i didn't want to mesh my two classes like I did. I'm gonna practice using those two situations you provided. As far as those destructors, yea I know it was bad practice, but i didn't fell like typing the cleanUp() functions, so I stuck with showing that in my example. OH! one more question maybe you can help with, if I were to put update and render in their own cpp files. would I use extern window and graphics, and have the actual classes initialised in WinMain?
  7. steven31dd

    classes

    I would but I already meshed it together, perhaps this is the way to do it, although I'm having the directx sprite break the debug, but thats on my own. but I'll give an example, of how I had it coded. just to give an idea so I wont be throwing exact details just what I believe has caused the problem. //Window class--- class CWindow { protected: HWND hwnd; public: CWindow(); ~CWindow(); bool Setup(); bool PumpMessages(); HWND GetHWND() { return hwnd; } }; //Directx Class--- class CGraphics { private: //Directx globals public: CGraphics(); ~CGraphics(); bool InitDX(HWND hwnd); void StartRender(); void EndRender(); Load.. Draw.. }; //WinMain--- //headers CWindow win; CGraphics DX; int WinMain() { if(!win-&gt;Setup()) // Message and return if(!DX-&gt;InitDX(win-&gt;GetHWND())) // Message and return, Now I see this I think I can see why. while(win-&gt;PumpMessages()) { update(); Render(); } DX-&gt;~CGraphics(); win-&gt;~CWindow(); return 0; } Update() { } Render() { DX-&gt;StartRender(); DX-&gt;EndRender(); }
  8. I usually use system("PAUSE"); before the exit code.
  9. steven31dd

    classes

    I have made a window class that is mixed with directX in c++. Is there a way to split these as their own classes every time I try in many different ways like a global header. I always get a Linker error for HWND or the Debug stops and has an exception at d3ddev->BeginScene(); didn't get the value of the exception though at the time. I would have the directx class have a StartRender() function, with clear() and beginscene(). Basically How would I go about Linking these classes correctly, using Inheritance?
  10. steven31dd

    level editor

    thats nice and all but I don't want to use a pre-made engine and yes I have used level editors such as thief deadly shadows, wc3, morrowind, and oblivion. I just want an Indepth look on a tile editor, or a tutorial to say the least. ty tho, just not what I'm looking for.
  11. steven31dd

    level editor

    I wonder if someone can post up a link to a level editor tutorial, yes I have done google(no success). I have a half-completed project that has load/save functions with an array-split screen. I need a more Indepth look at it. I have basic structure of what may be needed at the least.
  12. steven31dd

    Transforming 2D sprite

    k I got my Sprite class done its working with a small moving tile, my concern here: how is a transform from sprite to sprite implemented? - I know a timer is used for animation, but do I Create another sprite that alpha blends in as the other goes out? that's my main guess. or is there another function provided by D3DX? using DirectX 9 with visual studio 2008
  13. steven31dd

    Directx 9 sprite class help

    Alright I got to make a new class of d3ddev with friendship or Inheritance I'll take it from here. Thanks for your help again, I made so many typos to confuse myself.
  14. steven31dd

    Directx 9 sprite class help

    Quote:Original post by VanillaSnake21 Quote:Original post by steven31dd I found that changing ID3DXSPRITE to LPD3DXSPRITE generates less errors so I did do something wrong there. Like I said ID3DXSPRITE does not exist, it should be ID3DXSprite, it generates less errors because LPD3DXSPRITE is an actual class. so um is it preferably that I use ID3DXSprite instead of LP...
  15. steven31dd

    Directx 9 sprite class help

    I'll get to idea on d3ddev, if you don't mind I'll add you as a buddy. I think I may need your help in future projects. HAHA there was a typo in Sprite::LoadSprite(). down to two errors now, I'll post an image to show i got it.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!