![]() |
![]() | #1 |
Студент Join Date: 03 2002 Location: [ Surrealistical World ]
Posts: 312
Downloads: 0 Uploads: 0
Reputation: 0 | 0 | ![]()
Hi there Another mstic problem here.. Look at the code: Code: ... setactivepage(0); setvisualpage(0); textout('Loading...'); setactivepage(1); DoLoad****(); {very slow bmp loading function} setvisualpage(1); ... thx a lot. |
![]() |
![]() | #2 |
Дошкольник Join Date: 01 2002 Location: hell
Posts: 124
Downloads: 0 Uploads: 0
Reputation: 0 | 0 | ![]()
так трудно сказать.. одно ясно - загружается картинка в видимую страницу. Ты в каком графическом режиме работаешь? Не исключено что в этом твоем режиме всего то одна страница видеопамяти.. нужны детали..если можешь постни весь код. |
![]() |
![]() | #3 |
Студент Join Date: 03 2002 Location: [ Surrealistical World ]
Posts: 312
Downloads: 0 Uploads: 0
Reputation: 0 | 0 | ![]()
I'm using 320x200x256 mode. Here is the complete code in Pascal [I have no other selection ![]() Code: program poneslas_muzhiki; uses crt,graph; var P1,P2,M,CS: pointer; size: word; x,y,a,c: integer; gd,gm:integer; bp,bv:integer; procedure loadbgbmp(ff:string); var f: file of byte; cc: byte; x,y: integer; begin assign(f,ff); reset(f); seek(f,filesize(f)-(320*200)); for y:=200 downto 1 do begin for x:=1 to 320 do begin read(f,cc); putpixel(x-1,y-1,cc); end; end; end; begin {initgraph} gd:=installuserdriver('silverff',nil); {install the 320x200x256 BGI driver} gm:=0; {320x200x256 mode} initgraph(gd,gm,' '); {draw object} setfillstyle(1,255); for x:=0 to 20 do begin for y:=0 to 40 do begin c:=random(255)+1; putpixel(x,y,c); end; end; setfillstyle(1,0); bar(5,5,15,35); for x:=0 to 20 do begin for y:=0 to 40 do begin c:=random(255)+1; putpixel(x,y+40,c); end; end; bar(5,45,15,75); readln; setfillstyle(1,255); bar(20,0,39,40); setfillstyle(1,0); bar(25,5,35,35); { setcolor(255); ellipse(10,20,0,360,10,20); floodfill(10,20,255); } {transparency mask} { ellipse(30,20,0,360,10,20); setfillstyle(1,255); floodfill(30,20,255); } readln; size:=imagesize(0,0,19,40); {set pointer addresses} getmem(P1,size); getmem(P2,size); getmem(M,size); getmem(CS,size); {take object and mask} getimage(0,0,19,40,P1^); getimage(20,0,40,40,M^); getimage(0,40,19,80,P2^); cleardevice; {draw the background on 0 buffer} setactivepage(0); loadbgbmp('pablo\home.bmp'); a:=trunc(getmaxx/6); setvisualpage(0); setactivepage(0); { putimage(30,100,M^,orput); putimage(30,100,P^,xorput); } readln; y:=0; for x:=0 to a do begin y:=x; if (odd(x)) then begin bp:=1; end else begin bp:=0; end; setactivepage(bp); getimage(x*2,y,x*2+19,y+40,CS^); putimage(x*2,y,M^,orput); if bp=1 then putimage(x*2,y,P1^,xorput) else putimage(x*2,y,P2^,xorput); setvisualpage(bp); delay(2000); putimage(x*2,y,CS^,normalput); end; readln; end. What this program does is loading a BMP file as a background and moving a transparent sprite on it. thanks a lot.
__________________ ::Against the crowd. |
![]() |
![]() | #4 |
Студент Join Date: 03 2002 Location: [ Surrealistical World ]
Posts: 312
Downloads: 0 Uploads: 0
Reputation: 0 | 0 | ![]()
By the way... FYI [not to make you lost in the source]: there are two sprites loaded - one in P1, and second in P2, so animation sequentially shows P1 and P2 sprites. It's just test purposes, in the future it'll become a guy who will walk. thanks. |
![]() |
![]() | #5 |
Дошкольник Join Date: 01 2002 Location: hell
Posts: 124
Downloads: 0 Uploads: 0
Reputation: 0 | 0 | ![]()
Постой, может я чего то не так понял, но ведь у тебя же там бмп загружается в видимую страницу: Code: setactivepage(0); loadbgbmp('pablo\home.bmp'); a:=trunc(getmaxx/6); setvisualpage(0); setactivepage(0); |
![]() |
![]() | #6 |
Студент Join Date: 03 2002 Location: [ Surrealistical World ]
Posts: 312
Downloads: 0 Uploads: 0
Reputation: 0 | 0 | ![]()
I'm very sorry, I wrote I've forgotten to edit the source. What about this? [revised]: Code: ... {draw the background on 0 buffer} setactivepage(1); setcolor(15); outtext('loading'); setvisualpage(1); setactivepage(0); loadbgbmp('pablo\home.bmp'); ... |
![]() |
![]() | #7 |
Дошкольник Join Date: 01 2002 Location: hell
Posts: 124
Downloads: 0 Uploads: 0
Reputation: 0 | 0 | ![]()
gd:=installuserdriver('silverff',nil); а что это за драйвер |
![]() |
![]() | #9 |
Дошкольник Join Date: 01 2002 Location: hell
Posts: 124
Downloads: 0 Uploads: 0
Reputation: 0 | 0 | ![]()
>>pm
|
![]() |
![]() | #10 |
Студент Join Date: 03 2002 Location: [ Surrealistical World ]
Posts: 312
Downloads: 0 Uploads: 0
Reputation: 0 | 0 | ![]()
Hi there. Sorry for non-informative answer - I had really no time to answer then ![]() here we go. silverff is a BGI driver for 320200256 mode as you already know. It's not written by me... It was a .PAS file converted to BGI by me using a 3rd party converter. It is a 3rd party driver, and the source code isn't available coz I had downloaded it long ago, and I dont remember the site from which I have downloaded it. If you can provide your own driver, or if you can help with finding another - better one, please respond. I'm sure that there IS a page flipping support in that mode, maybe not in that BGI driver, but there for sure IS. That's it I'm waiting for your quick reply. Thanks a lot for assitance, Silver. |
![]() |
![]() | #11 |
Guru Apprentice Join Date: 02 2002 Location: /dev/null Age: 44
Posts: 524
Downloads: 0 Uploads: 0
Reputation: 0 | 0 | ![]()
Silly question, but did you check with some other plotting subroutinse that there are two pages in the driver you're using? Just try something like Code: setvisualpage(0); setactivepage(1); plot(); {or what was the command in PASCAL?? I never investigated too deep how exactly this pages stuff works. I suppose it's nothing to do with PASCAL, Agregat was saying something about asm, so I think it's shomething to do with BIOS int 10 (or Agregat was suggesting to write in video memory directly? That's not very compatible, AFAIK). Actually, you can call interupts from PASCAL without any asm things invovled. I've done this once, switched to 320x200x256 mode by calling int 10, then - draw a line using the same int... But wouldn't remember how exactly I've done this ![]() And, some BGI drivers worth look at (IMHO) http://pascal.sources.ru/graph/svga256.zip
__________________ \/\/h47'5 1n 4 n4m3? 7h47 wh1(h w3 (4|| 4 r053, 8y 4ny 07h3r n4m3 w0u|d 5m3|| 45 5w337... |
![]() |
![]() | #12 |
Дошкольник Join Date: 01 2002 Location: hell
Posts: 124
Downloads: 0 Uploads: 0
Reputation: 0 | 0 | ![]()
2Ektich: Exactly. I suspect that there's just one page in that mode. 2Silver: Try Ektich's code. Let us know what happens. |
![]() |
![]() | #13 |
Дошкольник Join Date: 01 2002 Location: hell
Posts: 124
Downloads: 0 Uploads: 0
Reputation: 0 | 0 | ![]()
And if it is possible send me that bgi driver. abyss-------freenet-------am Last edited by Dark Abyss of Yerevan; 27.04.2005 at 19:48. |
![]() |
![]() | #14 |
Студент Join Date: 03 2002 Location: [ Surrealistical World ]
Posts: 312
Downloads: 0 Uploads: 0
Reputation: 0 | 0 | ![]()
Hello dear people. I don't anymore care for those ****ing BGI files, I was so nervous today about them that I removed all 'uses graph;'s from my codes and wrote a completely new graphics library on Assembly. So I may say that although my brain f***ing hurts, my graphics go CRAZILY FAST!! ![]() All stuff about page flipping, etc, I've realized myself. The only two functions left to write are GetImage/PutImage... I'm sure I'll write them soon, but if anyone has ideas on how to write them in the most optimal way, please reply... Thanks a lot for all your help. Again I'm assuring myself that 3rd party sux. ABYSS:: You still need that .bgi? If so, no probs - I can send it to you. EKTICH:: Drivers on that link ain't work about flipping either. Regards, Silver. |
![]() |
![]() | #15 |
Дошкольник Join Date: 01 2002 Location: hell
Posts: 124
Downloads: 0 Uploads: 0
Reputation: 0 | 0 | ![]()
Yes, that's the best way to make things work ![]() As to the getimage/putimage, there are actually 2 ways of doing it. First, getimage will just copy the rectangle from the video memory to other place, and putimage will blit from mem to videomem. This is done very easily with a set of rep/movsb[w] s. And second, if you need transparent images, you can write some functions for blitting RLE encoded sprites. I used to do this kind of things in C long time ago, so the lib is still http://users.freenet.am/~abyss/moz/GLIB.ZIP There are a lot of good functions there that you can easily translate to Pascal. P.S. Have you tried the ModeX library for Pascal? ModeX was actually what most of the game developers used in the DOS Epoch, before the protected mode dos extenders(dos4gw) appeaared on the scene.
__________________ [x]-=-[ ]-=-[x] |
![]() |
Sponsored Links |