AlexSleyore's Profile User Rating: -----

Reputation: 2 Apprentice
Group:
Members
Active Posts:
18 (0.03 per day)
Joined:
23-July 12
Profile Views:
341
Last Active:
User is offline Mar 04 2013 03:08 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   AlexSleyore has not set their status

Posts I've Made

  1. In Topic: DirectX Sprites

    Posted 13 Feb 2013

    I am aware this question is VERY old. However I must respond because the answers are false. YES, you can do everything with 1 sprite - and in fact you SHOULD do everything with one sprite if you can. It removes the need for the extra Sprite.Begin and Sprite.End calls. - as well as a slight optimization on reset and lost devices. Here is an example of how I am doing it - This is not the best method in my example as I am still working on my SDK, but it is achievable.

    Sprites::DisplaySprites(){
    	
    Sprite->Begin(D3DXSPRITE_ALPHABLEND);
    SpriteClass->Directx->DirectxDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
    SpriteClass->Directx->DirectxDevice->SetRenderState (D3DRS_ALPHABLENDENABLE, TRUE);
    SpriteClass->Directx->DirectxDevice->SetRenderState (D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
    
    D3DXVECTOR2 Pos;
    D3DXMATRIX Matrix;
    D3DXVECTOR2 drawScale;
        for(int Count = 0; Count < TotalSprites;Count++){
    
    		double TextureWidth = SpriteClass->Textures->GetTexture(SpriteItems[Count].TextureID)->Width;
    		double TextureHeight = SpriteClass->Textures->GetTexture(SpriteItems[Count].TextureID)->Height;
    		Pos.x =  (float)SpriteItems[Count].X;
    		Pos.y =  (float)SpriteItems[Count].Y;
    		drawScale=D3DXVECTOR2(
    			(((float)WindowWidth/TextureWidth)*(float)SpriteItems[Count].Width)/WindowWidth
                ,	
    			(((float)WindowHeight/TextureHeight)*(float)SpriteItems[Count].Height)/WindowHeight
    			);
    
    		D3DXMatrixTransformation2D(&Matrix,NULL,0.0,&drawScale,NULL,NULL,&Pos);
    		Sprite->SetTransform( &Matrix );
    
    
    			Sprite->Draw(
    				SpriteClass->Textures->GetTexture(
    				SpriteItems[Count].TextureID
    				)->Texture,
    				
    				NULL,NULL,NULL,0xFFFFFFFF ); 
    		
    	}
    
    		Pos.x =  0;
    		Pos.y =  0;
    		drawScale=D3DXVECTOR2(1,1);
    	D3DXMatrixTransformation2D(&Matrix,NULL,0.0,&drawScale,NULL,NULL,&Pos); // reset matrix for text
    	Sprite->SetTransform( &Matrix );
    	SpriteGUIClass->Texts->DisplayText(Sprite);
    Sprite->End();
    SpriteClass->Directx->DirectxDevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
    TotalSprites = 0;
    }
    
    


    void Sprites::AddSprite(long TextureId, long X, long Y, long Width, long Height){
    	
    if(TotalSprites >= MaxSprites) //Handles increasing the sprite array size when I am add more sprites then I have room for
    {
    MaxSprites = MaxSprites * 2;
    SpriteItem* Temp = new SpriteItem[MaxSprites];
    for(int i = 0; i < (MaxSprites/2); i++)
    {Temp[i] = SpriteItems[i];}
    delete [] SpriteItems;
    SpriteItems = Temp;
    }
    
    SpriteItems[TotalSprites].TextureID = TextureId;
    SpriteItems[TotalSprites].X = X;
    SpriteItems[TotalSprites].Y = Y;
    SpriteItems[TotalSprites].Height = Height;
    SpriteItems[TotalSprites].Width = Width;
    SpriteItems[TotalSprites].Color=Color;
    
    TotalSprites++;
    }
    
    

    This will not work for you as is, however I hope it can point you in the right direction. As well as helping other people who run into this post through google because its the 6th post under "Directx Sprite"
  2. In Topic: Fibonacci challenge

    Posted 1 Aug 2012

    Spoiler


    Untested.. But I think thats correct...
  3. In Topic: what does string str = ""; really mean?

    Posted 31 Jul 2012

    well assuming your strings are Null terminated its just 1 byte of \0. I believe that the Clear function sets all the bytes used to \0, instead of just the first byte.
  4. In Topic: calculate 26 pay period based on year.

    Posted 31 Jul 2012

    (MoneyPerYear/DaysInAYear)*TimePeriodInDays

    like.. explaining that??
  5. In Topic: How to go about game like geedy spiders or Logic behind it?

    Posted 26 Jul 2012

    View Postsanghai45, on 26 July 2012 - 08:31 PM, said:

    View PostAlexSleyore, on 26 July 2012 - 05:59 PM, said:

    I was looking at greedy spiders and it doesnt use pure A*. It also checks how many options there are for vertex so that you cant trap it as easily, but most games wouldnt need this because usually the movement points are static.



    How many options there are for vertex means ? Its manipulating A* by checking all the possible flies and first its finding the closest flies ? is it that way ?


    A* checks in 4 directions and connects to 4 other vertexs in a grid, the Spiders in that game move along the webs so there can be 1-7ish webs attached at one point.

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

AlexSleyore hasn't added any friends yet.

Comments

AlexSleyore has no profile comments yet. Why not say hello?