Log in

View Full Version : little help :(


tuxy
08-28-2003, 10:46 PM
ok i found out the code to put in my game for 8bit but i dont know where to put it my friend that was doing the directx had to move and ive not heard fomr him in a while so i dont know.



Sub SetupPalette()
Dim ddpe(255) As PALETTEENTRY
Dim BFHEADER As BITMAPFILEHEADER
Dim BINFOHEADER As BITMAPINFOHEADER
Dim Dummy As Byte

Open apppath & "farplane.bmp" For Binary Access Read As #1
Open apppath & "titles.bmp" For Binary Access Read As #2
Open apppath & "tuna.bmp" For Binary Access Read As #3
Get #1, , BFHEADER
Get #1, , BINFOHEADER
Get #2, , BFHEADER
Get #2, , BINFOHEADER
Get #3, , BFHEADER
Get #3, , BINFOHEADER
If BINFOHEADER.biClrUsed = 0 Then BINFOHEADER.biClrUsed = 256
For i = 0 To BINFOHEADER.biClrUsed - 1
Get #1, , ddpe(i).Blue
Get #1, , ddpe(i).Green
Get #1, , ddpe(i).Red
Get #1, , Dummy
Get #2, , ddpe(i).Blue
Get #2, , ddpe(i).Green
Get #2, , ddpe(i).Red
Get #2, , Dummy
Get #3, , ddpe(i).Blue
Get #3, , ddpe(i).Green
Get #3, , ddpe(i).Red
Get #3, , Dummy
Next i
Close #1, #2, #3

Set ddp = DirectDraw.CreatePalette(DDPCAPS_8BIT Or DDPCAPS_ALLOW256, ddpe())
PrimarySurface.SetPalette ddp

End Sub
Function Init2() As Boolean
Dim ddsd1 As DDSURFACEDESC2, caps As DDSCAPS2
Dim ddsd4 As DDSURFACEDESC2, i As Integer
Set DirectX = New DirectX7
Set DirectDraw = DirectX.DirectDrawCreate("")
Call DirectDraw.SetCooperativeLevel(Me.hwnd, DDSCL_FULLSCREEN Or DDSCL_EXCLUSIVE)
DirectDraw.SetDisplayMode ResX, ResY, 8, Hz, DDSDM_DEFAULT
ddsd1.lFlags = DDSD_CAPS Or DDSD_BACKBUFFERCOUNT
ddsd1.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE Or DDSCAPS_FLIP Or DDSCAPS_COMPLEX
ddsd1.ddpfPixelFormat.lFlags = DDPF_PALETTEINDEXED8
ddsd1.lBackBufferCount = 1
Set PrimarySurface = DirectDraw.CreateSurface(ddsd1)
caps.lCaps = DDSCAPS_BACKBUFFER
Set BackBuffer = PrimarySurface.GetAttachedSurface(caps)
BackBuffer.GetSurfaceDesc ddsd4
End Function







i've not sure what to do with it though can anyone help me please ;\
i got the rest of the code i dont mind showin you it if it helps, i really need this bad i'll be happy to pay the person that helps back someway or another ;\

Carrot
08-29-2003, 05:40 AM
You're going to have to explain the problem a lot better if you want some help on this.
Maybe if you describe your project a bit more, or the problems that you are having with your code...

Do you have any programming experience? It sounds like you may be the artist on the game (assuming you're working on a game! ;)

Dexterity
08-29-2003, 08:15 AM
Hi Tuxy,

Welcome to the Dexterity forums. From the type of question you're asking, it sounds like you need some basic beginner-level programming help, but these forums aren't the right place to get that kind of help, as the topics here are typically much higher level. If you have to ask this kind of question, you'll likely need a lot more help than anyone here can provide in a forum post. To an experienced programmer, your question of "Where do I put this code?" doesn't really make much sense. It's sort of like making a post in a forum for English professors that says, "I'm trying to finish writing my friend's book, but I'm confused about one thing. Where do I put the nouns?" There's really no way anyone can answer that without privately tutoring you for a long time. Trying to modify someone else's code without really understanding it is like trying to modify a book that's written in a language you can't read. So if the answer to your question about where to place the code isn't immediately forthcoming, then you have a much bigger challenge to tackle first.

However, there never was a winner who wasn't at some point a beginner. So my recommendation would be to read some of the excellent free tutorials and articles over at GameDev.net. That should help give you a broader base for understanding basic game programming. You might also pick up one of the many game programming books now available (check Amazon.com).

Hope this helps....

Cartman
08-29-2003, 08:43 AM
I agreee with the previous post on this. You are going to need some programming help or alot of education to understand this. But let's point you in the right direction.

Looks like VB6 code. It's hard to be specific about where it should go. That would depend on what the original programmer intended. But if I had to guess I would say that they would have put it in a Form.Load event or a Sub Main subroutine. These are the stadard places that objects are initialized in Visual Basic.

If you need additional help, email me at Keith_Sink@hotmail.com. I'll be happy to give you advice on the project.

Good luck.

tuxy
08-29-2003, 10:38 PM
i understand what your sayin but i do have allot of exp with programming and my only prob is i dont in this area ( directx )
thank you cartman for your interest i sent you a email i hope to hear from you soon i really need this done to finsh my project also you interested in join my network as a dev ? i could use someone like you around. ive been studyin directx for a few days now i am understandin it a bit more now and im hopein to know it by heart within th next few weeks

thank everyone for thier help ive been gettign allot of support from these forums and all comments are welcomed.

:D

http://www.tgs.sytes.net/sig.gif

Zoggles
08-30-2003, 03:10 AM
I'll just throw a couple of links in which may be helpful to you:

Luckys VB Gaming Site - Tutorials (http://www.rookscape.com/vbgaming/tutorials.php) - There are plenty of tutorials with source code here which should give you most stuff you need to know

Other places you might find helpful are:

DirectX for Visual Basic Forums (http://pub13.ezboard.com/fvisualbasicexplorerdirectx70?page=1)

DirectX 4 VB (http://www.directx4vb.com/)

VB Gamer (http://vbgamer.strategon.com/index.asp)

-Z-

tuxy
08-30-2003, 10:23 AM
Thank you guys these sites are very helpful