It is currently Mon Dec 10, 2018 2:32 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: some gfx code
PostPosted: Sun Sep 14, 2008 11:26 am 
Offline
Enthusiast
Enthusiast

Joined: Tue Oct 05, 2004 9:05 pm
Posts: 103
Location: germany
hi,

some gfx things with pb 2.9 (pb v4 will crash everytime)

smal intro test: logo, scrolltext, static text
Image

Code:
;a simple textscreen by using a
;8x10 pixel bitmap font YESS!
;init the stuff
WbStartup()
opengraphicslibrary_(0)
InitBitMap(2)
InitScreen(0)
InitPalette(0)
InitPicture(0)
InitRainbow(0)
*TagList = InitTagList(100)
;give more cpu power
ProgramPriority(20)

;we load the bitmapfont as picture
LoadPicture(0,"sys:agagame/gfx/font8x10x1.iff")
AllocateBitMap (0,319, 11, 1)
PictureToBitMap(0, BitMapID())

;we load the logo
LoadPicture(0,"sys:agagame/gfx/dawn1.iff")
AllocateBitMap(1,340,256,8)
PictureToBitMap(0,BitMapID())

;we open a costumscreen
UseBitMap(1)
ResetTagList(#SA_Type, #CUSTOMSCREEN | #CUSTOMBITMAP)
      AddTag(#SA_Quiet,1)
      AddTag(#SA_BitMap, BitMapID())
      AddTag(#SA_Top,-10)
      AddTag(#SA_Draggable, 0)
OpenScreen(0,320,256,8, *TagList)

;check up palette
GetPicturePalette (0, PictureID())
;
DisplayPalette(0, ScreenID())
;PalRgb(20,200,200,200)
Rgb(ScreenID(),1,250,250,250)
;some colors more ^^
CreateRainbow(0,255)
 RainbowColor(0,19,255,255,255)
 for i=20 To 198
   RainbowColor(0,i,10+i/2,0,5+i/4)
 next
 RainbowColor(0,199,255,255,255)
 for i=0 To 20
   RainbowColor(0,i+200,i,60,i/2)
 next
 RainbowColor(0,221,255,255,255)
 RainbowColor(0,222,0,0,0) ;dont forget To clear the last line
RainbowEnd(0)
ShowRainbow(0,ScreenID())

Procedure textline(txt.s,x.w,y.w)
  UseBitMap(1)                        ;displaybitmap
  DrawingOutput(bitmapRastPort())     ;draw To this
  UseBitMap(0)                        ;fontbitmap
  For i=1 To Len(txt.s)
  let=asc(Mid(txt.s,i,1));-64
  tx=i*8
  If let>64 And let<92 ;a-z = 1 To 26 no space
   let-64
   CopyBitMap(BitMapID(),let*8,0,tx+x,y,8,10) ;catch the letterz
  EndIf
  If let>47 And let<59 ;1-9 = 27 To 36
   let-21
   CopyBitMap(BitMapID(),let*8,0,tx+x,y,8,10) ;catch the letterz
  EndIf
  Next
EndProcedure

textline("SMALL AMIGA INTRO",90,140)
textline("WITH PUREBASIC",100,160)
textline("ABCDEFGH XYZ 1234",90,180)

scrolltext.s=" SIMPLE SCROLLTEXT DONE WITH SCROLLRASTER"
scrolltextlen=Len(scrolltext)
scrolltextpos=1   
 Repeat
    VWait() ;makes it smooooth
    ShowBitMap(1,ScreenID(),0,0)
    ;update a simple scroller
    scrolltimer+1       ;timer+1 (means 1 pixel more)
    If scrolltimer>8   ;If over 10 pixels (lettersize)
       scrolltimer=0
       scrolltextpos+1
       If scrolltextpos>scrolltextlen
       scrolltextpos=1
       EndIf
        UseBitMap(1)
        DrawingOutput(bitmapRastPort())     ;draw To this
        UseBitMap(0)                        ;fontbitmap
        let=asc(Mid(scrolltext.s,scrolltextpos,1))-64
        If let>0
        CopyBitMap(BitMapID(),let*8,0,330,205,8,10)
        EndIf
    EndIf
    ;scroll continously
    UseBitMap(1)
    scrollraster_(BitMapRastPort(),1,0,1,200,339,220)
    mb.w=mousebuttons()
Until mb.w=2
End



logo and files

_________________
Kultstudio


Top
 Profile  
Reply with quote  
 Post subject: Missing EXE
PostPosted: Tue Oct 14, 2008 2:59 pm 
Offline
User
User
User avatar

Joined: Sun Aug 10, 2008 12:14 pm
Posts: 12
Location: Then
Hi Xperience (sorry didn't saw your post before)

yes, can't run your examples in PB 4.0 (real Amiga & WinUAE)!
so it would be nice if you include a compiled one in the download
file to see how it works...

Greets Peace


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Nov 03, 2008 12:37 am 
Offline
Enthusiast
Enthusiast

Joined: Fri Apr 30, 2004 10:44 pm
Posts: 134
Location: Turkiye (istanbul)
it looks nice. did you upload the compiled exe somewhere?

_________________
-= endo (registered user of purebasic since 98) =-


Top
 Profile  
Reply with quote  
 Post subject: some gfxcode more ^^
PostPosted: Sun Aug 23, 2009 9:35 pm 
Offline
Enthusiast
Enthusiast

Joined: Tue Oct 05, 2004 9:05 pm
Posts: 103
Location: germany
How to include Bitmaps?! :

Code:
; ***********************************************
;      include a 5bpl image in a bitmap
;         by xp^trs  ...amiga rulezZ
; ***********************************************

InitMemoryBank(0)  ;we need only To use the memorycommands^^
InitBitMap(0)      ; We will need 1 bitmap
InitScreen(0)      ; ... and 1 screen
InitPalette(0)

AllocateBitMap(0,320,256,5)  ; Create our bitmaps
OpenScreen(0, 320, 256, 5, 0) ;

LoadPalette(0,"data/dawn1.pal")
DisplayPalette(0,ScreenID())

;bitmappaint
 UseBitMap(0)
 *bmappointer=BitMapID()
 *plane1ptr.l=PeekL(*bmappointer+8)
 *plane2ptr.l=PeekL(*bmappointer+12)
 *plane3ptr.l=PeekL(*bmappointer+16)
 *plane4ptr.l=PeekL(*bmappointer+20)
 *plane5ptr.l=PeekL(*bmappointer+24)
 *imageptr.l=?lettera

; raw ilbm - mode: line1 bpl1 bpl2..line2 bpl1 bpl2...
pointer=0
For lines=1 To 1280 ;256 lines* 5 bpl
 CopyMemory(*imageptr +pointer         ,*plane1ptr+pointer ,40)
 CopyMemory(*imageptr +pointer+10240   ,*plane2ptr+pointer ,40)
 CopyMemory(*imageptr +pointer+20480   ,*plane3ptr+pointer ,40)
 CopyMemory(*imageptr +pointer+30720   ,*plane4ptr+pointer ,40)
 CopyMemory(*imageptr +pointer+40960   ,*plane5ptr+pointer ,40)
 pointer+40
Next


  Repeat
    VWait()
    ShowBitMap(0,ScreenID(),0,0)
   
    mb.w = mousebuttons()
  Until mb.w = 1

End      ; Finish the program and free all stuffs.

lettera:
IncludeBinary "data/dawn1.ilbm"




more examples, executables and codes here:
download 50kb

have fun =)

_________________
Kultstudio


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye