snoopy11's Profile User Rating: *****

Reputation: 953 Master
Group:
Mentors
Active Posts:
2,885 (1.45 per day)
Joined:
20-March 10
Profile Views:
41,087
Last Active:
User is offline Today, 08:04 PM
Currently:
Offline

Previous Fields

Country:
GB
OS Preference:
Windows
Favorite Browser:
FireFox
Favorite Processor:
Intel
Favorite Gaming Platform:
Nintendo
Your Car:
Nissan
Dream Kudos:
1100
Expert In:
C/C++
Icon   snoopy11 has not set their status

Posts I've Made

  1. In Topic: Graphics Confusion

    Posted 2 Sep 2015

    Well,

    The OP has apologized to me in a PM.

    After some thought I have decided to post a solution.


    Star Fighters.cpp

    #include "Star Fighters.h"
    #include "Graphics.h"
    #include "Input.h"
    #include "Textures.h"
    #include "Sprite.h"
    #include "Fonts.h"
    #include "Audio.h"
    
    Graphics *graphics;
    GameInput *gameinput;
    Surface *surface;
    Sprite *sprite;
    Font *fonts;
    Audio *audio;
    
    const string Class_Name = "Game Engine";
    const int ScreenW = 640;
    const int ScreenH = 480;
    
    // The Name Will Be Changed To Fit Each Game
    const string Game_Title = "Star Fighters";
    
    // Sprite And Surface Data
    LPDIRECT3DSURFACE9 background = NULL;
    
    Sprite ScoreBar, Player, Enemy, Bullet;
    
    LPDIRECT3DTEXTURE9 Score_Bar = NULL;
    LPDIRECT3DTEXTURE9 PlayerShip = NULL;
    LPDIRECT3DTEXTURE9 EnemyShip = NULL;
    LPDIRECT3DTEXTURE9 PlayerBullet = NULL;
    
    StarFighters::StarFighters()
    {
    }
    
    StarFighters::~StarFighters()
    {
    }
    
    bool StarFighters::Initialize(HWND window)
    {
    	graphics->GraphicsInitialize(window, ScreenW, ScreenH, false);
    
    	gameinput->Input_Initialize(window);
    
    	// Load Textures And Surfaces Between Here
    	LPDIRECT3DSURFACE9 image = NULL;
    	image = surface->LoadSurface("Data\\textures\\star.png");
    
    	D3DSURFACE_DESC desc;
    	image->GetDesc(&desc);
    
    	HRESULT result = d3ddev->CreateOffscreenPlainSurface(
    		desc.Width,
    		desc.Height,
    		D3DFMT_X8R8G8B8,
    		D3DPOOL_DEFAULT,
    		&background,
    		NULL);
    
    	surface->DrawSurface(background, 0, 0, image);
    
    	Score_Bar = sprite->LoadTexture("Data\\textures\\scorebar.tga");
    
    	PlayerShip = sprite->LoadTexture("Data\\textures\\playership.tga");
    
    	EnemyShip = sprite->LoadTexture("Data\\textures\\enemyship.tga");
    
    	PlayerBullet = sprite->LoadTexture("Data\\textures\\playerbullet.tga");
    	// And Here
    
    	// Set Sprite Attributes Between Here
    	ScoreBar.x = 0;
    	ScoreBar.y = 0;
    	ScoreBar.width = 640;
    	ScoreBar.height = 20;
    
    	Player.x = ((ScreenW / 2) + (Player.width / 2));
    	Player.y = ScreenH - Player.height;
    	Player.width = 47;
    	Player.height = 53;
    	// And Here
    	
    
    	d3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer);
    	image->Release();
    	
    	return true;
    }
    
    
    void StarFighters::Run(HWND window)
    {
    	if (!d3ddev) return;
    
    	gameinput->Input_Update();
    
    	d3ddev->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(255, 255, 255), 1.0f, 0);
    
    	// All Keyboard, Mouse, And Controller Functions Go Between Here
    
    	// And Here
    
    	// All Automatic Animations And Movements Go Bewteen Here 
    
    	// And Here
    
    	// All Collision Tests Go Between Here 
    
    	// And Here
    
    	// All Drawing Go In Here
    	if (d3ddev->BeginScene())
    	{
    		surface->DrawSurface(backbuffer, 0, 0, background);
    
    		spriteobj->Begin(D3DXSPRITE_ALPHABLEND);
    
    		sprite->SpriteFrameDraw(Score_Bar, ScoreBar.x, ScoreBar.y, ScoreBar.frame, ScoreBar.width, ScoreBar.height, ScoreBar.columns);
    
    		/*sprite->TransformSpriteDraw(Score_Bar, ScoreBar.x, ScoreBar.y, ScoreBar.width, ScoreBar.height,
    		ScoreBar.frame, ScoreBar.columns);*/
    
    		sprite->TransformSpriteDraw(PlayerShip, Player.x, Player.y, Player.width, Player.height,
    			Player.frame, Player.columns);
    
    		spriteobj->End();
    
    		// Stop Rendering
    		d3ddev->EndScene();
    		
    		d3ddev->Present(NULL, NULL, NULL, NULL);
    	}
    }
    
    void StarFighters::End()
    {
    	if (background) background->Release();
    	// All Loaded Textures And Surfaces Are Released Between Here
    	if (Score_Bar) Score_Bar->Release();
    	if (PlayerShip) PlayerShip->Release();
    	// And Here
    
    	gameinput->Input_Shutdown();
    	graphics->GraphicsShutdown();
    }
    
    


    The problem was a mismatch between the two off screen plain surfaces in terms of Width and Height, setting the two exactly the same resolves the problem.

    Enjoy.
  2. In Topic: Indesign vs Photoshop?

    Posted 1 Sep 2015

    Ahh I see....
  3. In Topic: Indesign vs Photoshop?

    Posted 1 Sep 2015

    No adobe make Photoshop and they make InDesign.

    I doubt adobe are resorting to spamming programming forums....
  4. In Topic: Indesign vs Photoshop?

    Posted 1 Sep 2015

    So it wasn't just me after all....
  5. In Topic: VOTING - Signature of the Month: August 2015

    Posted 1 Sep 2015

    Oh well,

    Its between me and no2pencil

    unless there is a late run on the andrewsw supporters.

    and to remind everyone what the shiny 24 carat bar looks like here it is in all its shinyness...

    Attached File  shiny24caratbar.PNG (3.07K)
    Number of downloads: 1

My Information

Member Title:
Engineering ● Software
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Years Programming:
6
Programming Languages:
C/C++, Java, Python, J2ME, Android, Liberty Basic, Basic.
learning VB.net and C#

Contact Information

E-mail:
Private

Comments

  • (2 Pages)
  • +
  • 1
  • 2
  1. Photo

    moonlight1020 Icon

    07 Jul 2015 - 05:36
    http://www.dreamincode.net/forums/topic/378386-problem-with-char-array/page__gopid__2167326&#entry2167326
  2. Photo

    moonlight1020 Icon

    06 Jul 2015 - 15:36
    http://www.dreamincode.net/forums/topic/378386-problem-with-char-array/page__gopid__2167216&#entry2167216
  3. Photo

    Icebreake Icon

    13 Apr 2015 - 10:36
    Hi can you help me with a sound recorder?
  4. Photo

    da1 Icon

    16 Jun 2014 - 22:25
    can you help me not sure what this other guy is telling me
  5. Photo

    David W Icon

    15 Jun 2014 - 04:54
    Hey snoop's ... good to see you're still breathing :)
    Shalom my friend ... and best regards David
  6. Photo

    tarmizi_adam2005 Icon

    27 Nov 2013 - 18:59
    Just wanted to stop by and say thanks for giving some nice advice in my post (reading wave file c/c++) the other day. Thank you so much snoopy11 !
  7. Photo

    yowzz28 Icon

    07 Oct 2013 - 23:44
    hello sir can you please help me to my project in turbo c++ IDE We will do a simple payroll system just a simple only sir . Please help me :((
  8. Photo

    ankush.dev2 Icon

    02 Aug 2013 - 11:27
    sir what can i do to enhance my knowledge of c/c++ programming..??
    i am the one you helped me last day regarding that audio library proect...
  9. Photo

    cpp_help Icon

    31 Jul 2013 - 20:18
    Hello Snoopy11. I often use this site to learn more about c++ and I have seen many of your comments in helping other people. You seem quite knowledgeable in c++. I needed some help. Can you email me at dx6007@wayne.edu please. I would really appreciate it. Thanks.
  10. Photo

    lana ana Icon

    29 Apr 2013 - 00:25
    https://www.facebook.com/lena.ana.904
    this is my page on fb ,, please if u can help me
  11. Photo

    lana ana Icon

    29 Apr 2013 - 00:24
    hello ... i am lana from jordan can u help me in problem please i must send it to my Dr today please i need ur help ,,, ??
    my problem about multithread
  12. Photo

    mamelove25 Icon

    19 Feb 2013 - 11:02
    Hello My Dear, My Name is Mame. i saw your profile today and became interested in you,i will also like to know you more,and if you can send an email to my email address,i will give you my pictures here is my email address (mame25live@yahoo.co.uk) I believe we can move from here! Am waiting for your mail to my email address above because i have much to tell you,
    love Miss Mame.
  13. Photo

    raghav.naganathan Icon

    16 Nov 2012 - 02:21
    Dude...before your rep(343) changes, I would like to tell you that it is a perfect cube :)
  14. Photo

    SaranyaNair Icon

    02 Oct 2012 - 22:51
    hi snoopy..i'm new to programming,,can u guide me some step how to more explore in programming?
  15. Photo

    Joshuwa Icon

    07 Jun 2012 - 17:42
    I am new to programming and I really want to learn. What would you suggest learning first? Whats the best approach?
  • (2 Pages)
  • +
  • 1
  • 2