Funding for 'IT Lab' Project, Phase 1: Progress of sticker sales. Purchase a sticker to help us reach our target.Updated: 2010-02-28 11:53
10.7%
විෂුවල් බේසික් මගින් DirectX8 භාවිතා කර වීඩියෝ ක‍්‍රීඩා නිපදවීම

මා ඔබව දැන් මුණගැසෙන්නේ ඩිජිට් හරහා තෙවන වතාවටයි. මේ වන විටත් ඩිජිට් සඟරාව හරහා ලක්දිව තොරතුරු තාක්ෂණය අස්වැද්දීමට කරන රයත්නය ඔබට මොනවට පැහැදිලි වී ඇති බව මම දනිමි. ඩිජිට් සඟරාව මඟින් නව පුනරුදයක් වන බව දැනටමත් සත්යාපනය වී ඇත. එහිදී සෑම විෂයය ක්ෂේතරයක් අළලාම කරුණු ගොනු කිරීමට ලිපි රචකයන් සමත්වීම පැසසිය යුතු කරුණක් වෙයි.

 මම මෙම ලිපි පෙල හරහා දැන් ඔබට ඩිරෙක්ට්ස් කේතන රමය පිළිබඳව සුළු අවබෝධයක් ලබාදිමට කටයුතු කර ඇත. නමුත් මම, අප ලියුවා වූ කේතනයන් පිළිබඳව ගැඹුරු විගරහයක නොයෙදුනෙමි. එයට බොහෝ හේතු ඇත. ඩිජිට් සමඟ දිගටම සම්බන්ධ වී සිටින ඔබට එය ලඟදීම දැනගත හැකි වනු ඇත. අප ඉගෙන ගත් දේ පිළිබඳව පුනරාවර්ජනයක් කරතොත් අප මුල්ම පාඩමේ දී ඉගෙන ගත්තේ ඩිකේට්ස් රාමුවක් නිපදවා ගන්නේ කෙසේදැයි කියාය. ඉක්බිතිව අභ්යාසයක් ආශරයෙන් අතුරු මුහුණතේ වර්ණය වෙනස් කරන ආකාරය ඉගෙන ගැනීමට ඔබට මඟ පෙන්නුවෙමි. ඊළඟට අවසාන වශයෙන් සම්පූර්ණ තිරයට සවිවන සේ ඩිරෙට්ස් රාමුවක් නිපදවා ගන්නා අන්දම අප ඉගෙන ගත්තෙමු. (ඔබ මෙම ලිපිය රථම වරට කියවනවා නම් මා ඔබෙන් ඉල්ලා සිටින්නේ රථම ලිපියේ සිට කියවන ලෙසටයි. එවිට ඔබට මෙහි හරය යම්තාක් දුරකට වටහා ගැනීමට හැකි වනු ඇත.*

       දැන් අප මෙම මස ලිපියෙන් ඉගෙන ගැනීමට බලාපොරොත්තු වන්නේ ඩිරෙක්ට්ස් අතුරු මුහුණතට අකුරු එකතු කරන්නේ කුමන ආකාරයෙන් දැයි කියාය. මෙය එතරම් අපහසු දෙයක් නොවෙයි. මෙම කේතනයන් හොඳින් වටහා ගන්න. තවද, ඩිරෙක්ට්ස් විචල්යය පිවිසුම සඳහා අප විසින් භාවිතා කරන කේතන පිළබඳව යම්කිසි අවබෝධයක් ඔබ සතුව තිබීම අනිවාර්යය වෙයි.


‘Varialble Declartion

 Option Explicit

Private Const COLOR_DEPTH_16_BIT As Long = D3DFMT_R5G6B5

Private Const COLOR_DEPTH_24_BIT As Long = D3DFMT_A8R8G8B8

Private Const COLOR_DEPTH_32_BIT As Long = D3DFMT_X8R8G8B8

Private DirectX8 As DirectX8

private Direct3D As Direct3D8

Private Direct3DX As D3DX8

Private Direct3D_Device As Direct3DDevice8

Private Main_Font As D3DXFont

Private Main_Font_Description As IFont

Private Text_Rect As RECT

Private Fullscreen_Enabled As Boolean

Private Running As Boolean

 

Private Sub Form_Activate()

     Dim Display_Mode As D3DDISPLAYMODE

    Dim Direct3D_Window As D3DPRESENT_PARAMETERS

    frmMain.Caption = "Digit E MagaZine"

 

    Set DirectX8 = New DirectX8

    Set Direct3D = DirectX8.Direct3DCreate()

    Set Direct3DX = New D3DX8

      If Fullscreen_Enabled = True Then

      Display_Mode.Width = 800

        Display_Mode.Height = 600

        Display_Mode.Format = COLOR_DEPTH_16_BIT

       Direct3D_Window.Windowed = False

        Direct3D_Window.BackBufferCount = 1

        Direct3D_Window.BackBufferWidth = Display_Mode.Width

        Direct3D_Window.BackBufferHeight = Display_Mode.Height

        Direct3D_Window.hDeviceWindow = frmMain.hWnd

   Else

        Direct3D.GetAdapterDisplayMode D3DADAPTER_DEFAULT, Display_Mode                           

                Direct3D_Window.Windowed = True

        End If

        Direct3D_Window.SwapEffect = D3DSWAPEFFECT_COPY_VSYNC

    Direct3D_Window.BackBufferFormat = Display_Mode.Format

    Set Direct3D_Device = Direct3D.CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, frmMain.hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, Direct3D_Window)

    Font.Name = "Arial"

   Font.Size = 14

    Set Main_Font_Description = Font

    Set Main_Font = Direct3DX.CreateFont(Direct3D_Device, Main_Font_Description.hFont)

   Text_Rect.Left = 30

    Text_Rect.Top = 30

    Text_Rect.Right = Text_Rect.Left + 100

    Text_Rect.bottom = Text_Rect.Top + 20

   Running = True

    Do While Running = True

       DoEvents          

       Direct3D_Device.Clear 0, ByVal 0, D3DCLEAR_TARGET, D3DColorRGBA(0, 0, 0, 0), 1#, 0         

       Direct3DX.DrawText Main_Font, D3DColorRGBA(255, 255, 255, 255), "DiGit", Text_Rect, DT_TOP Or DT_LEFT

       Direct3D_Device.Present ByVal 0, ByVal 0, 0, ByVal 0

    Loop

end Sub

   මෙහිදී මා සවි රාමුව හෝ සම්පූර්ණ රාමුව යන දෙකේම අපට අවශ් අකුරු පෙන්වීමට කටයුතු කර ඇත. එවිට ඔබට නැවත අපගේ මුල් පාඩම් පුනරීක්ෂණය වනු ඇත. අප දැන් එක් අවස්ථාවක් කේතනය කර හමාරයි. දැන් අපි දෙවන අවස්ථාව කෙසේ කේතනය කරන්නේ දැයි බලමු.


Private Sub Form_Load()

    

    If MsgBox("Click Yes to go to full screen (Recommended)", vbQuestion Or vbYesNo, "Options") = vbYes Then Fullscreen_Enabled = True

 End Sub

 මෙහිදී වන්නේ මා පෙර කී පරිදි වැඩසටහන පටන් ගැනීමට පෙර කවුළුවක් විවෘත වී අපට දර්ශනය වියයුතු රාමුව පිළිබඳව ඇසීමයි. ඔබට විෂුවල් බේසික් පිළිබඳව යම්කිසි පූර්ව අවබෝධයක් මෙම ලිපි පෙල කියවාගෙන යාමේදී තිබිය යුතු බව හොඳින් මතක තබාගන්න. එසේ නැතිනම් ස්වයං අධ්යයනයක යෙදෙන්න. සැමවිටම දැනුමෙන් පරිපූර්ණ වීමට උත්සාහ කරන්න. 

 

Private Sub Form_Unload(Cancel As Integer)

    Running = False

 

    Set Direct3D_Device = Nothing

    Set Direct3D = Nothing

    Set DirectX8 = Nothing

  

    Unload Me

 

    End

   

End Sub

           මා පෙර පාඩම් වල පැවසූ පරිදි සියළුම කරුණු පරිගණක මතකයෙන් ඉවත් කළයුතු වෙයි. ඔබ මෙම වැඩසටහන පටන් ගෙන ඔබට යම් කිසි දෙයක් තිරයේ දැකගැනීමට හැකි වනු ඇත. නමුත්, ඔබ එම වැඩසටහනෙන් ඉවත් වන්නේ කෙසේද ?

  මා එම කේතනය මෙම ලිපියේ දී සඳහන් නොකළේ ඔබ විසින්ම එය කිරීමට අවශ් වූ නිසාය. මෙම සතියේ ඔබ කළයුතු අභ්යාසය වන්නේ එයයි.

ලබන සතියේ ඉතාම ආශ්වාදයක් ගෙන දෙන ලිපියක් සමඟ හමු වෙමු.

 

                                                 Previous article

 

 

 

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options