Die Idee ist eine Text zu schreiben mit "pink" als Hintergrund , diesen als Sprite abzuspeichern um ihn dann beliebig zu positionieren zu drehen etc.
Soweit geht das, aber der rosa Rand um das Sprite bleibt, auch bei zB. türkis Hintergrund. Rosa sollte ausgeblendet werden , oder ?
Die Schrift wurde mit DingsFont erstellt bei (255 0 128 ) als RGB :
(http://www.dmemos.de/glbasic/textsprite.png)
(http://www.dmemos.de/glbasic/FontCourier8x13WhiteOnPink.png)
// --------------------------------- //
// Project: TextSprite
// Start: Friday, December 25, 2009
// IDE Version: 7.203
// SETCURRENTDIR("Media") // seperate media and binaries?
GLOBAL fOk%, fRead%, fWrite%, fAppend%
GLOBAL lines$[], line$, words$[]
GLOBAL FontSizeX%, FontSizeY%
GLOBAL ScrWidthX%, ScrHeightY%
GLOBAL ScrLineLength%, ScrLines%
GLOBAL StartTime#, time#
DIM lines$[0]
// main programm
Initialize() // define vars and default-settings
ScrCheck() // check Screen for possible line-length and lines
line$ = "Hello TextSprite World!"
linelength% = LEN(line$) * FontSizeX
lineheight% = FontSizeY
PRINT line$,0,0
PRINT linelength,0,13
PRINT lineheight,0,26
GRABSPRITE 0, 0, 0,linelength, lineheight
SAVESPRITE "hello.bmp",0
SHOWSCREEN
MOUSEWAIT
DRAWRECT 0, 0, 200,200, RGB(0, 255, 255)
PRINT "text as sprite",0,0
LOADSPRITE "hello.bmp", 0
DRAWSPRITE 0, 100, 100
ROTOSPRITE 0, 10, 200, 30
ROTOSPRITE 0, 10, 200, 60
ROTOSPRITE 0, 10, 200, 90
SHOWSCREEN
MOUSEWAIT
FUNCTION Initialize:
fOk=FALSE
fRead=1
fWrite=0
fAppend=-1
LOADFONT "FontCourier8x13WhiteOnPink.png", 1
SETFONT 1
ENDFUNCTION // INITIALIZE
FUNCTION ScrCheck:
// get all Screen values and calculate lines and line-length
GETFONTSIZE FontSizeX, FontSizeY
GETSCREENSIZE ScrWidthX, ScrHeightY
ScrLineLength = ScrWidthX / FontSizeX
ScrLines = ScrHeightY / FontSizeY
y%=0
PRINT "Screen check : " , 0, y
y = y + FontSizeY
PRINT "- x-width : "+ ScrWidthX, 0, y
y = y + FontSizeY
PRINT "- y-height : "+ ScrHeightY, 0,y
y = y + FontSizeY
PRINT "- font-size-x : " + FontSizeX, 0, y
y = y + FontSizeY
PRINT "- font-size-y : " + FontSizeY, 0, y
y = y + FontSizeY
PRINT "- chars in line : " + ScrLineLength, 0, y
y = y + FontSizeY
PRINT "- lines:" + ScrLines, 0, y
SHOWSCREEN
MOUSEWAIT
ENDFUNCTION // ScrCheck
PS:
Sollte man lieber auf englisch posten ?
wozu? Im deutschen Forum kannst ruhig auf Deutsch posten :)
Wenn du den Befehl SETTRANSPARENCY verwendest, wird dein Text auch "richtig" angezeigt. Sieh dir mal die Hilfe zu diesem Befehl an.
SETTRANSPARENCY RGB(255, 0, 128)
LOADFONT "FontCourier8x13WhiteOnPink.png", 1
GETFONTSIZE fx%, fy%
text$ = "Text als Sprite"
PRINT text$, 0, 0
sizex% = LEN(text$) * fx
sizey% = fy
GRABSPRITE 0, 0, 0, sizex, sizey
angle = 0
WHILE TRUE
ROTOSPRITE 0, 150, 150, angle
INC angle
SHOWSCREEN
WEND
Super vielen Dank - ich dachte das wäre schon voreingestellt. Jetzt gehts wie gewünscht :)