Author Topic: Nfo Scroller  (Read 2784 times)

0 Members and 1 Guest are viewing this topic.

Offline dev0

  • ZX 81
  • *
  • Posts: 16
  • Karma: 3
  • Legends never die...
    • View Profile
Nfo Scroller
« on: May 15, 2013 »
Well,
seems today is my question day  ;D
I'm trying to figure out how I could scroll the contents of an nfo file in PureBasic like this:

On the Bottom of the Window it fades in until its completely visible somewhere in the middle on top of he screen it fades out unil its invisible.... The scrolltext is not pure white a light grey gradient is on top though...

The scroller scrolls automatically until you use your cursor keys then you can scroll the text yourself (up or downwards) if you stop hitting those keys the scroller scrolls again after some delay...

Well and how let the nfo file stay intact while displaying it (you know kind of special font involved)
Basically something which you can find in the typical C.O.R.E. Intro (C.O.R.E. Intro Engine)

Not sure am I right here but my idea is the following:

I would need 2 sprites here? One containing the font the other the gradient bachground and in some why I must merge both together (blend them)? For the fade in / out stuff I'm not sure maybe I can use a Png for this stuff above the scroller?
PureBasic 5.11
Delphi XE3

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1150
  • Karma: 174
    • View Profile
    • Raizor's Dev Blog
Re: Nfo Scroller
« Reply #1 on: May 15, 2013 »
Do you mean having the text fading towards being totally transparent at the top and bottom of the view area? If so, I'd be inclined to use an overlayed PNG image that is totally opaque at the top and bottom, the middle would be totally transparent and the transparency value would reduce as your neared the top/bottom. You could then just draw the PNG over the top of the view area. Not sure if this would work for you, but it's what I'd try first.
raizor

Challenge Trophies Won:

Offline dev0

  • ZX 81
  • *
  • Posts: 16
  • Karma: 3
  • Legends never die...
    • View Profile
Re: Nfo Scroller
« Reply #2 on: May 15, 2013 »
Do you mean having the text fading towards being totally transparent at the top and bottom of the view area? If so, I'd be inclined to use an overlayed PNG image that is totally opaque at the top and bottom, the middle would be totally transparent and the transparency value would reduce as your neared the top/bottom. You could then just draw the PNG over the top of the view area. Not sure if this would work for you, but it's what I'd try first.

Correct! So I guess I was right here for the first problem if you suggest it too.
Just wonder how to handle the other stuff this seems kinda complicated for a beginner  :o
PureBasic 5.11
Delphi XE3

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1150
  • Karma: 174
    • View Profile
    • Raizor's Dev Blog
Re: Nfo Scroller
« Reply #3 on: May 15, 2013 »
Yes, probably not the easiest of first projects, but do-able with a little time I'm sure. And will be pretty cool when it's working :)

I'd attack it in stages:

1. Have a background image to represent your text (can be anything, just mock up a image with some text in photoshop or whatever).
2. Get the transparent gradient overlay stuff working, so it sits over the dummy background image.
3. Make the background image taller than the view area, so you can work on the scrolling.
4. Add the text rendering stuff to replace the dummy background image.

It's been a while since I've been anywhere near Purebasic/Freebasic, but I'd be inclined to use a TTF font rather than a bitmap font. That way you can let the user choose a different font more easily. I'd probably also stick with using a background image for the text and just render the text directly onto the background image. As the text doesn't need to change once it's rendered, this would probably be easier (IMHO). It would also give you the advantage of being able to use the code you write for steps 1 and 3.
raizor

Challenge Trophies Won:

Offline dev0

  • ZX 81
  • *
  • Posts: 16
  • Karma: 3
  • Legends never die...
    • View Profile
Re: Nfo Scroller
« Reply #4 on: May 15, 2013 »
I'll see thank you for all the suggestions...
Got another idea here maybe its possible to fade out / in the text not using additional png's (size matters  ;D)
While reading the manual it might be possible while using DisplaySprite3D to modify the transparency param from within in a loop? Need to try it out  :P
PureBasic 5.11
Delphi XE3

Offline dev0

  • ZX 81
  • *
  • Posts: 16
  • Karma: 3
  • Legends never die...
    • View Profile
Re: Nfo Scroller
« Reply #5 on: May 15, 2013 »
Yup it seems to work in some way but there are a lot of problems to solve...

First of all I've no idea how to display the nfo correctly, it looks horrible strange.
My idea was just setting terminal as font for the scroller like you can do in notepad to display it nice but sure enough that does not work at least it seems thats not enough. When I load the nfo it just shows crap...

My bad it works partly!
The problem is this I think:


Code: [Select]
If CreateSprite(1, 640, 1020)
  If StartDrawing(SpriteOutput(1))
    DrawingMode(1)
      DrawingFont(Font)  ;terminal
      FrontColor(RGB(255,255,255))
      DrawText(0, 12, "   ۲  ۲ ۲ ۲۲ ")           
    StopDrawing()
  EndIf
EndIf

From the above code first problem is the dimension (height) of the Sprite I think because that depends of the length of text in the nfo file So I must set it dynamically?

Second problem should be drawtext? The nfo looks just crappy if I add more lines to it so i guess drawtext has problem with line breaks?

No clue in the moment how to load the nfo and iterate over it and then make the drawtext stuff work  ???



Any ideas?

Whooho  ;D
It seems I''m getting clother now...

Parts left:
1. Procedure to read the nfo instead of hardcoding with multiline support for Drawtext.
2. Automatic scrolling must be stopped when hitting cursor key so that indicates the user scrolls up / down himself.
3. Scroller direction from top to down when the last line of text is reached.
4. Sprite height must be dynamically calculated I guess...
5 Design adjustments
« Last Edit: May 15, 2013 by dev0 »
PureBasic 5.11
Delphi XE3

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1150
  • Karma: 174
    • View Profile
    • Raizor's Dev Blog
Re: Nfo Scroller
« Reply #6 on: May 15, 2013 »
Wow, that's looking pretty damn good already Dev0 :)
raizor

Challenge Trophies Won:

Offline dev0

  • ZX 81
  • *
  • Posts: 16
  • Karma: 3
  • Legends never die...
    • View Profile
Re: Nfo Scroller
« Reply #7 on: May 16, 2013 »
Thank you Raizor!
Well I think I was wrong that it would be too hard for a beginner I guess its a really good small project to learn from.
It has all the stuff needed while learning  like string / file, event, sprite handling... Lets see if I can make it better  :D
PureBasic 5.11
Delphi XE3

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1150
  • Karma: 174
    • View Profile
    • Raizor's Dev Blog
Re: Nfo Scroller
« Reply #8 on: May 16, 2013 »
Well I think I was wrong that it would be too hard for a beginner I guess its a really good small project to learn from.
It has all the stuff needed while learning  like string / file, event, sprite handling... Lets see if I can make it better  :D

:D
raizor

Challenge Trophies Won:

Offline dev0

  • ZX 81
  • *
  • Posts: 16
  • Karma: 3
  • Legends never die...
    • View Profile
Re: Nfo Scroller
« Reply #9 on: May 16, 2013 »
Just a small update  ;)
Nfo contents now loads from file instead of hardcoding it into the executeable.

The scrolltext can now be scrolled via cursor up/down or page up/down only difference is that the for page keys I use a higher value for scroller as I used for the cursor keys.

The attachment contains an nfo folder. Anytime the exe is started it picks a random nfo file. I made this only for demo purposes to see some variations and for testing. Nfo's are downloaded from http://www.defacto2.net/file/list/-/thumb/-/releaseinformation/date/30/1

Missing yet:

1.Need kind of a check if the cursor keys are used the scroller stops thats fine so far but if you stop hitting your cursor keys the text should scroll automatically again until you hit your cursor keys again.  :D

2. Scrolldirection change if the scroller is near eof.

Perhaps I'll integrate and crc32 check later as C.O.R.E. did for their nfo's we'll see.
PureBasic 5.11
Delphi XE3

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: Nfo Scroller
« Reply #10 on: May 16, 2013 »
That Excellent  :clap:

That nice to see Newcomer showing what Demo they have Made  :clap: :goodpost:

Offline dev0

  • ZX 81
  • *
  • Posts: 16
  • Karma: 3
  • Legends never die...
    • View Profile
Re: Nfo Scroller
« Reply #11 on: May 17, 2013 »
That Excellent  :clap:

That nice to see Newcomer showing what Demo they have Made  :clap: :goodpost:

Thank you Hotshot!
Well nothing special at all compared to the stuff I've found here but at least my starting point  ;)
« Last Edit: May 17, 2013 by dev0 »
PureBasic 5.11
Delphi XE3

Offline Dr.Death

  • Senior Member
  • Amiga 1200
  • ********
  • Posts: 433
  • Karma: 8
    • View Profile
Re: Nfo Scroller
« Reply #12 on: May 18, 2013 »
Great job mate & it works on my silly laptop too... ;)
Proud member of DAWN

Offline dev0

  • ZX 81
  • *
  • Posts: 16
  • Karma: 3
  • Legends never die...
    • View Profile
Re: Nfo Scroller
« Reply #13 on: May 19, 2013 »
Thank you Dr.Death!
Sounds familiar I've coded this on a quite lame laptop so my hope was it should work almost on any machine  ;D
PureBasic 5.11
Delphi XE3

Offline C3lt1c

  • C= 64
  • **
  • Posts: 77
  • Karma: 26
    • View Profile
Re: Nfo Scroller
« Reply #14 on: May 19, 2013 »
Awesome Stuff Bro!!!
I like the particle effects in the background and also the chiptune.
Good  Work!

Cheers C3lt1c  :cheers:
OLD SCHOOL ROCKZZZ

Offline dev0

  • ZX 81
  • *
  • Posts: 16
  • Karma: 3
  • Legends never die...
    • View Profile
Re: Nfo Scroller
« Reply #15 on: May 20, 2013 »
Danke  ;D Thank you C3lt1c!
Chiptune is called: "Simpukka chilli" from Mystic Cloud / Chemical Reaction can be downloaded here: http://orgasmod.com/index.php?request=view_by_moduleid&query=146185
PureBasic 5.11
Delphi XE3

Offline emook

  • C= 64
  • **
  • Posts: 88
  • Karma: 12
    • View Profile
Re: Nfo Scroller
« Reply #16 on: June 13, 2013 »
Any chance you would be so kind and share your sources?

Great work by the way, totally authentic!

 ;)
----

R Tape loading error, 0:1