![]() |
![]() |
#1 |
Registered User
Join Date: May 2009
Location: Leicester/U.K
Posts: 36
|
Screen glitches with mouse movement or key press
Hi,
I'm still working on the game I mentioned in my previous post. The game doesn't flicker any more as its being drawn but when I move the mouse or press the keyboard I get screen glitches. Here's the paint function I'm using: Code:
void GamePaint() { struct RastPort rp; struct BitMap* bm; bm = AllocBitMap(1024,1024,4,BMF_DISPLAYABLE|BMF_CLEAR,NULL); InitRastPort( &rp ); rp.BitMap = bm; MoveSprite(vp, &my_sprite,X,Y); DrawImage(&rp, &BG,BitMapOrigin.X, BitMapOrigin.Y); Pipes[0].DrawPipe(&rp); Pipes[1].DrawPipe(&rp); DrawImage(&rp, &Ground,X2, BitMapOrigin.Y+WINDOW_HEIGHT - Ground.Height); DrawImage(&rp, &Ground2,X3, BitMapOrigin.Y+WINDOW_HEIGHT -Ground2.Height); BltBitMapRastPort(bm, BitMapOrigin.X, BitMapOrigin.Y, App.GetWindow()->RPort,App.GetWindow()->BorderLeft-4, App.GetWindow()->BorderTop-12,WINDOW_WIDTH,WINDOW_HEIGHT, 0xC0); } |
![]() |
![]() |
#2 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,026
|
A bitmap of 1024 x 1024 x 4 needs 512 KB continuous Chip RAM. It will never run on a A500. You should rather allocate the bitmap with a size of WINDOW_WIDTH x WINDOW_HEIGHT.
You should also specify the screen's bitmap as friend to AllocBitMap. This way the system will optimize the allocation in such a way that blitting into the screen is as fast as possible. I would put MoveSprite after BltBitMapRastPort. Otherwise the sprite moves faster than the background. Regarding your blitting dimensions, BorderLeft and BorderTop are font-sensitive, 4 and 12 are not. What do you intend with this calculation? If your window has a border, you overwrite part of it. If it does not have a border, you blit outside of the window. For a borderless window 0,0 should be right and for a window with border BorderLeft,BorderTop without substraction. BitMapOrigin is not needed at all if your bitmap has the same size as the window (my first point above). Talking about glitches, how do you wait for the next frame? |
![]() |
![]() |
#3 | |
Registered User
Join Date: May 2009
Location: Leicester/U.K
Posts: 36
|
Quote:
The Window does have a border. I used subtraction as it wasn't drawing from the top left corner of the window. I will change it as recommended. I thought I would use a bigger bitmap because the pipes are tall and placed randomly vertically and didn't want them to be drawn outside the bitmap storage. Im not sure about the next frame. The game is cycled through the windows outer main message loop like this: Code:
while( !EndMsgLoop) { while(Message = (struct IntuiMessage *) GetMsg(MyWindow->UserPort)) { // Handle messages etc } GameCycle(); GamePaint(); } ![]() |
|
![]() |
![]() |
#4 | ||
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,026
|
Quote:
Quote:
I would expect a WaitTOF() or WaitBOVP() somewhere in the loop. Or some use of timer.device or IDCMP_INTUITICKS. |
||
![]() |
![]() |
#5 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 48
Posts: 3,839
|
|
![]() |
![]() |
#6 | |
Registered User
Join Date: May 2009
Location: Leicester/U.K
Posts: 36
|
Quote:
Ive also tried controlling the frame rate using timing and still makes no difference even at 1 fps. Iv'e noticed if I dont use a custom screen in the game and set the screenmode to 16 colors the issue goes away but only in hires. changing to lores still gives me the same problem ![]() |
|
![]() |
![]() |
#7 | |
Registered User
Join Date: May 2009
Location: Leicester/U.K
Posts: 36
|
Quote:
I don't have a clue how to set up a copper interupt handler. ![]() Are there any examples on how to do this? |
|
![]() |
![]() |
#8 |
Dazed and Confused
Join Date: Dec 2001
Location: portsmouth/uk
Posts: 242
|
You will find examples of using interrupts with C in the RKM - Libraries. I have attached an extract from the relevant chapter.
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Amiga Mouse Movement over VNC | Enverex | support.WinUAE | 10 | 15 March 2015 18:28 |
getting a user to press a key via AmigaDOS | DeafDaz | Coders. System | 3 | 10 January 2012 17:37 |
Mouse no horizontal movement - a1200 | TomVS | support.Hardware | 8 | 13 November 2009 07:57 |
'Wait' program that checks for a joy button press instead of 'Return' key... | Heavy Stylus | request.Apps | 7 | 10 May 2009 19:01 |
Jerky mouse movement | andreas | support.WinUAE | 3 | 02 June 2002 19:14 |
|
|