It's my birthday!

For everything that's not in any way related to PureBasic. General chat etc...
fweil
Enthusiast
Enthusiast
Posts: 725
Joined: Thu Apr 22, 2004 5:56 pm
Location: France
Contact:

Post by fweil »

Code: Select all

Enumeration 1
  #Sprite3D1
  #Window_Main
  #Status_Bar
  #Gadget_Button_ClickMe
  #Sprite1
  #Image_Background
EndEnumeration

  Quit = #FALSE
  nSprites = 10
  Dim ZoomFactor(nSprites)
  Dim Zoom(nSprites)
  Dim AngleFactor(nSprites)
  Dim Angle(nSprites)
  Dim XFactor(nSprites)
  Dim YFactor(nSprites)
  Dim X(nSprites)
  Dim Y(nSprites)
  Dim Transparency(nSprites)
  WindowXSize = GetSystemMetrics_(#SM_CXSCREEN)
  WindowYSize = GetSystemMetrics_(#SM_CYSCREEN)
  WindowedScreenXSize = 800
  WindowedScreenYSize = 600
  For i = 1 To nSprites
    ZoomFactor(i) = 10
    AngleFactor(i) = 1
    XFactor(i) = 1
    YFactor(i) = 1
    Zoom(i) = Random(200)
    Angle(i) = Random(360)
    X(i) = Random(WindowedScreenXSize)
    Y(i) = Random(WindowedScreenYSize)
    Transparency(i) = 100
  Next
  Start = #TRUE
  If InitSprite() And InitSprite3D() And InitKeyboard() And InitMouse()
      If OpenWindow(#Window_Main, 0, 0, WindowXSize, WindowYSize, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered, "Happy birthday")
          If CreateGadgetList(WindowID())
              SetGadgetFont(#PB_Default, LoadFont(0, "Verdana", 24, #PB_Font_Bold | #PB_Font_Italic | #PB_Font_HighQuality))
              ButtonGadget(#Gadget_Button_ClickMe, 10, 10, WindowXSize - 20, 60, "Click me")
          EndIf
          BackgroundImageID = CreateImage(#Image_Background, WindowedScreenXSize, WindowedScreenYSize)
          StartDrawing(ImageOutput())
            For x = 0 To WindowedScreenXSize
              LineXY(x, 0, 0, x * WindowedScreenYSize / WindowedScreenXSize, x << 15)
              LineXY(x, WindowedScreenYSize, WindowedScreenXSize, x * WindowedScreenYSize / WindowedScreenXSize, x << 15)
            Next
          StopDrawing()
          hCursor1 = LoadCursor_(0, #IDC_ARROW)
          hCursor2 = LoadCursor_(0, #IDC_CROSS)
          AddKeyboardShortcut(#Window_Main, #PB_Shortcut_Escape, #PB_Shortcut_Escape)
          If OpenWindowedScreen(WindowID(), (WindowXSize - WindowedScreenXSize) / 2, (WindowYSize - WindowedScreenYSize - WindowedScreenBottomMargin) / 2, WindowedScreenXSize, WindowedScreenYSize, 0, 0, 0)
              SpriteWidth = 128
              SpriteHeight = 128
              TransparentSpriteColor(-1, 0, 0, $40)
              CreateSprite(#Sprite1, SpriteWidth, SpriteHeight, #PB_Sprite_Texture)
              StartDrawing(SpriteOutput(#Sprite1))
                DrawingFont(LoadFont(0, "Verdana", 10, #PB_Font_Bold | #PB_Font_Italic | #PB_Font_HighQuality))
                Box(0, 0, SpriteWidth, SpriteHeight, $400000)
                BackColor(0, 0, $40)
                FrontColor($FF, $FF, $C0)
                DrawingMode(1)
                Text.s = "Happy birthday"
                Locate((SpriteWidth - TextLength(Text)) / 2, (SpriteHeight - 15) / 2)
                DrawText(Text)
                Text.s = "LarsG"
                Locate((SpriteWidth - TextLength(Text)) / 2, (SpriteHeight + 15) / 2)
                DrawText(Text)
                DrawingMode(4)
                Box(0, 0, SpriteWidth, SpriteHeight, $C0FFFF)
              StopDrawing()
              CreateSprite3D(#Sprite3D1, #Sprite1)
              Sprite3DQuality(1)
              Repeat
                Select WindowEvent()
                  Case #PB_Event_CloseWindow
                    Quit = #TRUE
                  Case #PB_Event_Menu
                    Select EventMenuID()
                      Case #PB_Shortcut_Escape
                        Quit = #TRUE
                    EndSelect
                  Case #PB_Event_Gadget
                    Select EventGadgetID()
                      Case #Gadget_Button_ClickMe
                        If Start
                            Start = #FALSE
                            FreeGadget(#Gadget_Button_ClickMe)
                            ButtonGadget(#Gadget_Button_ClickMe, 10, 10, WindowXSize - 20, 60, "Quit")
                          Else
                            Quit = #TRUE
                        EndIf
                    EndSelect
                EndSelect
                GetCursorPos_(CursorPosition.POINT) - 20
                MouseX = CursorPosition\x - WindowX()
                MouseY = CursorPosition\y - WindowY()
                If MouseX >= WindowXSize - WindowedScreenXSize And MouseX <= WindowXSize And MouseY >= WindowYSize - WindowedScreenYSize And MouseY <= WindowYSize
                    SetCursor_(hCursor2)
                  Else
                    SetCursor_(hCursor1)
                EndIf
                If Start3D()
                    FlipBuffers()
                    ClearScreen($00, $00, $40)
                    StartDrawing(ScreenOutput())
                      DrawImage(BackgroundImageID, 0, 0)
                      If Start = #FALSE
                          DrawingFont(LoadFont(0, "Verdana", 40, #PB_Font_Bold | #PB_Font_Italic | #PB_Font_HighQuality))
                          BackColor(0, 0, $40)

                          FrontColor($FF, $FF, $FF)
                          DrawingMode(1)
                          Text.s = "Happy birthday"
                          XText = (WindowedScreenXSize - TextLength(Text)) / 2
                          YText = (WindowedScreenYSize - 60) / 2
                          Locate(XText - 2, YText + 2)
                          DrawText(Text)
                          FrontColor(Red(Color), Green(Color), Blue(Color))
                          Locate(XText, YText)
                          DrawText(Text)
                          FrontColor($FF, $FF, $FF)
                          Text.s = "LarsG"
                          XText = (WindowedScreenXSize - TextLength(Text)) / 2
                          YText = (WindowedScreenYSize + 60) / 2
                          Locate(XText - 2, YText + 2)
                          DrawText(Text)
                          FrontColor(Red(Color), Green(Color), Blue(Color))
                          Locate(XText, YText)
                          DrawText(Text)
                          Color + 7
                          DrawingMode(0)
                          For i = 12 To 1 Step -1
                            XCandle = WindowedScreenXSize / 2 + 300 * Sin(i / 4)
                            YCandle = WindowedScreenYSize / 2 + 150 * Cos(i / 4)
                            For Candle = 10 To 0 Step - 2
                              Box(XCandle - Candle + 5, YCandle + 80, Candle, 35, RGB(150 + 10 * Candle, 150 + 10 * Candle, 150 + 10 * Candle))
                            Next
                            For Light = 25 To 1 Step -1
                              Circle(XCandle + Random(2) - 1, YCandle + 3* Light + Random(2) - 1, Light / 4, RGB(Light * 10, Light * 6, 0))
                            Next
                            XCandle = WindowedScreenXSize / 2 - 300 * Sin(i / 4)
                            YCandle = WindowedScreenYSize / 2 + 150 * Cos(i / 4)
                            For Candle = 10 To 0 Step - 2
                              Box(XCandle - Candle + 5, YCandle + 80, Candle, 35, RGB(150 + 10 * Candle, 150 + 10 * Candle, 150 + 10 * Candle))
                            Next
                            For Light = 25 To 1 Step -1
                              Circle(XCandle + Random(2) - 1, YCandle + 3* Light + Random(2) - 1, Light / 4, RGB(Light * 10, Light * 6, 0))
                            Next
                          Next
                      EndIf
                    StopDrawing()
                    For i = 1 To nSprites
                      ZoomSprite3D(#Sprite3D1, Zoom(i), Zoom(i))
                      RotateSprite3D(#Sprite3D1, Angle(i), 0)
                      DisplaySprite3D(#Sprite3D1, X(i), Y(i), Transparency(i))
                      Transparency(i) = Transparency(i) + 1
                      If Transparency(i) > 255
                          Transparency(i) = 200
                      EndIf
                      Zoom(i) + ZoomFactor(i)
                      If Abs(Zoom(i)) > 256
                          ZoomFactor(i) = -ZoomFactor(i)
                      EndIf
                      Angle(i) + AngleFactor(i)
                      If Angle(i) > 360
                          AngleFactor(i) = -AngleFactor(i)
                      EndIf
                      X(i) + XFactor(i)
                      Y(i) + YFactor(i)
                      If X(i) > WindowedScreenXSize Or X(i) < 0
                          XFactor(i) = -XFactor(i)
                      EndIf
                      If Y(i) > WindowedScreenYSize Or Y(i) < 0
                          YFactor(i) = -YFactor(i)
                      EndIf
                    Next
                    Stop3D()
                EndIf
                ExamineKeyboard()
                If KeyboardPushed(#PB_Key_Escape)
                    Quit = #TRUE
                EndIf
                Delay(1)
              Until Quit
            Else
              MessageRequester("Error", "Can't open the main windowedscreen", 0)
          EndIf
        Else
          MessageRequester("Error", "Can't open the main window", 0)
      EndIf
    Else
      MessageRequester("Error", "Can't init DirectX", 0)
  EndIf
End 
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
sec
Enthusiast
Enthusiast
Posts: 792
Joined: Sat Aug 09, 2003 3:13 am
Location: 90-61-92 // EU or ASIA
Contact:

Post by sec »

my GF born in a box/house (Linux box), did not on window (Window os) ... you have what for her (without me :)
fweil
Enthusiast
Enthusiast
Posts: 725
Joined: Thu Apr 22, 2004 5:56 pm
Location: France
Contact:

Post by fweil »

Well, you will have to replace GetSystemMetrics_() by your own screen size, and the LoadCursor_() functions with apropriate (but I don't know on Linux !).

Rgrds
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Post by LarsG »

WOW! Thanks for the nice "gift" fweil!! :) it is very cool.. :D

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

fweil, you got too much time at hand! :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
fweil
Enthusiast
Enthusiast
Posts: 725
Joined: Thu Apr 22, 2004 5:56 pm
Location: France
Contact:

Post by fweil »

blueznl,

I am working on a silly 'get Excel sheet data into Purebasic' that makes me mad, so I decided to change by drawing candles to LarsG. I do that better.

By the way if somebody can give me a some_lines code that gets Excel sheet data !!!???
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

you mean... reading directly from the .xls file? that would be nice... i'm interested :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
benny
Enthusiast
Enthusiast
Posts: 465
Joined: Fri Apr 25, 2003 7:44 pm
Location: end of www
Contact:

Post by benny »

Happy Birthday and all the best, LarsG!
regards,
benny!
-
pe0ple ar3 str4nge!!!
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

Happy birthday!

Hey where's the BEER :?: :?: :?:
MadMax
Enthusiast
Enthusiast
Posts: 237
Joined: Mon Oct 06, 2003 11:56 am

Post by MadMax »

Happy Birthday :)
Post Reply