Screen-Smash - Test My Game!!!
Re: Screen-Smash - Test My Game!!!
suite yourself, I would have gone with the sprite idea to draw it to the cursor.
ʕ •ᴥ•ʔ
- thetoddfather
- Posts: 338
- Joined: October 1st, 2012, 9:53 pm
- Location: Canada
Re: Screen-Smash - Test My Game!!!
Is there a way I could use the embedded cursor resource images for that method?
Re: Screen-Smash - Test My Game!!!
Hi Todfather,
I experienced lag when I made my sprite in my Missile command game, but I solved it. The lag isn't in the sending to the screen, it is the way it reads the cursor position. The following code that I wrote solves this.
It reads the cursor position in a different way. There is a lot more to this, as you have to pass the window to the Compose frame.
I experienced lag when I made my sprite in my Missile command game, but I solved it. The lag isn't in the sending to the screen, it is the way it reads the cursor position. The following code that I wrote solves this.
Code: Select all
RECT r;
GetWindowRect( hWnd, &r);
r.right=r.right-5;
r.left= r.left+5;;
r.bottom = r.bottom-100;
ClipCursor( &r );
POINT bn;
GetCursorPos(&bn);
crosshair.Sprite((bn.x-r.left)-27, (bn.y - r.top)-54,5,2000,&gfx, timetest);
Code: Select all
void Game::ComposeFrame(float timeDelta, HWND hWnd)
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk
- thetoddfather
- Posts: 338
- Joined: October 1st, 2012, 9:53 pm
- Location: Canada
Re: Screen-Smash - Test My Game!!!
Ok, I'll try to go that route then. Saves me trying to figure out directx's cursor bull.
So, with missle command all your images are through your resource file? Can you help me now with getting them into the game from their current resource state? The syntax for these things is just not clicking for me.
They are loaded into the .res as 256x256 32 bit cursors. Is there a way I can pull those into a sprite or image I can use for my cursors as you have in misslecommand?? Or am I going to have to redo the .res file and make them bitmaps?
Is there a way I can use this:
Basically, how did you pull your resource images and then assign them to sprites and such?
Would help me a ton to get past this issue. Thanks!
So, with missle command all your images are through your resource file? Can you help me now with getting them into the game from their current resource state? The syntax for these things is just not clicking for me.
They are loaded into the .res as 256x256 32 bit cursors. Is there a way I can pull those into a sprite or image I can use for my cursors as you have in misslecommand?? Or am I going to have to redo the .res file and make them bitmaps?
Is there a way I can use this:
Code: Select all
LoadImage(hInst,MAKEINTRESOURCE(IDC_M4B_CURSOR),IMAGE_CURSOR ,256,256,LR_CREATEDIBSECTION);
Would help me a ton to get past this issue. Thanks!
Re: Screen-Smash - Test My Game!!!
Hi Todfather,
I didn't start by loading from a resource. My original routine I loaded straight from a file. You have to get that to work before thinking about resources. I can post some code later, which I meant to do but I have been caught up with learning Vray the last couple of days.
You know how to load an image already. My sprite routine just loads a row of images as one image.
Then it uses a counter. Say I have a 20 frame animation all in one animation strip. All I have to do to advance to the next frame is advance the pointer to the different images.
In the meantime here is my routine for playing my sprite animation
I setup my face with this
Then I load my face
41 is the sprite width. 63 is the sprite hieght. There are 20 frames and the whole image is 861 wide.
Or from resource with this
I have overload functions in my class so I can either load from resource or from a file.
First of all you already know how to load an image from a file, so all you have to do is to work out how to take an image of more than one frame and load through it.
I will post my full code for you tomorrow, but I have to take out my encoding algorithm first.
I didn't start by loading from a resource. My original routine I loaded straight from a file. You have to get that to work before thinking about resources. I can post some code later, which I meant to do but I have been caught up with learning Vray the last couple of days.
You know how to load an image already. My sprite routine just loads a row of images as one image.
Then it uses a counter. Say I have a 20 frame animation all in one animation strip. All I have to do to advance to the next frame is advance the pointer to the different images.
In the meantime here is my routine for playing my sprite animation
Code: Select all
bool SpriteLoader::Sprite(double x,double y, float Frametime,D3DGraphics* gfx)
{
DrawSprite((int)x,(int)y,gfx);
if (Time==0)
{
endtime= clock()+Frametime;
Time=1;
}
if (clock()>=endtime) {
Frame=Frame+1;
Time=0;
}
if (Frame==NumberOfFrames) {
Frame=0;
return false;
} // This starts the animation again
return true;
}
Code: Select all
SpriteLoader Turret;
Code: Select all
Turret.LoadSprite(L"data//crosshair,41,63,20,861);
Or from resource with this
Code: Select all
Turret.LoadSpriteRes(IDR_TURRET,41,63,20,861);
First of all you already know how to load an image from a file, so all you have to do is to work out how to take an image of more than one frame and load through it.
I will post my full code for you tomorrow, but I have to take out my encoding algorithm first.
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk
- thetoddfather
- Posts: 338
- Joined: October 1st, 2012, 9:53 pm
- Location: Canada
Re: Screen-Smash - Test My Game!!!
OK! After MUCH toil, I think we're almost there.
Have a look at 0.76 and let me know what you think.
This is fullscreen now so there should be no reason for the scrolling issue to pop up.
Cursor calamity is all but over, maybe that'll be the name of my next game lol.
I think I've put more time into this rewrite than I did to get the game to look like this in windowed mode, but hopefully she runs good now.
Next big issue to tackle is timing. It just runs wayyyy too differently depending on the rig, so that's the next issue.
Thanks Asimov,Lux,Chili for the help!
Have a look at 0.76 and let me know what you think.
This is fullscreen now so there should be no reason for the scrolling issue to pop up.
Cursor calamity is all but over, maybe that'll be the name of my next game lol.
I think I've put more time into this rewrite than I did to get the game to look like this in windowed mode, but hopefully she runs good now.
Next big issue to tackle is timing. It just runs wayyyy too differently depending on the rig, so that's the next issue.
Thanks Asimov,Lux,Chili for the help!
Last edited by thetoddfather on November 4th, 2012, 10:04 pm, edited 1 time in total.
Re: Screen-Smash - Test My Game!!!
Worked fine here, Win7 x64.
Good job!
Good job!
- thetoddfather
- Posts: 338
- Joined: October 1st, 2012, 9:53 pm
- Location: Canada
Re: Screen-Smash - Test My Game!!!
Thanks Muttley!
Still a few minor things to fix, but all in all it seems to be working good, fingers crossed.
Still a few minor things to fix, but all in all it seems to be working good, fingers crossed.
Re: Screen-Smash - Test My Game!!!
Yup, pretty cool alright.
I would like to see a gas canister you can spray on the screen then set it on fire : -D
I would like to see a gas canister you can spray on the screen then set it on fire : -D
ʕ •ᴥ•ʔ
Re: Screen-Smash - Test My Game!!!
Hi Todfather,
Sorry it didn't work. In fact it scrolled up so far my laptop fell off the table.
LOL nooooooooooooooooooooo ignore the first line it worked perfectly and doesn't scroll up anymore LOL. I love it now. I knew we could point you in the right direction eventually heh heh.
Hope you didn't have a heart attack after reading my first line LOL
Sorry it didn't work. In fact it scrolled up so far my laptop fell off the table.
LOL nooooooooooooooooooooo ignore the first line it worked perfectly and doesn't scroll up anymore LOL. I love it now. I knew we could point you in the right direction eventually heh heh.
Hope you didn't have a heart attack after reading my first line LOL
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk