Blitting Problem

The problem is probably me, but I can’t seem to get these
two surfaces to blit, the blit function doesn’t return
an error code. But nothing is displayed on the screen?
Maybe this is and SGE problem?

snip

SDL_Surface *screen;
screen = SDL_SetVideoMode(640, 480, 8, SDL_SWSURFACE);
if ( screen == NULL ) {
	fprintf(stderr, "Couldn't set video mode: %s\n", SDL_GetError());
	exit(1);
}

SDL_Rect dstrect;
dstrect.x = 0;
dstrect.y = 0;
dstrect.w = 640;
dstrect.h = 480;

SDL_Surface *buffer;
buffer = SDL_CreateRGBSurface(SDL_SWSURFACE,640,480,8, 0,0,0,0);

for (int k=0;k<480;k++) {    
    sge_ClearSurface(buffer,0);
    sge_HLine(buffer,0,640,k, 255,255,255);
         
    SDL_BlitSurface(buffer, NULL, screen, &dstrect);

    sge_UpdateRect(screen,0,0,640,480);
}

snip

Thanks in advance.

dale–
Dale Welch <@dale_welch>
Institute for Human and Machine Cognition
University of West Florida
Ph 850.202.4434 Fax 850.202.4440
http://www.coginst.uwf.edu/~dwelch

Possibly you need to set up the palette, since they
are 8-bit surfaces? SDL_SetColors() etc.

HTH

– Joe

dale welch wrote:

The problem is probably me, but I can’t seem to get these
two surfaces to blit, the blit function doesn’t return
an error code. But nothing is displayed on the screen?
Maybe this is and SGE problem?

snip

    SDL_Surface *screen;
    screen = SDL_SetVideoMode(640, 480, 8, SDL_SWSURFACE);
    if ( screen == NULL ) {
            fprintf(stderr, "Couldn't set video mode: %s\n", SDL_GetError());
            exit(1);
    }

SDL_Rect dstrect;
dstrect.x = 0;
dstrect.y = 0;
dstrect.w = 640;
dstrect.h = 480;

SDL_Surface *buffer;
buffer = SDL_CreateRGBSurface(SDL_SWSURFACE,640,480,8, 0,0,0,0);

for (int k=0;k<480;k++) {
    sge_ClearSurface(buffer,0);
    sge_HLine(buffer,0,640,k, 255,255,255);

    SDL_BlitSurface(buffer, NULL, screen, &dstrect);

    sge_UpdateRect(screen,0,0,640,480);
}

snip

Thanks in advance.

dale


Dale Welch
Institute for Human and Machine Cognition
University of West Florida
Ph 850.202.4434 Fax 850.202.4440
http://www.coginst.uwf.edu/~dwelch

– Joe Knapka

I think I’m doing everything right, the initial blit works correctly, but
every blit in the event handler doesn’t work. Any help would be
appreciated. All the program does is display a fractal, and let the user
click twice ( upper left corner, lower right corner) to zoom in. This is
just a proof of concept, so the code is not pretty (yet). Any help would be
appreciated.

thanks.

-Ryan Phillips

P.S. The top portion of the source is the graphics putpixel, etc.
The middle portion is the fractal rendering.
the bottom portion has the main function.
300 lines

begin 666 rphillips.cpp
M(VEN8VQU9&4@/’-T9&EO+F@^#0HC:6YC;‘5D92 <W1D;&EB+F@^#0HC:6YC
M;‘5D92 <V1L+F@^#0HC:6YC;‘5D92 =&EM92YH/@T*(VEN8VQU9&4@/&UA
M=&@N:#X-"@T4T1,7U-U<F9A8V4J(’-C<F5E;CL-"E-$3%]3=7)F86-EB!A
M8G5F9F5R.PT*#0I31$Q?4W5R9F%C92H at 0W)E871E4W5R9F%C92@@:6YT(’)E
M<W at L(&EN="!R97-Y+"!I;G0 at 8G!P("D-“GL-”@E31$Q?4W5R9F%C92H at 84)U
M9F9E<B ](%-$3%]!;&QO8U-U<F9A8V4H(’-C<F5E;BT^9FQA9W,L(’)E<W at L
M(’)E<WDL(&)P<“P@#0H)“0D)“0D)“0D)“0D)“2 @<V-R965N+3YF;W)M870M
M/E)M87-K+ T*“0D)“0D)“0D)“0D)“0D@(’-C<F5E;BT^9F]R;6%T+3Y’;6%S
M:RP-”@D)“0D)“0D)“0D)“0D)(”!S8W)E96XM/F9O<FUA=“T^0FUA<VLL(# @
M3L-"@ER971U<FX at 84)U9F9E<CL-“GT-”@T:6YT(’!U=’!I>&5L*%-$3%]3
M=7)F86-E(“I3=7)F86-E+”!3:6YT,S(@6"P at 4VEN=#,R(%DL(%5I;G0S,B!#
M;VQO<BD-“GL-”@D-“B @(&EF(“A8(#P@,”!?”!8(#X at 4W5R9F%C92T^=R!
M?”!9(#P@,”!?”!9(#X at 4W5R9F%C92T^:“D@#0H@(” @<F5T=7)N(“TQ.PT*
M#0H)B at H56EN=#$V("HI4W5R9F%C92T^<&EX96QS("L at 62 J(%-U<F9A8V4M
M/G!I=&-H+S(@R!82 ]($-O;&]R.PT
( T*(” @<F5T=7)N(# [#0I]#0H-
M"FEN=”!B;&ET*”!31$Q?4W5R9F%C92 J9&5S=“P at 4T1,7U-U<F9A8V4@G-R
M8RP@:6YT(‘AS=&%R=“P@:6YT('ES=&%R=“P@:6YT('AM87 at L(&EN=”!Y;6%X
M(“D-“GL-”@E31$Q?4F5C=”!A4F5C=#L-”@EA4F5C="YX(#T@>’-T87)T.R!A
M4F5C="YY(#T@>7-T87)T.PT
"6%296-T+G<@/2!X;6%X.R!A4F5C=“YH(#T@
M>6UA>#L-”@ER971U<FX@%-$3%]";&ET4W5R9F%C92@@<W)C+" F85)E8W0L
M(&1E<W0L(“9A4F5C=” I
3L-“GT-”@T*=F]I9”!,:6YE*%-$3%]3=7)F86-E
MB!3=7)F86-E+"!3:6YT,S(@6#$L(%-I;G0S,B!9,2P at 4VEN=#,R(%@R+"!3
M:6YT,S(@63(L(%5I;G0S,B!#;VQO<BD[#0H-“FEN=”!$;TQI;F4@
%-$3%]3
M=7)F86-E(“I3=7)F86-E+”!3:6YT,S(@6#$L(%-I;G0S,B!9,2P at 4VEN=#,R
M(%@R+”!3:6YT,S(@63(L(%5I;G0S,B!#;VQO<BP@:6YT($-A;&QB86-K*%-$
M3%]3=7)F86-E(“I3=7)F86-E+”!3:6YT,S(@6"P at 4VEN=#,R(%DL(%5I;G0S
M,B!#;VQO<BDI#0I[( T*(”!3:6YT,S(@9@L(&1Y+”!S9’@L(’-D>2P@>“P@
M>2P@<’@L(’!Y.R -“B -“B @9’@@/2!8,B M(%@Q.R -“B @9’D@/2!9,B M
M(%DQ.R -“B -“B @<V1X(#T@&1X(#P@,"D@/R M,2 Z(#$[( T(”!S9’D@
M/2 H9’D@/” P2 _("TQ(#H@,3L@#0H@#0H@(&1X(#T@<V1X(“H at 9’@@R Q
M.R -"B @9’D@/2!S9’D@B!D>2 K(#$[( T( T
(”!X(#T@>2 ](# [( T

M( T*(”!P>” ](%@Q.R -“B @<'D@/2!9,3L@#0H@#0H@(&EF(“AD>” ^/2!D
M>2D@#0H@(”![( T*(” @(” @9F]R(“AX(#T@,#L@>” (&1X.R!XRLI( T
M"0E[( T*“0D)0V%L;&)A8VLH4W5R9F%C92P@<’@L(’!Y+”!#;VQO<BD[#0H@
M"2 -”@D)“7D@ST at 9’D[( T"0D):68@‘D@/CT at 9’@I( T"0D)>R -”@D)
M"0EY(“T](&1X.R -”@D)“0EP>2 K/2!S9’D[( T*“0D)?2 -”@D)“7!X(“L]
M(’-D>#L@#0H)“7T@#0H@(” @?2 -“B @96QS92 -“B @(”![( T*(” @(” @
M9F]R(“AY(#T@,#L@>2 (&1Y.R!YRLI( T"0E[( T*“0D@($-A;&QB86-K
M*%-U<F9A8V4L(’!X+”!P>2P at 0V]L;W(I.PT*( T*“0D@(’@@ST at 9’@[( T
M"0D@(&EF(“AX(#X](&1Y2 -"@D)("![( T"2 @(” @(”!X(“T](&1Y.R -
M”@D@(” @(” @<’@@ST@<V1X.R -"@D)("!]( T"2 @(’!Y(“L](’-D>3L@
M#0H)“7T@#0H@(” @?2 -“B @(’)E=‘5R;B P.PT*?0T*#0HO+R!4:&4@=7-E
M<B=S(&QI;F4 at 9’)A=VEN9R!F=6YC=&EO;@T*=F]I9”!,:6YE*%-$3%]3=7)F
M86-EB!3=7)F86-E+"!3:6YT,S(@6#$L(%-I;G0S,B!9,2P at 4VEN=#,R(%@R
M+"!3:6YT,S(@63(L(%5I;G0S,B!#;VQO<BD-“GL-“B\O(” @4VEN=#,R('1E
M;7 [#0H-“B\J#0H-“B @(”\O($UA:V4@<W5R92!8,2!I<R!B969O<F4 at 6#(@
M#0H@(”!I9B H6#(@/”!8,2E[#0H@(" @("!T96UP(#T at 6#([#0H@(" @("!8
M,B ](%@Q.PT
(” @(” @6#$@/2!T96UP.PT*(” @?0T*(” @+R@36%K92!S
M=7)E(%DQ(&ES(&)E9F]R92!9,B -“B @(&EF(“A9,B (%DQ7L-“B @(” @
M('1E;7 @/2!9,CL-“B @(” @(%DR(#T at 63$[#0H@(" @("!9,2 ]('1E;7 [
M#0H@("!]#0HJ+PT
(” @+R]L;V-K*%-C<F5E;BD[#0H-“B @(”\J($1R87<@
M=&AE(&QI;F4@B-“B @($1O3&EN92A3=7)F86-E+”!8,2P at 63$L(%@R+"!9
M,BP at 0V]L;W(L("9P=71P:7AE;“D[#0H@(” O+W5N;&]C:RA38W)E96XI.PT

M?0T*#0H-“G1Y<&5D968@<W1R=6-T#0I[#0H@(”!D;W5B;&4@<F5A;#L-“B @
M(&1O=6)L92!I;6%G.PT*?2!C;VUP;&5X.PT*#0HC9&5F:6YE($-/3$]24R R
M-34[#0H-“F-L87-S($UA;F1L96)R;W0-“GL-“G!U8FQI8SH-”@EV;VED(%)E
M;F1E<BA31$Q?4W5R9F%C92 J4W5R9F%C92D[#0H)=F]I9”!:;V]M26XH:6YT
M(’@Q+”!I;G0@>3$L(&EN=”!X,BP@:6YT(‘DR(“D[#0H)36%N9&QE8G)O=”@I
M.PT*<’)I=F%T93H-“B @(&EN=”!X+”!Y.PT*(” @;&]N9R @:71E<F%T:6]N
M+”!C;VQO<CL-“B @(&QO;F<@9&5P=&@[#0H@(”!D;W5B;&4@<F%N9V4[#0H@
M(”!D;W5B;&4@;6%X7V1I<W1A;F-E.PT*(" @9&]U8FQE(&1I<W1A;F-E.PT*
M(" @8V]M<&QE>"!O<FEG:6X[#0H@("!C;VUP;&5X(‘HL(&LL(&$[#0H-"GT[
M#0H-"DUA;F1L96)R;W0Z.DUA;F1L96)R;W0H0T>PT*“61E<'1H(#T@,C [
M#0H)<F%N9V4@/2 R+C [#0H);6%X7V1I<W1A;F-E(#T at -“XP.PT*(” @;W)I
M9VEN+G)E86P@/2 M,2XT.PT*(” @;W)I9VEN+FEM86<@/2 Q+C [#0I]#0H-
M"G9O:60 at 36%N9&QE8G)O=#HZ4F5N9&5R*%-$3%]3=7)F86-E("I3=7)F86-E
M0T+RH at 5&AE(&9A;6]U<R!-86YD96QB<F]T(’-E=“P@>B ](“AZ(“L@:RE>
M,B J+PT*>PT*(” @9F]R(“AY(#T@,#L@>2 (#0X,#L@>2LK0T(” @(” @
M9F]R(“AX(#T@,#L@>” (#8T,#L@>“LK0T(” @(” @>PT*(" @(" @(" @
M+RH@($D@:&]P92!M>2!M871H(&ES(’)I9VAT(&AE<F4N("!A+"!K+"!A;F0@
M>B!A<F4 at 8V]M<&QE>"!N=6UB97)S+ at T*(" @(" @(" @(“H@(&L@:7,@=&AE
M(&YO<FUA;&EZ960@’@L>2D at 8V]O<F1I;F%T92!F<F]M('1H92!C=7)R96YT
M(&]R:6=I;BX-“B @(” @(" @(" J("!Z(#T@
'H@R!K5XR#0H@(” @(" @
M(" @B @82 ]('H@R!K#0H@(" @(" @(" @B @>B ](&$@B!A#0H@(" @
M(" @(" @B @>B ]("AA+G)E86Q>,B K(&$N:6UA9UXR2 K("AA+G)E86P@
M
B!A+FEM86<@R!A+G)E86P@B!A+FEM86<I:0T(" @(" @(" @(“H@('H@
M/2 H82YR96%L7C(@R!A+FEM86=>,BD@R R("H@&$N<F5A;" J(&$N:6UA
M9REI#0H@(" @(" @(" @B-“B @(” @(" @(&EN="!F;&%G(#T@,#L-“B @
M(” @(" @( T
(" @(" @(" @>BYR96%L(#T@>BYI;6%G(#T@,"XP.PT
(” @
M(" @(" @+RH@;F]R;6%L:7IE(“HO#0H@(” @(" @("!K+G)E86P@/2!O<FEG
M:6XN<F5A;" K("AD;W5B;&4I(’@@+R H9&]U8FQE
2 V-# @B!R86YG93L-
M"B @(" @(" @(&LN:6UA9R ](&]R:6=I;BYI;6%G("T@
&1O=6)L92D@>2 O
M(“AD;W5B;&4I(#0X,” J(’)A;F=E.PT
(" @(" @(" @9F]R(“AI=&5R871I
M;VX@/2 P.R!I=&5R871I;VX@/”!D97!T:#L@:71E<F%T:6]N
RLI#0H@(" @
M(" @("![#0H@(" @(" @(" @("!A+G)E86P@/2!Z+G)E86P@R!K+G)E86P[
M#0H@(" @(" @(" @("!A+FEM86<@/2!Z+FEM86<@R!K+FEM86<[#0H@(" @
M(" @(" @("!Z+G)E86P@/2 H82YR96%L("H at 82YR96%L
2 M("AA+FEM86<@
M
B!A+FEM86<I.PT
(" @(" @(" @(" @>BYI;6%G(#T@,B J(&$N<F5A;" J
M(&$N:6UA9SL-“B @(” @(" @(" @(&1I<W1A;F-E(#T@>BYR96%L(“H@>BYR
M96%L(“L@>BYI;6%G(“H@>BYI;6%G.PT*(” @(” @(” @(" @:68@&1I<W1A
M;F-E(#X](&UA>%]D:7-T86YC92D-“B @(” @(" @(" @('L-“B @(” @(" @
M(" @(" @(&-O;&]R(#T@
“AI;G0I(&1I<W1A;F-E(“L@,3 P(“D@)2!#3TQ/
M4E,[#0H)“0D)“7!U=’!I>&5L*”!3=7)F86-E+”!X+”!Y+”!31$Q?36%P4D=“
M*”!S8W)E96XM/F9O<FUA=“P at 8V]L;W(L(# L(&-O;&]R(“D@3L-“B @(” @
M(" @(" @(" @(&)R96%K.PT
(” @(” @(” @(" @?0T*(" @(" @(" @?0T*
M(" @(" @?0T*?0T*#0IV;VED(&IU;&EA(“A31$Q?4W5R9F%C92H at 4W5R9F%C
M92D-“GL-“B @(&EN=”!X+”!Y.PT*(” @;&]N9R!I=&5R871I;VXL(&-O;&]R
M.PT*(" @;&]N9R!D97!T:" ](#4P.PT*(" @9&]U8FQE(’)A;F=E(#T@,“XR
M.PT*(” @+R]D;W5B;&4@;6%X7V1I<W1A;F-E(#T at -# N,#L-"@ED;W5B;&4@
M;6%X7V1I<W1A;F-E(#T at -S N,#L-“B @(&1O=6)L92!D:7-T86YC93L-“B @
M(&-O;7!L97@@;W)I9VEN.PT*(” @8V]M<&QE>”!Z+"!K+"!A.PT*#0H@("!O
M<FEG:6XN<F5A;" ](#$N,SL-“B @(&]R:6=I;BYI;6%G(#T@,“XQ.PT*(” @
M9F]R(“AY(#T@,#L@>2 (#0X,#L@>2LK0T(” @(” @9F]R(“AX(#T@,#L@
M>” (#8T,#L@>“LK0T(” @(" @>PT*(" @(" @(" @+RH at 4V%M92!D96%L
M(&AE<F4L(&5X8V5P="!I;FET:6%L:7IE(‘H@=&@=&AE(&YO<FUA;&EZ960@
M*’@L>2D-“B @(” @(" @(" J(&-O;W)D:6YA=&4N("!K(&=E="=S(&EN:71I
M86QI>F5D(‘1O(&$@<F%N9&]M(‘9A;‘5E($D@<‘5T(&EN+ at T*(" @(" @(" @
M(“HO#0H@(” @(" @("!I;G0 at 9FQA9R ](# [#0H@(" @(" @("!K+G)E86P@
M/2 M,2XT,#$Q-34[#0H@(" @(" @("!K+FEM86<@/2 P+C [#0H@(" @(" @
M("!Z+G)E86P@/2!O<FEG:6XN<F5A;" K("AD;W5B;&4I(’@@+R H9&]U8FQE
M2 V-# @B!R86YG93L-“B @(” @(" @('HN:6UA9R ](&]R:6=I;BYI;6%G
M("T@
&1O=6)L92D@>2 O(“AD;W5B;&4I(#0X,” J(’)A;F=E.PT
(" @(" @
M(" @9F]R(“AI=&5R871I;VX@/2 P.R!I=&5R871I;VX@/”!D97!T:#L@:71E
M<F%T:6]NRLI#0H@(" @(" @("![#0H@(" @(" @(" @("!A+G)E86P@/2!Z
M+G)E86P@R!K+G)E86P[#0H@(" @(" @(" @("!A+FEM86<@/2!Z+FEM86<@
M
R!K+FEM86<[#0H@(" @(" @(" @("!Z+G)E86P@/2 H82YR96%L("H at 82YR
M96%L
2 M(“AA+FEM86<@B!A+FEM86<I.PT(” @(" @(" @(" @>BYI;6%G
M(#T@,B J(&$N<F5A;" J(&$N:6UA9SL-“B @(” @(" @(" @(&1I<W1A;F-E
M(#T@>BYR96%L(“H@>BYR96%L(“L@>BYI;6%G(“H@>BYI;6%G.PT*(” @(” @
M(” @(" @:68@&1I<W1A;F-E(#X](&UA>%]D:7-T86YC92D-“B @(” @(" @
M(" @('L-“B @(” @(" @(" @(" @(&-O;&]R(#T@
"AI;G0I(&1I<W1A;F-E
M(“L at -3 @2 E($-/3$]24SL-"@D)“0D)<‘5T<&EX96PH(%-U<F9A8V4L(’@L
M(‘DL(%-$3%]-87!21T(H(’-C<F5E;BT^9F]R;6%T+”!C;VQO<BP@,“P at 8V]L
M;W(@2 I.PT(” @(" @(" @(" @(" @8G)E86L[#0H@(" @(" @(" @("!]
M#0H@(" @(" @("!](" -“B @(” @('T-“GT-”@T
=F]I9”!-86YD;&5B<F]T
M.CI:;V]M26XH:6YT(’@Q+"!I;G0@>3$L(&EN="!X,BP@:6YT(‘DR(“D-“GL-
M"B @(&EN=”!#96YT97)8+”!#96YT97)9.PT*“61O=6)L92!&86-T;W([#0H-
M"B @($-E;G1E<E@@/2 H>#$K>#(I(#X^(#$[#0H@(”!#96YT97)9(#T@'DQ
M
WDR2 ^/B Q.PT(" @1F%C=&]R(" ]("@Q+C J-C0P2 O(&9A8G,H>#(M
M>#$I.PT
"0T*(" @;W)I9VEN+G)E86P@ST@&1O=6)L92D@’)A;F=E("H@
M0V5N=&5R6"D at +R H9&]U8FQE
2 H-C0P(“H@,BXP3L@( T(” @;W)I9VEN
M+FEM86<@+3T@&1O=6)L92D@’)A;F=E(“H at 0V5N=&5R62D at +R H9&]U8FQE
M2 H-#@P("H@,BXP3L@(” )"0T*“7)A;F=E(”](#(["0D-“GT-”@T36%N
M9&QE8G)O="!A36%N9&QE.PT
#0IV;VED(%IO;VU)="AI;G0@:2D-“GL-”@ES
M=&%T:6,@;6EN>"P@;6EN>2P@;6%X>“P@;6%X>3L-”@EI9B@@:2 ]/2 Q(“D-
M”@E[#0H)“5-$3%]'971-;W5S95-T871E*” F;6EN>"P@)FUI;GD@3L-"@D)
M9G!R:6YT9B@@<W1D97)R+" B)6D@)6E<;B(L(&UI;G at L(&UI;GD@3L-"@E]
M#0H)96QS90T
"7L-"@D)"0D)4T1,7T=E=$UO=7-E4W1A=&4H(“9M87AX+” F
M;6%X>2 I.PT
"0D)“0D-”@D)"0D)84UA;F1L92Y:;V]M26XH(&UI;G at L(&UI
M;GDL(&UA>’@L(&UA>‘D@3L-"@D)“0D)9G!R:6YT9B@@<W1D97)R+” B)6D@
M)6E<;B(L(&UA>’@L(&UA>'D@3L-"@E]#0I]#0H-"G9O:60 at 0V]M<&QA:6Y!
M;F1%>&ET
’9O:60I.PT
#0IM86EN*&EN="!A<F=C+"!C:&%R(“IA<F=V6UTI
M#0I[#0H)4T1,7T5V96YT(&5V96YT.PT*#0H)8V]N<W0 at 4T1,7U9I9&5O26YF
M;R J=FED26YF;SL-”@EB;V]L(’-T<F5T8VAE9" ](&9A;’-E.PT*“6EN=”!M
M:6YX+"!M:6YY+"!M87AX+"!M87AY.PT*#0H)+R@4V5T=7 @4T1,(“T at 5FED
M96@3VYL>0T*“6EF*”!31$Q?26YI=”@@4T1,7TE.251?5DE$14@2 (# @
M
0T*“7L-”@D)9G!R:6YT9B@@<W1D97)R+" BB!#;W5L9"=T($EN:70 at 4T1,
M("I<;B(I.PT
"0EE>&ET*#$I.PT*“7T-”@D-"@DO+R!/;B!%>&ET+"!#;&5A
M;G5P(%-$3 T*“6%T97AI=”@@4T1,7U%U:70@3L-"@T"79I9$EN9F@/2!3
M1$Q?1V5T5FED96]);F9O*“D[#0H)4T1,7U-H;W=#=7)S;W(H,2D[#0H-@DO
M+R!%=F5R>6]N92!C86X at 9&@,S(P>#(P,"!S;V9T=V%R90T*“6EF*” H<V-R
M965N(#T at 4T1,7U-E=%9I9&5O36]D92@@-C0P+" T.# L(#$V+"!31$Q?1E5,
M3%-#4D5%3GQ31$Q?4U=355)&04-%(“DI(#T]($Y53$P@0T"0E#;VUP;&%I
M;D%N9$5X:70H3L@(" @(" @(" @(" @(" @(" -"@T"2\O($UA:6X at 4&%R
M=”!O9B!T:&4@<’)O9V=I90T*“5-$3%]3=7)F86-E(“IA8G5F9F5R(#T at 0W)E
M871E4W5R9F%C92@@-C0P+#0X,“PQ-B I.PT*“0T*“6EF*”!A8G5F9F5R(#T]
M($Y53$P@0T"7L-”@D)9G!R:6YT9B@@<W1D97)R+” B0V]U;&1N)W0 at 0W)E
M871E(%-U<F9A8V4B(“D[#0H)“65X:70H,2D[#0H)?0T*#0H):68H(%-$3%]-
M55-43$]#2RAA8G5F9F5R2 A/2 P(“D-”@E[#0H)"5-$3%],;V-K4W5R9F%C
M92@@86)U9F9E<B I.PT
"7T-”@T*“6%-86YD;&4N4F5N9&5R*&%B=69F97(I
M.PT*#0H):68H(%-$3%]-55-43$]#2RAA8G5F9F5R2 A/2 P(“D-”@E[#0H)
M"5-$3%]5;FQO8VM3=7)F86-E
”!A8G5F9F5R(“D[#0H)?0T*#0H)#0H)8FQI
M=”@@<V-R965N+”!A8G5F9F5R+” P+# L-C0P+#0X,” I.PT*(" @+R-"@T*
M"7=H:6QE("@@4T1,7U=A:71%=F5N="@F979E;G0I(#X](# @2 -"@E[#0H)
M"7-W:71C:" H979E;G0N='EP92D@#0H)"7L)"0D)"0T
"0D)8V%S92!31$Q?
M2T591$]73CH-"@D)“7L-”@D)“0E5:6YT.” J:V5Y<SL-"@T*“0D)“6ME>7,@
M/2!31$Q?1V5T2V5Y4W1A=&4H3E5,3"D[#0H)“0D):68@"!K97ES6U-$3$M?
M15-#05!%72 ]/2!31$Q?4%)%4U-%1" I(‘L-"@D)"0D)<’)I;G1F
”)”>64@
M8GEE+BXN7&XB3L-"@D)“0D)97AI=”@P3L-”@D)"0E]#0H)“0D)<’)I;G1F
M*”)-;W5S92!B=71T;VX@<’)E<W-E9%QN(BD[#0H)"0D)8G)E86L[#0H)"0E]
M#0H)“0D-”@D)“6-A<V4 at 4T1,7TU/55-%0E545$].1$]73CH-”@D)“7L-”@D)
M"0EI9B@@<W1R971C:&5D(#T](&9A;’-E(“D-”@D)"0E[#0H)“0D)“5IO;VU)
M=”@Q3L-"@D)“0D)<W1R971C:&5D(#T@=’)U93L-”@D)“0D)8G)E86L#0H)
M"0D)?0T*(" @"0D)96QS92!I9B@@<W1R971C:&5D(#T

M"7L-”@D)"0D)<W1R971C:&5D(#T at 9F%L<V4[#0H)"0D)“5IO;VU)=”@P
3L-
M”@D)"0D)#0H)"0D)"6%-86YD;&4N4F5N9&5R*&%B=69F97(I.PT*"0D)“0EB
M;&ET*”!S8W)E96XL(&%B=69F97(L(# L,"PV-# L-#@P("D[#0H)"0D)?0T*
M"0D)"6)R96%K.PT*"0D)?0T*#0H)“0EC87-E(%-$3%]154E4.B -”@D)“7L-
M”@D)“0EP<FEN=&8H(E%U:70@<F5Q=65S=&5D+”!Q=6ET=&EN9RY<;B(I.PT*
M"0D)"65X:70H,"D[#0H)"0D)8G)E86L[#0H)"0E]#0H)“0D-”@D)?0T*“7T-
M”@T*#0H)<F5T=7)N(# [#0I]#0H-“G9O:60 at 0V]M<&QA:6Y!;F1%>&ET*'9O
M:60I#0I[#0H@(”!F<’)I;G1F*’-T9&5R<BP@(E!R;V)L96TZ(“5S7&XB+”!3
A1$Q?1V5T17)R;W(H2D[#0H@("!E>&ET#$I.PT*?0T*
`
end

I’m having trouble bliting a surface to the screen
surface. it’s telling me I’m passing an incorrect
argument type, But the type is SDL_Rect.

Can anyone offer any suggestions.

[ERROR CODE]
src/window.c: In function window': src/window.c:95: error: incompatible type for argument 2 ofSDL_UpperBlit’
src/window.c:95: error: incompatible type for argument 4 of `SDL_UpperBlit’
c:\mingw\bin\mingw32-make: *** [lib/window.o] Error 1

[CODE BELLOW] Copyright Kevin Macey 2006 [CODE BELLOW]

void window(struct container *screen, struct colour colour, SDL_Rect
area, struct container *content, char name[1000], int shade, int
titlebar, int border, int close, int iconify, int zoom, int update )
{
int x,y;
SDL_Rect title;
SDL_Rect cbutton;
SDL_Rect shaded;
SDL_Rect windowarea;
struct colour fillcolour;
struct colour background;

fillcolour.R=0;
fillcolour.G=0;
fillcolour.B=colour.B-150;

background.R=25;
background.G=50;
background.B=75;

cbutton.x=area.w-25;
cbutton.y=area.y+5;
cbutton.w=area.w-5;
cbutton.h=area.h-5;

title.x=area.x+4;
title.y=area.y+4;
title.w=area.w-1;
title.h=area.y+30;

windowarea.x=area.x+5;
windowarea.y=area.y+35;
windowarea.w=area.w;
windowarea.h=area.h;

shaded.x=area.x;
shaded.y=area.y;
shaded.w=area.w-1;
shaded.h=area.y+31;

// check if window isnt shaded
if ( titlebar )
{

	FillRect(screen, fillcolour, title, 0);
	// draw title bar if there is one
	DrawFrame(screen,colour,title,0,1,0);
			
	title.x=area.x+15;
	title.y=area.y+15;
	title.w=area.w-35;
	title.h=area.x+25;
	
	drawText(screen, colour, title, name, 1,1, 0);
	if ( close )
	{
		cbutton.x=area.w;
		cbutton.y=area.y;
		cbutton.w=area.w;
		cbutton.h=area.y+25;

		//button(screen,colour,cbutton,1,0,0);
	}

	if ( shade )
	{
		if ( border )
			DrawFrame(screen,colour,shaded,0,2,0);
	}else{
		if ( border )
			DrawFrame(screen,colour,area,0,2,0);

		// draw window contents	
		for(y=windowarea.y; y < windowarea.h; y++)
		{
			for(x=windowarea.x; x < windowarea.w; x++)
			{
				DrawPixel(screen,background,x,y,0);

			}

		}

		if( SDL_BlitSurface(content->image, content.area, screen->image, 

windowarea) < 0 )
fprintf(stderr, “BlitSurface error: %s\n”, SDL_GetError());

	}
}

if ( update )
	SDL_UpdateRects(screen->image, 1, &area);

}

Kevin Macey wrote:

I’m having trouble bliting a surface to the screen
surface. it’s telling me I’m passing an incorrect
argument type, But the type is SDL_Rect.

Yup. The type you’re passing is SDL_Rect. The type it’s expecting is
*SDL_Rect. Use SDL_BlitSurface(surf1, &rect1, surf2, &rect2), not
SDL_BlitSurface(surf1, rect1, surf2, rect2), if rect1 and rect2 are
SDL_Rects you made on the stack. (I also fall for this every time I use
SDL_BlitSurface…)

-Christian