|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
نويسنده |
پيغام |
eta مدیر سایت
تاريخ عضويت: 2 شنبه 27 تير 1384 تعداد ارسالها: 2153 محل سكونت: شاهين شهر
5 شنبه 22 آذر 1386 - 11:53 |
|
|
بعد از دو سه ساعت زور زدن بالاخره فهمیدم. کمی هم یادم رفته بود.
ایراد از اینه :
كد: |
int SDL_BlitSurface(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect);
Description
This performs a fast blit from the source surface to the destination surface.
Only the position is used in the dstrect (the width and height are ignored).
If either srcrect or dstrect are NULL, the entire surface (src or dst) is copied.
The final blit rectangle is saved in dstrect after all clipping is performed (srcrect is not modified).
The blit function should not be called on a locked surface.
|
اینجاش :
كد: |
The final blit rectangle is saved in dstrect after all clipping is performed (srcrect is not modified).
|
تو توی اینجا offset رو خراب می کنی:
كد: |
void sprite::draw(SDL_Surface* screen)
{
// for Move
sceneNode::draw(screen);
//Blit
SDL_BlitSurface( mySprite, NULL, screen, &(sceneNode::offset) );
}
|
و
كد: |
void animSprite::draw(SDL_Surface* screen)
{
if ( ( ::SDL_GetTicks() - lastT) >= unsigned(1000 / fps) ) {
if ( (loop && frameN <= frameTotalNumber) || (!loop && frameN < frameTotalNumber) ) {
frameN++;
}
if ( frameN > frameTotalNumber )
frameN = 0;
int N_Cframe = mySprite->w / frameWidth;
frameRect.x = ( frameN - frameN / N_Cframe * N_Cframe ) * frameWidth;
frameRect.y = ( frameN / N_Cframe ) * frameHeight;
lastT = ::SDL_GetTicks();
}
// for Move
sceneNode::draw(screen);
//Blit
SDL_BlitSurface( mySprite, &frameRect, screen, &offset );
}
|
یه ذره مطالعه کن فرزندم!!! |
_________________ تالار اصول ->صفحه ها، مقالات و تاپیکهای مفید
|
|
بازگشت به بالا |
|
|
|
|
|
|
|
|
صفحه 7 از 7 |
تمام ساعات و تاريخها بر حسب 3.5+ ساعت گرينويچ مي باشد برو به صفحه قبلي 1, 2, 3, 4, 5, 6, 7
|
|
شما نمي توانيد در اين انجمن نامه ارسال كنيد. شما نمي توانيد به موضوعات اين انجمن پاسخ دهيد شما نمي توانيد نامه هاي ارسالي خود را در اين انجمن ويرايش كنيد شما نمي توانيد نامه هاي ارسالي خود را در اين انجمن حذف كنيد شما نمي توانيد در نظر سنجي هاي اين انجمن شركت كنيد
|
|
|