bei mir eben nicht, sonst würde ich nicht fragen.
Danke für die forsche Kritik. Habe ich des öftern schon gelesen. Man kann auch freundlich darüber reden.. Zumindest kommt es sehr forsch rüber, auch wenn Du es möglicher Weise nicht so meinst. Lediglich bat ich um Hilfe einen Tipp, nicht um ein Programm, dass Du mir schreiben sollst.
Bedenke; dass es Anfänger gibt die genau aus diesem Grund hier Fragen stellen.
Wie ich schon schrieb, bin ich Anfänger und bin über jede Code zeile froh die beim anschließenden Kompilieren auch macht was sie soll.
Code: Alles auswählen
UsePNGImageDecoder()
InitSprite()
UsePNGImageDecoder()
UseJPEGImageDecoder()
#AC_SRC_OVER = $0 ; Alpha Settings
#AC_SRC_ALPHA = $1 ; Alpha Settings
#ULW_ALPHA = $2 ; Alpha Settings
Global TBColor = CreateSolidBrush_(RGB(100, 200, 255)) ; Alpha Settings
Enumeration
#Text_0
#Text_1
#Text_2
#Text_3
#Text_4
#Text_5
#Font_Text_0
#Font_Text_1
#Font_Text_2
#Font_Text_3
#Font_Text_4
#Font_Text_5
#exit_Button
#ScrollArea_0
#Font_ScrollArea_0
#Hyperlink_0
EndEnumeration
Define.l Event, EventWindow, EventGadget, EventMenu, a, textcolor, BackColor, timer1
Define EventID
Define Second
;-Text für Scroller
;#################################################################################################################
t.s=" Ich bin ein scrolltext zum texten von scrollern... "
sco = 0
tptr = 1
;#################################################################################################################
Macro WindowAlphaInit(WindowNr)
SetWindowLongPtr_(WindowID(WindowNr), #GWL_EXSTYLE, GetWindowLongPtr_(WindowID(WindowNr), #GWL_EXSTYLE) | #WS_EX_LAYERED)
EndMacro
Macro WindowAlphaColor(WindowNr, Color)
SetLayeredWindowAttributes_(WindowID(WindowNr), Color, 0, #LWA_COLORKEY)
EndMacro
Procedure WindowAlphaImage(WindowNr, ImageNr, Alpha=$FF)
Protected ImageID, X, Y, Width, Height
Protected hDC, bmi.BITMAPINFO, pt.POINT, Blend.BLENDFUNCTION
Protected Color, R, G, B, A
Protected Result = #False
If IsImage(ImageNr) = 0 Or ImageDepth(ImageNr) <> 32 : ProcedureReturn Result : EndIf
ImageID = ImageID(ImageNr)
Width = ImageWidth(ImageNr)
Height = ImageHeight(ImageNr)
; Precalculate scale:
Protected Dim Scale.f($FF)
For X = 0 To $FF
Scale(X) = X / $FF
Next
; Prepare array size:
Protected Dim Image.l(Width - 1, Height - 1)
hDC = StartDrawing(ImageOutput(ImageNr))
If hDC
With bmi\bmiHeader
\biSize = SizeOf(BITMAPINFOHEADER)
\biWidth = Width
\biHeight = Height
\biPlanes = 1
\biBitCount = 32
\biCompression = #BI_RGB
EndWith
GetDIBits_(hDC, ImageID, 0, Height, @Image(), @bmi, #DIB_RGB_COLORS) ; Copy image to memory
; Modify memory:
For Y = 0 To Height - 1
For X = 0 To Width - 1
Color = Image(X, Y)
A = Alpha(Color)
If A < $FF
R = Red(Color) * Scale(A)
G = Green(Color) * Scale(A)
B = Blue(Color) * Scale(A)
Image(X, Y) = RGBA(R, G, B, A)
EndIf
Next
Next
SetDIBits_(hDC, ImageID, 0, Height, @Image(), @bmi, #DIB_RGB_COLORS) ; Copy memory back to image
; Set image to window background:
With Blend
\BlendOp = #AC_SRC_OVER
\BlendFlags = 0
\SourceConstantAlpha = Alpha
\AlphaFormat = #AC_SRC_ALPHA
EndWith
Result = UpdateLayeredWindow_(WindowID(WindowNr), #Null, #Null, @bmi + SizeOf(Long), hDC, @pt, 0, @Blend, #ULW_ALPHA)
StopDrawing()
EndIf
ProcedureReturn Result
EndProcedure
Procedure MainCallback(hWnd, uMsg, wParam, lParam)
Protected Result = #PB_ProcessPureBasicEvents
Select uMsg
Case #WM_SIZE, #WM_MOVE, #WM_PAINT
ResizeWindow(0, WindowX(1), WindowY(1), #PB_Ignore, #PB_Ignore) ; Sync both windows
EndSelect
ProcedureReturn Result
EndProcedure
;-Define Pix and Sound
;{
DataSection
;background Alpha Image
Pic_1_Start:
IncludeBinary "interface_test.png"
Pic_1_End:
;background Music
;; Song:IncludeBinary "zi5.v2m" ; mp3d lib wird hier benötigt
;exit Button normal And Hover
exit_button_start_1:
IncludeBinary "exit_.png"
exit_button_1_End:
exitHover_button_1:
IncludeBinary "exit_button_hover.png"
exitHover_button_1_End:
;png font
font:
IncludeBinary "pix16.png" ; 16x16 pix font
fontnd:
EndDataSection
;}
Define.l Event, EventWindow, EventGadget, EventMenu
Define pic_1 = CatchImage(#PB_Any, ?Pic_1_Start, ?Pic_1_End - ?Pic_1_Start) ; grab Alpha Image from Mem
If OpenWindow(0, 0, 0, ImageWidth(pic_1), ImageHeight(pic_1), "Alpha Window", #PB_Window_BorderLess | #PB_Window_Invisible | #PB_Window_ScreenCentered | #PB_Screen_SmartSynchronization ) ; Just has the image
; SetWindowPos_(WindowID(0),#HWND_TOPMOST,0,0,0,0,#SWP_NOMOVE|#SWP_NOSIZE) ; Program always on Top
WindowAlphaInit(0)
If OpenWindow(1, 0, 0, ImageWidth(pic_1), ImageHeight(pic_1), "Keygen", #PB_Window_BorderLess | #PB_Window_Invisible | #PB_Window_ScreenCentered, WindowID(0)) ; Just has all gadgets etc.
SetWindowColor(1, $0000000)
WindowAlphaInit(1)
WindowAlphaColor(1, $000000)
WindowAlphaImage(0, pic_1)
;-Scroll Font Anzeigen in einem Fenster
OpenWindowedScreen(WindowID(1), 138, 418, 160, 20, 0, 0, 0)
CatchSprite(1,?font)
;- APP Info
TextGadget(#Text_0,110,73,390,15,"Der Name der Hose", #PB_Text_Center ) ;show APP Name
SetGadgetFont(#Text_0, LoadFont(#Font_Text_0, "Arial", 10, #PB_Font_Bold|#PB_Font_HighQuality))
;- HOMEPAGE
HyperLinkGadget(10, 250, 125, 110,17,"www.google.de", $02C5B0, #PB_HyperLink_Underline |#PB_Text_Center) ; Color and Tex by the shown Link
SetGadgetFont(10, LoadFont(0, "Arial", 10, #PB_Font_Bold|#PB_Font_HighQuality))
;- AUTHOR
TextGadget(#Text_1,110,180,390,15,"Hans Hase", #PB_Text_Center) ;display Author
SetGadgetFont(#Text_1, LoadFont(#Font_Text_1, "Arial", 10, #PB_Font_Bold|#PB_Font_HighQuality))
;- DATE
TextGadget(#Text_2,110,235,390,15,"09 October 2014", #PB_Text_Center ) ;show Date
SetGadgetFont(#Text_2, LoadFont(#Font_Text_2, "Arial", 10, #PB_Font_Bold|#PB_Font_HighQuality))
;- EXIT BUTTON
Define exitButton_1 = CatchImage(#PB_Any,?exit_button_start_1, ?exit_button_1_End - ?exit_button_start_1)
Define exitHover_1 = CatchImage(#PB_Any, ?exitHover_button_1, ?exitHover_button_1_End - ?exitHover_button_1)
br = ImageWidth(exitButton_1)
hh = ImageHeight(exitButton_1)
CanvasGadget(#exit_button, 33, 437, br, hh)
SetGadgetAttribute(#exit_button, #PB_Canvas_Image, ImageID(exitButton_1))
;- NOTES
ScrollAreaGadget(#ScrollArea_0, 55, 290, 390, 100, 362, 110, 10, #PB_ScrollArea_BorderLess|#WS_HSCROLL)
TextGadget(#Text_3,10,25,350,60,"Ich bin Text der in einem Bla angezeigt werden soll und die Leute happy machen.", #PB_Text_Center) ;display Release Name ... Chr(13)macht einen zeilen umbruch
SetGadgetFont(#Text_3, LoadFont(#Font_Text_3, "Arial", 10, #PB_Font_Bold|#PB_Font_HighQuality))
;- LINK BOTH WINDOWS and CALL 'EM
SetWindowCallback(@MainCallback(), 1)
HideWindow(0, #False)
HideWindow(1, #False)
;-Load and play V2M Sound ; mp3d lib wird hier benötigt
;;MP_CatchV2M(?Song) ; Load Song
;;MP_PlayV2M(0) ; 0 start Song at the beginning
;{- Event loop
Repeat
Event = WaitWindowEvent(1)
eventtype = EventType()
;-catch Interface with Mouse
If Event = #WM_LBUTTONDOWN
SendMessage_(WindowID(1), #WM_NCLBUTTONDOWN, #HTCAPTION, 0)
EndIf
Select EventID
Case 258 ;terminate Program when ESC Hit
;MP_StopV2M(0) ;Stop Playing
;MP_FreeV2M() ;Free Player
End ;terminate Program
EndSelect
;-FUNCTION EXIT BUTTON
eventtype = EventType()
Select event
Case #PB_Event_Gadget
Select EventGadget()
Case #exit_button
Select eventtype
Case #PB_EventType_MouseEnter
SetGadgetAttribute(#exit_button, #PB_Canvas_Image, ImageID(exitHover_1))
Case #PB_EventType_MouseLeave
SetGadgetAttribute(#exit_button, #PB_Canvas_Image, ImageID(exitButton_1))
Case #PB_EventType_LeftButtonDown
;MP_StopV2M(0) ;Stop Music
;MP_FreeV2M() ;Free Player
End
EndSelect
EndSelect
EndSelect
;-Call Web Page -> seems to be buggy?
Select event
Case #PB_Event_Gadget
Select EventGadget()
Case 10
RunProgram("http://www.google.de")
EndSelect
EndSelect
;-This draws the scroller
ClearScreen($434343) ;hintergrundfarbe des Scrollers
cco = 0
For cc = 0 To 10 ; wieviel Buchstaben in einer Reiche des Fontbildes
letter = Asc(UCase(Mid(t.s, tptr+cc, 1)))-31
yCharPos = letter / 20
xCharPos = letter % 20
If xcharpos= 0: xcharpos = 20 : ycharpos=yCharPos-1 :EndIf
If xCharPos <- 1: xCharPos = 19
ElseIf xCharPos > 0 : xCharPos = xCharPos - 1
EndIf
ClipSprite(1, xCharPos*16, yCharPos*16, 16,16) ; Buchstaben Größe festlegen 16*16 pix hier
DisplayTransparentSprite(1, (sco+cco),0)
cco = cco + 16
Next
sco = sco -1 ; Scroll Speed
If sco < -16
tptr = tptr + 1
sco = sco + 16
EndIf
If tptr > Len(t.s)-32
tptr = 0
EndIf
FlipBuffers()
;-ScrollAreaGadget
Select Event
Case #PB_Event_Gadget
EventGadget = EventGadget()
EventType = EventType()
If EventGadget = #ScrollArea_0
EndIf
EndSelect
ForEver
EndIf
EndIf
;End
;}