Page 1 of 1

Posted: Thu Feb 21, 2002 11:46 am
by BackupUser
Restored from previous forum. Originally posted by blue-speed.

Hi!

ive a problem with my text. I want to format it like this:
"The Titel"
" Here comes the the text"
" and thats another line of"
" the text"
here is my code:

Code: Select all


If InitSprite() = 0
   MessageRequester("Error","Can't find DX7 or higher",0)
   End  
EndIf   
If InitKeyboard() = 0
   MessageRequester("Error","Can't find DX7 or higher",0)
   End  
EndIf   
If OpenScreen(800,600,32,"Sinus-lines") = 0
   MessageRequester("Error","Can't open a Fulscreen",0)
   Else 

Dim story.s(7)
For s = 0 To 7
  story(0) = " _-| A Test|-_"
  story(1) = "This is a small test with a text"
  story(2) = "i can use it for credits and other"
  story(3) = "things so it would be easy to put "
  story(4) = "it in a game credit............. "
  story(5) = "................................."
  story(6) = "................................."
  story(7) = "................................."  
Next 

LoadFont(0,"Courier",20)
Repeat  
  FlipBuffers() 
  ClearScreen(255,255,255)
  ExamineKeyboard()
  DrawingFont(UseFont(0))
  For s = 0 To 7 
    For l = 160 To  200 
       Locate(200,l)
       DrawText(story(s)) 
     Next       
   Next   
  StopDrawing()
Until KeyboardPushed(#PB_Key_Escape)
EndIf          
All this text came on a line...does anybody know why that happens?

cya
bluespeed

http://www.purehilfe.de.vu

Edited by - blue-speed on 21 February 2002 11:48:15

Posted: Thu Feb 21, 2002 12:55 pm
by BackupUser
Restored from previous forum. Originally posted by El_Choni.

Hi,

This crashes here. Not your fault: I have the Sprite lib updated the 12/02 and that seems to be what is crashing lcclnk (page fault at).

BTW, thank you for posting your code with format, it's getting rare these days.

Bye,

PS: maybe you can try this:

Code: Select all

For s = 0 To 7
  For l = 160 To  200
    y = l+(32*s)
    Locate(200, y)
    DrawText(story(s))
  Next l
Next s
El_Choni

Posted: Thu Feb 21, 2002 4:24 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.

Code: Select all

For s = 0 To 7
  For l = 160 To  200
    y = l+(32*s)
    Locate(200, y)
    DrawText(story(s))
  Next l
Next s
El_Choni
Why not just:

Code: Select all

y.l=160
For s = 0 To 7
  Locate(200, y)
  DrawText(story(s))
  y+16 ; or whatever your character height is
Next s

Posted: Thu Feb 21, 2002 5:21 pm
by BackupUser
Restored from previous forum. Originally posted by MrVainSCL.

Hi Pupil
yes, your code is mutch smaller as blue-speeds one.. only one loop :wink:

Hi blue-speed
I am a bit wondered about your code... Why are you doing following things:

"For s = to 7" - you dont need this! Just remove the next for loop!
When usind StopDrawing() you must say somewhere before StartDrawing() for example
StartDrawing(ScreenOutput())
When clear the background (255,255,255) you must define a new FrontColour() for your text output to see it!
If you want print your text only once, you dont need to put this routine in your Repeat Until loop!
Mhhh.. and as Pupil sayed, you dont need the second innerloop "for l = 160 to 200"


Ok, thats all.. you have to fix a lot :wink: Good luck


PIII450, 256MB Ram, 6GB HD, RivaTNT, DirectX8.1, SB AWE64, Win98SE + Updates...

greetz
MrVainSCL! aka Thorsten

Posted: Thu Feb 21, 2002 7:04 pm
by BackupUser
Restored from previous forum. Originally posted by blue-speed.
Hi Pupil
yes, your code is mutch smaller as blue-speeds one.. only one loop :wink:

Hi blue-speed
I am a bit wondered about your code... Why are you doing following things:

1)"For s = to 7" - you dont need this! Just remove the next for loop!
2)When usind StopDrawing() you must say somewhere before StartDrawing() for example
StartDrawing(ScreenOutput())
3)When clear the background (255,255,255) you must define a new FrontColour() for your text output to see it!
4)If you want print your text only once, you dont need to put this routine in your Repeat Until loop!
5)Mhhh.. and as Pupil sayed, you dont need the second innerloop "for l = 160 to 200"


Ok, thats all.. you have to fix a lot :wink: Good luck


PIII450, 256MB Ram, 6GB HD, RivaTNT, DirectX8.1, SB AWE64, Win98SE + Updates...

greetz
MrVainSCL! aka Thorsten
sorry but the code is much biger so i cant put all things, ive put what i need to use and sometimes i forget to put anything like StartDrawing but belive me i know that i must put startdrawing before stopdrawing and in my full source ive put it but i want know only why it dosent work i c only the text but i cant read the font it looks realy ugly.

to 2) its only a cut code so look at the main problem cz ive put this in my full source, thats not my problem if thats my problem ill tell u

to 3) like 2) ive put it in my source but not here, and thats not the problem i can see it.

to 4) no i want to move the text so i need to write it more then once.

u see ive write this cut code to show the main problem the other errors arent in my code

cya
bluespeed

http://www.purehilfe.de.vu

Posted: Thu Feb 21, 2002 7:08 pm
by BackupUser
Restored from previous forum. Originally posted by blue-speed.
Why not just:

y.l=160
For s = 0 To 7
Locate(200, y)
DrawText(story(s))
y+16 ; or whatever your character height isNext s
hey thx ur code work great

http://www.purehilfe.de.vu


http://www.purehilfe.de.vu

Posted: Thu Feb 21, 2002 7:54 pm
by BackupUser
Restored from previous forum. Originally posted by blue-speed.

Code: Select all

;----------------------||
; PB-Graphic effect    ||
; Scroller             ||
; by bluespeed         ||
;----------------------||
        
;-----------------------
;  Init-Stuff   
;-----------------------
If InitSprite() = 0
   MessageRequester("Error","Can't find DX7 or higher",0)
   End  
EndIf   
If InitKeyboard() = 0
   MessageRequester("Error","Can't find DX7 or higher",0)
   End  
EndIf   
If OpenScreen(800,600,32,"Sinus-lines") = 0
   MessageRequester("Error","Can't open a Fulscreen",0)
   Else 
;-----------------------
; Structure-Stuff
;-----------------------        
Structure ppoints
   point_x.l
   point_y.l
EndStructure
;----------------------
; Allocation
;---------------------- 
Dim points.ppoints(999)
For p = 0 To 999
  points(p)\point_x = Random (800)
  points(p)\point_y = Random (600)
  Next  
p = 0  
Dim story.s(30)
story(0)  = " _-| A STORY OF A HERO |-_"
story(1)  = "Here is a small oldschool loking"
story(2)  = "graphic effect. Why ive programmed it"
story(3)  = "you ask? i'll tell: It begans in a "
story(4)  = "awful night where a boy wanted to "
story(5)  = "show the world, that PB isnt only "
story(6)  = "for games and that when PB 3.0 will"
story(7)  = "released blitzbasic will lose her  "
story(8)  = "rang, then there will exist a lang-"
story(9)  = "called Purebasic, which have the pure"
story(10) = "power to make GAMES and PROGRAMMS and"
story(11) = "every one will use it. It will get a "
story(12) = "name 'the New QuickBasic', i hope u "
story(13) = "dont misunderstand it when i say PB "
story(14) = "is Perfect and it will open a new Basic"
story(15) = "Area where the Basic syntax and the Pure"
story(16) = "speed will dominate. Who makes this cool " 
story(17) = "and easy language? His name is called    "
story(18) = "'Fred' and he is doing a big and good job"
story(19) = "so if u want to see this language look at"
story(20) = "[url]http://www.purebasic.com[/url] and if you are a german"
story(21) = "coder look at [url]http://www.purebasic.de[/url] . Hmm....."
story(22) = "sorry folks but thats the only way to write"
story(23) = "a long text for this scroller :wink:. Thats it "
story(24) = "If u want some germany tutorials look at: "
story(25) = "[url]http://www.purehilfe.de.vu[/url] at the moment there are"
story(26) = "17 Tutorials, when i ll get the pb fullversion"
story(27) = "then ill start to programm a game in PB ! "
story(28) = "Plz dont look at the errors in my text "
story(29) = "english isnt my favorite language :wink: "  
story(30) = "cya bluespeed"

  
;---------------------
; Font
;--------------------
LoadFont(0,"Courier",20)
;------------------------
; M A I N  L O O P
;------------------------  

Repeat  
  FlipBuffers() 
  ExamineKeyboard()       
  StartSpecialFX() 
  ClearScreen(0,0,0) 
     DisplayRGBFilter(-100,100,1000,400,255,255,255) 
  StopSpecialFX()
     StartDrawing(ScreenOutput())
     DrawingMode(1)
        For p = 0 To 999
          points(p)\point_x+ 10
          If points(p)\point_x > 800
             points(p)\point_x = 0
          EndIf 
          points(p)\point_y+ 10
          If points(p)\point_y > 600
             points(p)\point_y = 0
          EndIf
         Plot(points(p)\point_x,points(p)\point_y)
        Next  
      DrawingFont(UseFont(0)) 
      y = 600 
      y1 - 1 
   For s = 0 To 30
     Locate(50,y+y1)  
     DrawText(story(s))  
     y+40 
  Next   
    StopDrawing() 
Until KeyboardPushed(#PB_Key_Escape)
EndIf  
hi!

here is the code but i think its a little bit slow, should i delete the gone text? Or how does it run on ur pcs?

cya
bluespeed

http://www.purehilfe.de.vu

Posted: Thu Feb 21, 2002 8:27 pm
by BackupUser
Restored from previous forum. Originally posted by MrVainSCL.

Hi blue-speed
hehe... just tell us that you want to code a scroller :wink: Your new scroller example works ok but a litte bit slow on my system... Btw.. why are using the SpecialFx() commands...? As i saw your example, you can code it without the any specialfx() commands and this speed your code mutch up - because SpecialFX are software based and this will slow down your code...

PIII450, 256MB Ram, 6GB HD, RivaTNT, DirectX8.1, SB AWE64, Win98SE + Updates...

greetz
MrVainSCL! aka Thorsten

Posted: Thu Feb 21, 2002 8:56 pm
by BackupUser
Restored from previous forum. Originally posted by blue-speed.

hm.. u are right specialfx is a little bit slow, i think i can use a box() command to this white screen. But at first i wanted to use a rgbfilter thats why ive used the specialfx :).

cya
bluespeed

http://www.purehilfe.de.vu

Posted: Fri Feb 22, 2002 12:32 pm
by BackupUser
Restored from previous forum. Originally posted by MrVainSCL.
blue-speed wrote:
hm.. u are right specialfx is a little bit slow, i think i can use a box() command to this white screen. But at first i wanted to use a rgbfilter thats why ive used the specialfx :).
hehe... yes, thats the right way to use box() for example and you dont need longer the rgbfilter stuff and your program will speed up

PIII450, 256MB Ram, 6GB HD, RivaTNT, DirectX8.1, SB AWE64, Win98SE + Updates...

greetz
MrVainSCL! aka Thorsten

Edited by - MrVainSCL on 22 February 2002 12:33:39