News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

PopUpTextReader

Started by XpMe_v1.2, August 31, 2009, 01:03:26 AM

Previous topic - Next topic

XpMe_v1.2

Heres a nice text reader for you to use in your programs.

version 1.64j

Displays Text in a popup menu when right mouse button is pressed
Can be moved around the screen with the right mouse pressed down
40 letters of text wide by 10 lines down. Left-Right scrollbars-buttons / Up-Dn scrollbars-buttons
Keyboard presses `Left Key` Right Key`Up Key`Down Key` HOME Key`END Key`Page UP Key`Page DN Key

All the code works together.
When you press the RIGHT Mouse button to show the popup then
all of the code will run Until you Exit. then it returns you to your Main Loop

Cal load text from a text file or your text located inside your program.

PlayBASIC Code: [Select]
; PROJECT : PopUpTextReader
; ---------------------------------------------------------------------
Type Doc_info
MAXlines
percent#
current_line
MAXwide
current_poz
EndType
Type UDLR_Doc_info
UD As Doc_info
LR As Doc_info
fnt
File$
LettersWide
LettersHigh
EndType
Dim Doc As UDLR_Doc_info
Dim DocText$(1)
Ink RGB(4,4,10)
Doc.fnt = LoadNewFont("COURIER" ,12 ,0)
PrepareFxFont Doc.fnt
Doc.File$ = CurrentDir$() + "PlaceYourTextFileNameHere.Txt"
Doc.LettersWide = 40
Doc.LettersHigh = 10
`===========`===========
Type But_info
img(2)
x,y,w,h, layer
EndType
Type But_UDLR_info
sWide
sHigh
Location
LocationX
LocationY
pozX#
pozY#
fnt
BKGimg
Bak As But_info
Xit As But_info
UDc As But_info
UD1 As But_info
UD2 As But_info
LRc As But_info
LR1 As But_info
LR2 As But_info
EndType
Dim But As But_UDLR_info
But.sWide = GetScreenWidth()
But.sHigh = GetScreenHeight()
But.pozX# = 1
But.pozY# = 1
`===========`===========`===========`===========`===========
`===========`===========`===========`===========`===========
Create_Exit_Box()
Create_UPDN_round_button()
Create_UD1but_button()
Create_UD2but_button()
Create_LEFTRIGHT_round_button()
Create_LR1but_button()
Create_LR2but_button()
Create_Main_Box()
`===========`===========`===========`===========`===========
`===========`===========`===========`===========`===========
`===========`===========`===========`===========`===========
`===========`===========`===========`===========`===========
Function Update_Buttons_XY()
But.Xit.x = But.Bak.x + But.Bak.w - 30 : But.Xit.y = But.Bak.y + 8
But.UD1.x = But.Bak.x + But.Bak.w - 31 : But.UD1.y = But.Bak.y + But.Bak.h - 54
But.UD2.x = But.Bak.x + But.Bak.w - 31 : But.UD2.y = But.Bak.y + But.Bak.h - 31
But.UDc.x = But.Bak.x + But.Bak.w - 26 : But.UDc.y = But.Bak.y + 45
But.LR1.x = But.Bak.x + 8 : But.LR1.y = But.Bak.y + But.Bak.h - 31
But.LR2.x = But.Bak.x + 31 : But.LR2.y = But.Bak.y + But.Bak.h - 31
But.LRc.x = But.Bak.x + 62 : But.LRc.y = But.Bak.y + But.Bak.h - 26
EndFunction
`===========`===========`===========`===========`===========
`===========`===========`===========`===========`===========
`===========`===========`===========`===========`===========
`===========`===========`===========`===========`===========
Function Create_Main_Box()
But.Bak.x = 266
But.Bak.y = 235
But.Bak.w = 378
But.Bak.h = 224
But.BKGimg = NewImage(But.Bak.w ,But.Bak.h)
RenderToImage But.BKGimg
cDark = RGB( 4, 4, 4)
cDim = RGB( 33, 33, 33)
cEdge = RGB(188,188,188)
cFill = RGB(110,130,160)
cRed = RGB(111, 1, 1)
cWhite = RGB(255,255,255)
cLblue = RGB(175,175,225)
cGreen = RGB(79, 108, 38)
cLgreen = RGB(177,204, 72)
LockBuffer : Cls cDark
BoxC 1, 1, But.Bak.w - 1 ,But.Bak.h - 1 ,true , cEdge
BoxC 3, 3, But.Bak.w - 3 ,But.Bak.h - 3 ,true , cFill
BoxC 4, 4, But.Bak.w - 4 ,But.Bak.h - 4 ,false , cDark
ShadeBox 5, 5, But.Bak.w - 5 ,But.Bak.h - 5 , cGreen, cGreen, cLgreen, cLgreen
BoxC 10,11, But.Bak.w - 35 ,But.Bak.h - 35 ,true , cDim
ShadeBox 9, 9, But.Bak.w - 38 ,But.Bak.h - 38 , cWhite, cWhite, cLblue, cLblue
`---
r = But.Bak.w - 31
w = 24
d = 41
h = 121
BoxC r , d , r + w , d + h ,true, cDark
BoxC r + 1 , d + 1 , r + w - 1 , d + h - 1 ,true, cEdge
ShadeBox r + 3 , d + 3 , r + w - 3 , d + h - 3 , cDim,cDim, cFill,cFill
BoxC r + 8 , d + 5 , r + w - 7 , d + h - 5 ,true, cRed
BoxC r + 11 , d + 10 , r + w - 10 , d + 110 ,true, cDark
`---
r = 59
w = 121
d = But.Bak.h - 31
h = 24
BoxC r ,d , r + w , d + h ,true, cDark
BoxC r + 1 ,d + 1 , r + w - 1 , d + h - 1 ,true, cEdge
ShadeBox r + 3 ,d + 3 , r + w - 3 , d + h - 3 , cDim,cFill ,cFill,cDim
BoxC r + 5 ,d + 8 , r + w - 5 , d + h - 8 ,true, cRed
BoxC r + 10 ,d + 11 , r + 110 , d + h - 11 ,true, cDark
`---
r = 184
w = 157
d = But.Bak.h - 28
h = 18
BoxC r ,d , r + w , d + h ,true, cDark
ShadeBox r + 1 ,d + 1 , r + w - 1 , d + h - 1 , cLblue, cLblue, cWhite, cWhite
`---
DrawImage But.Xit.img(0) , But.Bak.w - 30 , 8 ,false
DrawImage But.UD1.img(0) , But.Bak.w - 31 , But.Bak.h - 54 ,false
DrawImage But.UD2.img(0) , But.Bak.w - 31 , But.Bak.h - 31 ,false
DrawImage But.LR1.img(0) , 8 , But.Bak.h - 31 ,false
DrawImage But.LR2.img(0) , 31 , But.Bak.h - 31 ,false
UnLockBuffer : RenderToScreen
EndFunction
`===========`===========`===========`===========`===========
`===========`===========`===========`===========`===========
Function Get_Colors(i,n)
Select i
Case 1
Select n : Case 0 : r = 200 : g = 200 : b = 225
Case 1 : r = 235 : g = 225 : b = 145
Case 2 : r = 50 : g = 245 : b = 50
EndSelect
Case 2
Login required to view complete source code


...XpMe v1.2

http://tilemusic.com/

LemonWizard

how much time did you spend making this  :o

XpMe_v1.2

With the spare time I put working on it over 2 1/2 weeks I'd say about 12 hours to get it to where I liked what I had and what you now see. I knew what I wanted and reworked it till I was satisfied. And I also wanted others to be able to use it with in their programs also. If you can use it or want to change it to some other look or whatever then go ahead. Thats why it is here posted on this Play Basic web site for.
...XpMe v1.2

http://tilemusic.com/