Page 2 of 4
Posted: Sun Jun 15, 2008 10:52 pm
by Kale
Kaeru Gaman wrote:@Kale
regarding your Font... is it your work?
do you set it free, I mean, could everybody use it just for putting a thnx in the credits?
it's not my work, i think its by an artist called 'Made'.
Posted: Mon Jun 16, 2008 12:25 am
by Kaeru Gaman
Kale wrote:Kaeru Gaman wrote:@Kale
regarding your Font... is it your work?
do you set it free, I mean, could everybody use it just for putting a thnx in the credits?
it's not my work, i think its by an artist called 'Made'.
do you remember how it was licensed?
if not, don't bother, just was interested.
but I can make Spritefonts myself...
@fusion_400
you should not mix up drawing commands with other output.
within a start/stop-drawing block only shopuld be drawing commands,
other display commands like DisplaySprite and RenderMovieFrame should be outside a drawing block.
Posted: Tue Jun 17, 2008 5:17 pm
by fusion_400
Ok i have managed to get the movie going smoothly and even rotating smoothly without any flickering or tearing but the speed of the text scroller goes way down. Is there anything i can do to speed it up ? Btw if i use 2d sprite the scrolling is still way slow.
What i am trying to do here is somewhat similar to some oldschool demos where u could control the text position and other neat stuff. I also use gamma to change colours over the whole screen but it does not work very well if changed more then once. with the buttons 3 and 4.
Text positions changes with 5 and 6 buttons.
Also i noticed that the movie has to be an MPEG1 movie or else the sprite wont display but the music will play.
Code: Select all
a$ = "Amiga and "
a$ + "C64 rulez for scrolling =)"
InitKeyboard()
InitMovie()
InitSprite()
InitSprite3D()
UsePNGImageDecoder()
UseJPEGImageDecoder()
;OpenWindow(0, #PB_Ignore, #PB_Ignore, 1366, 768, "Scrolltext")
;OpenWindowedScreen(WindowID(0), 0,0,1366,768,0,0,0)
OpenScreen(1360, 768, 32, "Display System")
ChangeGamma(0,0,0,1)
LoadMovie(0, "Procol.mpg")
LoadFont(0,"Arial",109)
LoadFont(1,"Impact",30)
result = LoadImage(#PB_Any,"Untitled3.png")
result2 = LoadImage(#PB_Any,"nclogo.jpg")
result3 = LoadImage(#PB_Any,"Untitled2.png")
Surface = CreateSprite(0, 256, 256, #PB_Sprite_Texture)
Surface2 = CreateSprite3D(0 , 0)
TextX = 1366
TextY = 0
Bild1 = 0
Bild2 = 0
Bild3 = 0
Bild4 = 0
Gamma = 0
TextRed = 1
Gam1 = 0
Gam2 = 0
Gam3 = 0
Gam4 = 1
box1 = 0
box2 = 0
PlayMovie(0, #PB_Movie_Rendered)
Sprite3DQuality(1)
Repeat
TextRed = 1
ClearScreen($402010)
StartDrawing(ScreenOutput())
;StartDrawing(SpriteOutput(Surface))
DrawImage(ImageID(result),0,0)
DrawImage(ImageID(result),Bild1,Bild2)
DrawImage(ImageID(result2),10+Bild3,20+Bild4)
;DrawImage(ImageID(result3),0,120)
DrawingMode(#PB_2DDrawing_Transparent)
DrawingFont(FontID(0))
ChangeGamma(Gam1,Gam2,Gam3,Gam4)
DrawText(TextX, 540+TextY, a$, RGB( 255, 255, 255 ) )
DrawingFont(FontID(1))
DrawText(10, 720,"Display System Version 0.1", RGB( 0, 0, 0 ) )
Box(1366,705,0+Box1,10,RGB((255),(255),(255)))
;Box(0,705,0+Box2,10,RGB((0),(0),(0)))
Box(0,540,0+Box2,10,RGB((0),(0),(0)))
StopDrawing()
TextX -2
Box1 -4
Box2 +4
If TextX < -2500
TextX = 1366
EndIf
ExamineKeyboard()
If KeyboardPushed(#PB_Key_D)
Bild1 +2
EndIf
If KeyboardPushed(#PB_Key_A)
Bild1 -2
EndIf
If KeyboardPushed(#PB_Key_W)
Bild2 -2
EndIf
If KeyboardPushed(#PB_Key_S)
Bild2 +2
EndIf
If KeyboardPushed(#PB_Key_Right)
Bild3 +2
EndIf
If KeyboardPushed(#PB_Key_Up)
Bild4 -2
EndIf
If KeyboardPushed(#PB_Key_Left)
Bild3 -2
EndIf
If KeyboardPushed(#PB_Key_Down)
Bild4 +2
EndIf
If KeyboardPushed(#PB_Key_1)
Gamma +2
ChangeGamma(Gamma,Gamma,Gamma,0)
EndIf
If KeyboardPushed(#PB_Key_2)
Gamma -2
ChangeGamma(Gamma,Gamma,Gamma,0)
EndIf
If KeyboardPushed(#PB_Key_3)
Gam1 = 0
Gam2 = 255
Gam3 = 0
Gam4 = 0
EndIf
If KeyboardPushed(#PB_Key_4)
Gam1 = 0
Gam2 = 0
Gam3 = 255
Gam4 = 0
EndIf
If KeyboardPushed(#PB_Key_5)
TextY -2
EndIf
If KeyboardPushed(#PB_Key_6)
TextY +2
EndIf
;DisplaySprite(0, 0, 0)
Start3D()
RenderMovieFrame(0,Surface)
DisplaySprite3D(0, 100, 100, 255)
RotateSprite3D(0, x, 0)
x+1
; ...
Stop3D()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)
Re: Smooth scrolling text like C64/Amiga how to do it in ba
Posted: Tue Jun 17, 2008 10:12 pm
by PB
> the old Amiga and C64 demos where the textscroller was incredibly smooth
Don't forget that those demos were written in Assembly, and not Basic.
Posted: Tue Jun 17, 2008 10:14 pm
by blueznl
I guess the prime reason was that they were tied into vertical sync, not that they were programmed in assembly.
Posted: Tue Jun 17, 2008 10:17 pm
by PB
That too.

My point was that you don't see demos like that done in Basic.
Posted: Tue Jun 17, 2008 10:28 pm
by fusion_400
Do u people know if it is possible to get a simple mpeg1 320x240 movie and some scrolling text to run in fullspeed in purebasic. I have eliminated the flickering issue and the movie and the rotation is in full speed but the text is slowed down dramatically.
I supplied the code in a previous posting.
Posted: Tue Jun 17, 2008 11:55 pm
by Amiga5k
Depends on a lot of factors:
MPEG1/2/3/4 and other lossy modes are quite processor intensive (or video processor intensive in some cases), so it depends on the nature of the end user's hardware etc.
Remember that in the case of the c64 (and others, let's not forget!) they had absolute control of the video hardware, something that is almost impossible in a modern multitasking OS.
That being said, there are cases where it can be done (look at MAME running on a decent computer or even a C64 being emulated with CCS64, etc). Luckily, PB allows you to inject pure asm into your code if you have the knowledge to do so
Russell
Posted: Wed Jun 18, 2008 9:01 am
by djes
Have you ever looked what is available on this forum and on the purebasic, purearea, codearchiv... sites?
In lethal judgment for example, there's sometime more than three fullscreen parallal scrolls. What is a simple scrolltext in comparison?
In Purebasic, you have to find the right functions to do the job. Try between drawimage/drawsprite. Drawtext is slow! I've never used such a function for realtime fx!
Posted: Wed Jun 18, 2008 9:26 am
by Foz
It very simple:
Use DrawText onto an image, and then scroll that image.
Rendering the text once is a lot less processor intensive than doing it every frame.
Posted: Wed Jun 18, 2008 12:01 pm
by fusion_400
Foz wrote:It very simple:
Use DrawText onto an image, and then scroll that image.
Rendering the text once is a lot less processor intensive than doing it every frame.
Ok how do i convert DrawText to an image ? I am very new at this i am not a seasoned pro at programming. So i really appreciate any help i can get.
Re: Smooth scrolling text like C64/Amiga how to do it in ba
Posted: Wed Jun 18, 2008 12:03 pm
by PB
@fusion_400: See this thread for a smooth horizontal scroll:
http://www.purebasic.fr/english/viewtopic.php?t=19767
The demo is 404 from there though, but perhaps va!n can re-upload it for
you, if you PM him. I still have it but am not sure if I can redistribute it.
I don't really see why not though, so if he doesn't respond then I'll put it
somewhere for you.
Posted: Wed Jun 18, 2008 12:12 pm
by Foz
fusion_400 wrote:Foz wrote:It very simple:
Use DrawText onto an image, and then scroll that image.
Rendering the text once is a lot less processor intensive than doing it every frame.
Ok how do i convert DrawText to an image ? I am very new at this i am not a seasoned pro at programming. So i really appreciate any help i can get.
Code: Select all
StartDrawing(ImageOutput(ImageToDrawOn))
DrawText(0, 0, stringtodraw$, RGB( 255, 255, 255 ) )
StopDrawing()
Posted: Wed Jun 18, 2008 2:06 pm
by fusion_400
I tried to get this to work with using imageoutput but i get a black screen only. When i used it in the other code the only thing that displayed was the sprite.
Code: Select all
InitSprite()
InitKeyboard()
ImageToDrawOn = CreateImage(#PB_Any, 1360, 768, 32)
OpenScreen(1360, 768, 32, "Display System")
LoadFont(0,"Arial",109)
Repeat
StartDrawing(ImageOutput(ImageToDrawOn))
LineXY(10, 10, 490, 90 ,RGB(Random(255),Random(255),Random(255)))
DrawText(10, 720,"Display System Version 0.1", RGB( 0, 0, 0 ) )
;DrawImage(ImageToDrawOn,20,200)
StopDrawing()
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
Posted: Wed Jun 18, 2008 2:20 pm
by Derek
You'll need a flipbuffers() in there somewhere and also need to display the image as well.