Quantcast
Channel: VBForums - Games and Graphics Programming
Viewing all 263 articles
Browse latest View live

Please, i need a programmer

$
0
0
Hello, not everyone might understand but anyone familiar with using a fps limitter in game will understand.

first sorry for my poor english, it's my 2nd language. Please read all my post, i hope you will understand what im asking. Im a sli user and gsync @ 144hz user. I have a sli of titan x and the rog swift monitor. I have high fps in games but with sli, in many games i still see some stutter/micro-stutter, even in the 90+ fps range. Single card is generally butter smooth. I discover how much using RTSS as a fps limitter was awesome. For exemple, in GTA5, with my setting, in town, im in the 90 fps range, but still see some stutter. Putting fps limitter to 80 fps help a lot. In fact, with sli, i discover that if you set a fps limitter and the fps never go below that fps, sli feel smooth. So i run locked at 80 fps, and its smooth. But when i go outside of the city, fps go below 80, and even at 70 fps, i start to see some stutter/micro-stutter again. So if i take down the fps limitter to 65fps, every thing is smooth again. But if then i go at the worse case in the game, fps can go as low as 55 fps. Then again, if i put a fps limitter to 50, smooth again. So to have a 100% smooth experience, i would have to limit at 50fps. But that is a bit low, when i can get 90+ fps elsewhere in the game.

So what im asking to programmer, is there a way make a dynamic fps limitter?
Like it would go down as fps go down, and it would go up only when enought power to not fall back so quick. I don't know if you understand what i mean? A bit like nvidia did with their "smooth vsync" option, in the manner that when it drop to 30hz, it wont go back up to 60hz until it have high enought fps to not fall back to 30hz too soon. That would be fantastic if someone could do that. That is the only way to enjoy a real smooth experience with gsync + sli +144hz. Im very sencitive to any form of stutter, and i can't live without RTSS now, but would be so great if a dynamic fps limitter would be possible.

I was thinking why not limit fps in fonction of the gpu 1 usage. I know sometimes you can be below 99% usage for different reason (ex. cpu bound situation), but i was thinking about something. If you try to maintain, let say 92% gpu 1 usage by the fps limitter, you should then be a few fps below what you can acheive. So if i play GTA5 and im at 90fps at 99% usage, then if the dynamic limitter try to keep gpu usage at 92%, he will limit to maybe 80 fps. If i move out of town and fps start to drop, the gpu usage will start to climb up, then the fps limitter, trying to keep gpu usage at 92% will then lower the fps. So if i dropped to 70 fps, the limitter will now limit to lets say 65 fps. Maybe this could be a way of making a dynamic fps limitter? There could be a minimum limit to maybe 30fps, even if gpu usage is 99%, and a maximun limit, maybe 144fps, if gpu usage is very low (ex. in a video cutscene) I really think this is something needed with gsync + sli + 144hz. Of course fps will be a little lower, but with gsync, high fps doesn't matter if frame pacing is not good. I hope someone could program this. Probably not an easy task, but if anyone think he can do it, let me know please.
Thanks you very much

slot machine

$
0
0
I don't know if this should be done in vb.net or directx and c++ but i want to make a slot machine program.

not bothered but the casino logic or the multiline plays but more the rotating images and coins flying out if you win. how do you do this

64 Bit Machine With Window and Red X

How I can get torrent XRumer + SocPlugin???

$
0
0
Where I can get cheap XRumer 12.0.11???

It is really new powerful tool for promotion, I'm need it, so help me plz if it possible... Thank
At first, I need BlogsPlugin - it's automate blogging with captchas bypass and works with a TOP-10 Blogs platforms!
(it's included in XRumer 12 official package, so please help me to find it! Thank you again!)

P.S. Also, as I know, only XRumer 12.0.11 can bypass new Google's ReCaptcha...
Maybe somebody know cheap alternative??

Where to start?

$
0
0
Hello,
I work for an engineering company that mainly develops ships. It has been my desire to develop some software that will aid in ship building. It isn't exclusively for the company that I work for, rather it is a tool that I hope to market to Naval Architects and engineering companies that could find it useful. However I am not sure how to start. I am not an expert programmer, but I am certainly not a newb; what is somewhat daunting to me is graphics programming. I have never done any graphics programming. In order for this software to work, it needs to be able to manipulate CAD models and calculate things like the surface area and volume of CAD models just to name a few things. It would also have to be compatible with certain file types. Essentially it will be used calculate ship stability in certain conditions.

So where exactly would I start, and what API would I use? The CAD models I want to use are based on the OpenGL API. Is that what I would have to use to develop software like this?

[RESOLVED] I am trying to do sprite animation is there a way to speed this up?

$
0
0
I'm back to VB after being away for a while. I can't speed this up any faster. The interval is set to the lowest delay which is 1 and it's very slow. Is there a better way for this?
Just click anywhere to move the rectangle.

Code:

Public Class Form1

    Private bbuffer As New Bitmap(800, 600)
    Private gbbuffer As Graphics = Graphics.FromImage(bbuffer)

    Dim mySprite As New Bitmap("e:\sprites\sprite1.gif")

    Dim x As Integer
    Dim y As Integer

    Dim ToX As Integer
    Dim ToY As Integer

    Dim bQuit As Boolean = False

    Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Timer1.Start()

        Me.Show()
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        DoUpdate()
        Draw()
    End Sub

    Private Sub DoUpdate()
        If x < ToX Then x += 1 Else If x > ToX Then x -= 1
        If y < ToY Then y += 1 Else If y > ToY Then y -= 1
    End Sub

    Private Sub Draw()
        gbbuffer.Clear(Color.LightSkyBlue)

        gbbuffer.DrawImage(mySprite, x, y)

        picView.CreateGraphics.DrawImage(bbuffer, 0, 0)
    End Sub

    Private Sub picView_MouseDown(sender As Object, e As MouseEventArgs) Handles picView.MouseDown
        ToX = e.X
        ToY = e.Y
    End Sub
End Class

Here is the sprite.
Name:  sprite1.gif
Views: 96
Size:  1.1 KB
Attached Images
 

[VBA] Bitmap generator

$
0
0
Hello
I'm new in VB and i want really start with this project :
Building an *.exe where there will be a button "Generate"

When the user clic on "Generate" button, the program should shows many pictures moving, then randomly stop in 2 fixed pictures

It act like this casino game, but only with 2 slots not 3 :

Name:  Capture (1).JPG
Views: 51
Size:  21.6 KB

Thanks in advance for help
Attached Images
 

Need Help Protected Swf

$
0
0
Hi , I am Link :) i am trying to put an ".swf" file in visual basic 2008 i can get it in there ive done many others but...
this one seems to freeze on the login screen and when i test the program it just opens up a web browser and goes straight to the games
home page , tequnically its forcing me to use the browser/domain i looked up Protected swf's and i seen one thing used was to make an ".swf"
unable to run on any other website(domain) or any local computer any way to unprotect it? i downloaded a program and tried it but the program was pretty old
and said it wasnt even protected to begin with...
any help?
thanks
-Link

Please tell me if you can determine the fix for these compile errors

$
0
0
i will understand if submitting this much code is asking too much, but it's worth a shot.
Please tell me [if you can determine the problem from the following subroutine listing
and the attached image of the error list] what the problem is and how to fix it.

Joe Miller

Private Sub Button_Indicators_Add_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Indicators_Add.Click
DGV2.Columns.Clear()
' XXX Check if exists first column, if no column then copy id from Data tab
If DGV2.Columns.Count = 0 Then
DGV2.Columns.Add("Column0", "ID")
DGV2.Columns.Add("Column1", "Date")
DGV2.Columns(1).DefaultCellStyle.Format = "MM/dd/yyyy"
For i As Integer = 0 To DGV1.RowCount - 2
DGV2.Rows.Add(i.ToString)
DGV2.Rows(i).Cells(0).Value = DGV1.Rows(i).Cells(0).Value + 0
DGV2.Rows(i).Cells(1).Value = DGV1.Rows(i).Cells(1).Value
Next
End If


DGV2.Columns.Add("Column" & DGV2.Columns.Count, "SMA(" & Me.NumericUpDown2.Value & ")")
DGV2.Columns(2).DefaultCellStyle.Format = "N5"

'' XXX Here is calculation of Simple Moving Averages 'JCM MARKER2
'Dim MovingAverageDays As Integer = Me.NumericUpDown2.Value ' XXX Get data from NumericUpDown object on Indicators tab
'Dim MovingAverageOffset As Integer = Me.NumericUpDown7.Value
'Dim MovingAverage As Decimal = 0
'For Count As Integer = 0 To DGV1.RowCount - MovingAverageDays - 5 ' XXX Cycle for all rows from Data tab
' MovingAverage = 0
' For i = Count + MovingAverageOffset To Count + MovingAverageDays - 1 + MovingAverageOffset ' XXX Cycle for all period
' If i >= 0 Then MovingAverage += DGV1.Item(5, i).Value ' XXX Sum Closing Prices
' Next
' ' XXX Divide MovingAverage by Period (MovingAverageDays) and round to 5 dec places
' DGV2.Rows(Count).Cells(DGV2.Columns.Count - 1).Value = Math.Round(100000 * MovingAverage / MovingAverageDays) / 100000
'Next

'JCM MARKER2A

'////////////////////////////////////////////////////////////////////////////////////////////////////////// PolyFit calculation replaces SMA calculation above ///////////////////////////////////////////////////

Dim MovingAverageDays As Integer = Me.NumericUpDown2.Value ' XXX Get data from NumericUpDown object on Indicators tab
Dim MovingAverageOffset As Integer = Me.NumericUpDown7.Value
Dim MovingAverage As Decimal = 0
Dim Count As Integer
MovingAverage = 0
Dim JJJ As Integer 'dimensioned JJJ explicitly because otherwise it cannot be displayed with a debug popup?
JJJ = 11
Static joecounter As Integer = 11
For Count = DGV1.RowCount - MovingAverageDays - 6 To 0 Step -1 'trial solution to correct shift error 'jcm marker july26
Dim jcmMOVAVG As Double = DGV2.Rows(Count).Cells(DGV2.Columns.Count - 1).Value 'jcm2 index out of range
Dim listOfPoints As New List(Of PointXY)
Dim PolyFitDegree As Integer = MovingAverageDays 'use MovingAverageDays value for PolyFitDegree
'MsgBox("Dummy MsgBox")
JJJ = JJJ + 1
Debug.Print(" ")
Debug.Print("******************************" & DGV1.Rows(DGV1.RowCount - JJJ + 1).Cells(1).Value)
joecounter = joecounter + 1
Debug.Print(joecounter & " JJJ= " & JJJ)
Dim CloseDay1 As Double = DGV1.Rows(DGV1.RowCount - JJJ + 6).Cells(5).Value
Dim CloseDay2 As Double = DGV1.Rows(DGV1.RowCount - JJJ + 5).Cells(5).Value
Dim CloseDay3 As Double = DGV1.Rows(DGV1.RowCount - JJJ + 4).Cells(5).Value
Dim CloseDay4 As Double = DGV1.Rows(DGV1.RowCount - JJJ + 3).Cells(5).Value
Dim CloseDay5 As Double = DGV1.Rows(DGV1.RowCount - JJJ + 2).Cells(5).Value
Dim CloseDay6 As Double = DGV1.Rows(DGV1.RowCount - JJJ + 1).Cells(5).Value 'this is most recent day
Dim MidPtDay1 As Double = 1.079 '(DGV1.Rows(DGV1.RowCount - JJJ + 6).Cells(3).Value + DGV1.Rows(DGV1.RowCount - JJJ + 6).Cells(4).Value) / 2 'jcm zzz
Dim MidPtDay2 As Double = 1.0765 '(DGV1.Rows(DGV1.RowCount - JJJ + 5).Cells(3).Value + DGV1.Rows(DGV1.RowCount - JJJ + 5).Cells(4).Value) / 2
Dim MidPtDay3 As Double = 1.07192 '(DGV1.Rows(DGV1.RowCount - JJJ + 4).Cells(3).Value + DGV1.Rows(DGV1.RowCount - JJJ + 4).Cells(4).Value) / 2
Dim MidPtDay4 As Double = 1.07537 '(DGV1.Rows(DGV1.RowCount - JJJ + 3).Cells(3).Value + DGV1.Rows(DGV1.RowCount - JJJ + 3).Cells(4).Value) / 2
Dim MidPtDay5 As Double = 1.07547 '(DGV1.Rows(DGV1.RowCount - JJJ + 2).Cells(3).Value + DGV1.Rows(DGV1.RowCount - JJJ + 2).Cells(4).Value) / 2
Dim MidPtDay6 As Double = 1.08415 '(DGV1.Rows(DGV1.RowCount - JJJ + 1).Cells(3).Value + DGV1.Rows(DGV1.RowCount - JJJ + 1).Cells(4).Value) / 2
Debug.Print(joecounter & " CloseDay1= " & CloseDay1 & ", CloseDay2= " & CloseDay2 & ", CloseDay3= " & CloseDay3)
Debug.Print(joecounter & " CloseDay4= " & CloseDay4 & ", CloseDay5= " & CloseDay5 & ", CloseDay6= " & CloseDay6 & "(most recent day)")
listOfPoints.Add(New PointXY(1, MidPtDay1))
listOfPoints.Add(New PointXY(2, MidPtDay2))
listOfPoints.Add(New PointXY(3, MidPtDay3))
listOfPoints.Add(New PointXY(4, MidPtDay4))
listOfPoints.Add(New PointXY(5, MidPtDay5))
listOfPoints.Add(New PointXY(6, MidPtDay6)) 'most recent day
Debug.Print(joecounter & " MidPtDay1= " & MidPtDay1 & ", MidPtDay2= " & MidPtDay2 & ", MidPtDay3= " & MidPtDay3)
Debug.Print(joecounter & " MidPtDay4= " & MidPtDay4 & ", MidPtDay5= " & MidPtDay5 & ", MidPtDay6= " & MidPtDay6 & "(most recent day)")
PolyFitDegree = 2
Dim coefficients() As Double = calculateCoefficients(listOfPoints, PolyFitDegree) '<------------------------ FIT THE LIST OF POINTS
Dim a0 As Double = coefficients(0)
Dim a1 As Double = coefficients(1)
Dim a2 As Double = coefficients(2)
Dim PolyFit As Double
Dim PolyFitDayNum As Integer
PolyFitDayNum = 6
Dim temp_for_debug As Integer = DGV2.RowCount
PolyFit = a0 + (a1 * PolyFitDayNum) + (a2 * PolyFitDayNum ^ 2) '<---- projection into day4
DGV2.Rows(Count).Cells(DGV2.Columns.Count - 1).Value = PolyFit 'display polyfit value in ?????? table
Debug.Print(joecounter & " a0= " & a0)
Debug.Print(joecounter & " a1= " & a1)
Debug.Print(joecounter & " a2= " & a2)
Debug.Print(joecounter & " PolyFit for last day= " & PolyFit)
PolyFitDayNum = 7 'now do a projection into last day+1
Dim Projection As Double
Projection = a0 + (a1 * PolyFitDayNum) + (a2 * PolyFitDayNum ^ 2)
Debug.Print(joecounter & " Projection into last day+1 = " & Projection)
'If joecounter = 253 Then Stop
Next
'JCM MARKER2B

DGV2.Columns.Add("Column" & DGV2.Columns.Count, "Slope")
DGV2.Columns.Add("Column" & DGV2.Columns.Count, "Bought/Sold")

For count As Integer = 0 To DGV2.RowCount - 3
If DGV2.Rows(count).Cells(2).Value < DGV2.Rows(count + 1).Cells(2).Value Then DGV2.Rows(count).Cells(3).Value = "Down"
If DGV2.Rows(count).Cells(2).Value > DGV2.Rows(count + 1).Cells(2).Value Then DGV2.Rows(count).Cells(3).Value = "Up"
If DGV2.Rows(count).Cells(2).Value = DGV2.Rows(count + 1).Cells(2).Value Then DGV2.Rows(count).Cells(3).Value = "Same"
Next

''Bough/Sold
For count As Integer = 0 To DGV2.RowCount - 3
If DGV2.Rows(count + 1).Cells(3).Value = "Up" Then DGV2.Rows(count).Cells(4).Value = "Bought"
If DGV2.Rows(count + 1).Cells(3).Value = "Down" Then DGV2.Rows(count).Cells(4).Value = "Sold"
Next


DateTimePicker1.MinDate = DGV1.Rows(DGV1.RowCount - 3).Cells(1).Value
DateTimePicker2.MinDate = DGV1.Rows(DGV1.RowCount - 3).Cells(1).Value
DateTimePicker1.Value = DGV1.Rows(DGV1.RowCount - 3).Cells(1).Value
DateTimePicker1.MaxDate = DGV1.Rows(0).Cells(1).Value
DateTimePicker2.MaxDate = DGV1.Rows(0).Cells(1).Value
DateTimePicker2.Value = DGV1.Rows(0).Cells(1).Value
End Sub
Attached Images
 

Pizza Form Game Problem with Calculations and Listbox

$
0
0
I'm still trying to figure out how I can get the numbers to add together to get the subtotal as well as convert it to currency format. It's a single digit and doesn't go past 9 regardless of how many toppings I check. I'm also having problems with selecting strings on the list box. I haven't been able to start on the tax and total yet.

My code:
Option Strict Off
Public Class Form1



Private Sub InformationCtrlIToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InformationCtrlIToolStripMenuItem.Click
MsgBox("Pizza Order System 1.0")

End Sub

Private Sub ExitToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem1.Click
Me.Close()
End Sub

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.I Then
MsgBox("Pizza Order System 1.0")
End If
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub ClearToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearToolStripMenuItem.Click
CheckVeggies.Checked = False
CheckOnions.Checked = False
CheckPepperoni.Checked = False
CheckSausage.Checked = False

RadSuperThin.Checked = False
RadRegular.Checked = False
RadStuffed.Checked = False
RadPretzel.Checked = False

ListBox1.ClearSelected()
End Sub

Private Sub OrderToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OrderToolStripMenuItem.Click
Dim OrderToolStripMenuItem As New OrderTotal
If RadSuperThin.Checked = True Then
OrderToolStripMenuItem.lblCostSub.Text = +8
ElseIf RadRegular.Checked = True Then
OrderToolStripMenuItem.lblCostSub.Text = +10
ElseIf RadStuffed.Checked = True Then
OrderToolStripMenuItem.lblCostSub.Text = +12
ElseIf RadPretzel.Checked = True Then
OrderToolStripMenuItem.lblCostSub.Text = +12
End If
If CheckVeggies.Checked = True Then
OrderToolStripMenuItem.lblCostSub.Text += 1
ElseIf CheckOnions.Checked = True Then
OrderToolStripMenuItem.lblCostSub.Text += 1
ElseIf CheckPepperoni.Checked = True Then
OrderToolStripMenuItem.lblCostSub.Text += 1
ElseIf CheckSausage.Checked = True Then
OrderToolStripMenuItem.lblCostSub.Text += 1
End If
Dim count As Integer = 0
count += 1
OrderToolStripMenuItem.Show()

End Sub
End Class


Name:  Pizza.JPG
Views: 20
Size:  29.3 KB
Attached Images
 

xna with vb.net question

$
0
0
Hi, i want to try to do an application using xna in vb.net. I tried this tutorial http://www.vbforums.com/showthread.p...-XNA-in-VB-Net and it work fine; Now i'd like to interact with mouse and buttons, like "draw a line when mouse is click or draw triangle when button is click". so i tried to move the code from process BackgroundWorker1 to mouse_click event or Button1_Click ,but it doesn't work. why?
anyone known a good resource for study xna with vb?

The problem in writing mieweeper, about the database and also the mine part

$
0
0
Dear all,

I am Patricia Chang, a student in Hong Kong. As the HKDSE requires us to do an assignment which will count as 20% of the total mark in the result in the ICT subject in HKDSE.
As our class is study programming as our elective. Thus, we are required to do a program.
I write the program in VB 2010 Express.

I have chose to do a game which is similar to MineSweeper.
Yet, it is only 16 boxes and there is 3 to 5 mine among 16 boxes as the user is required not to hit the mine and find a route from one side to the other side.
I would like to ask whether I should use array function or random function.
Also, I would like to make a ranking. I would like to ask how can I update the data in real time?
Should I use the web database or I can use the normal microsoft access one?

Thanks for all your reply!!!

Need help with a "simple?" algorithm (image processing)

$
0
0
Hi, I'm starting to try a few simple algorithms to do image processing with. I would like to implement an algorithm and also make sure that I am coding it efficiently using vb. My comparison will be to do the same thing in c#, but for now I'm concentrating on vb.

I know very little about these algorithms, so I'm basically going through the filter menu of some graphics applications and checking other settings.

For this question, I would like to try "Threshold". On wikipedia, its explained as changing some pixels to white or black depending on wether they meet a certain constant. This actually sounds very simple, but instead of jumping right into it, I was wondering if anyone can give me an example.

I know how to iterate through pixels with getpixel and setpixel and I am looking into lockbits. if you can give an example either way.

Also, I think this would be a great place to ask this question since it's related. Do you know of any different threshold algorithms? C++ code is hard to digest for me now, but I would like to know how Gimp does thresholding and if you can recommend any other open source paint package, I would like to look at whatever technique is used to do the same thing.

So that pretty much says it. I'm looking to implement a threshold function.
:afrog:

Sound input from microphone to display waveform, how?

$
0
0
I'm designing a project which will take an input from a microphone, Display the relevant waveform and allow the user to invert the wave and output the new sound. So far I've managed to get a waveform from a .WAV file, however, I'm not very well versed in coding and do not know where to start with changing that input to a microphone. Any assistance that anyone can provide will be welcomed greatly. This is the code I have so far.
Public Class Form1

'Define the pic and graphics to draw with
Dim pic As New Bitmap(Me.Width, Me.height)
Dim gfx As Graphics = Graphics.FromImage(pic)

'Data storage
Dim samplez As New List(Of Short)
Dim maxamount As Short
Dim OpenFileDialog1 As New OpenFileDialog
WithEvents OpenFileDialog2 As OpenFileDialog = OpenFileDialog1


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

gfx.DrawString("CLICK HERE!", New Font("Arial", 20), Brushes.Black, 0, 0)

PictureBox1.Image = pic

End Sub

Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
OpenFileDialog1.ShowDialog()
End Sub

Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog2.FileOk



GC.Collect()
Dim wavefile() As Byte = IO.File.ReadAllBytes(OpenFileDialog1.FileName)
GC.Collect()

Dim memstream As New IO.MemoryStream(wavefile)
Dim binreader As New IO.BinaryReader(memstream)

Dim ChunkID As Integer = binreader.ReadInt32()
Dim filesize As Integer = binreader.ReadInt32()
Dim rifftype As Integer = binreader.ReadInt32()
Dim fmtID As Integer = binreader.ReadInt32()
Dim fmtsize As Integer = binreader.ReadInt32()
Dim fmtcode As Integer = binreader.ReadInt16()
Dim channels As Integer = binreader.ReadInt16()
Dim samplerate As Integer = binreader.ReadInt32()
Dim fmtAvgBPS As Integer = binreader.ReadInt32()
Dim fmtblockalign As Integer = binreader.ReadInt16()
Dim bitdepth As Integer = binreader.ReadInt16()

If fmtsize = 18 Then
Dim fmtextrasize As Integer = binreader.ReadInt16()
binreader.ReadBytes(fmtextrasize)
End If

Dim DataID As Integer = binreader.ReadInt32()
Dim DataSize As Integer = binreader.ReadInt32()

'Grabbing the data into 16bit words known as samples
samplez.Clear()
For i = 0 To (DataSize - 1) / 2

samplez.Add(binreader.ReadInt16())

If samplez(samplez.Count - 1) > maxamount Then 'Using this for the pic
maxamount = samplez(samplez.Count - 1)
End If

Next

DrawAudio()

End Sub

Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize

If OpenFileDialog1.FileName <> "" Then
DrawAudio()
End If

End Sub

Private Sub DrawAudio()

'Redefine since size changed
pic = New Bitmap(PictureBox1.Width, PictureBox1.Height)
gfx = Graphics.FromImage(pic)

'Clear picturebox
gfx.FillRectangle(Brushes.Black, 0, 0, pic.Width, pic.Height)


Dim ratio As Integer = (samplez.Count - 1) / (pic.Width - 1) 'If there are 10000 samples and 200 pixels, this would be every 50th sample is shown
Dim halfpic As Integer = (pic.Height / 2) 'Simply half the height of the picturebox

For i = 1 To pic.Width - 10 Step 2 'Steping 2 because in one go, we do 2 samples
Dim leftdata As Integer = Math.Abs(samplez(i * ratio)) 'Grabbing that N-th sample to display. Using Absolute to show them one direction
Dim leftpercent As Single = leftdata / (maxamount * 2) 'This breaks it down to something like 0.0 to 1.0. Multiplying by 2 to make it half.
Dim leftpicheight As Integer = leftpercent * pic.Height 'So when the percent is tied to the height, its only a percent of the height
gfx.DrawLine(Pens.LimeGreen, i, halfpic, i, leftpicheight + halfpic) 'Draw dat! The half pic puts it in the center

Dim rightdata As Integer = Math.Abs(samplez((i + 1) * ratio)) 'Same thing except we're grabbing i + 1 because we'd skip it because of the 'step 2' on the for statement
Dim rightpercent As Single = -rightdata / (maxamount * 2) 'put a negative infront of data so it goes down.
Dim rightpicheight As Integer = rightpercent * pic.Height
gfx.DrawLine(Pens.Blue, i, halfpic, i, rightpicheight + halfpic)

Next

PictureBox1.Image = pic

End Sub

End Class

Sharing to Facebook with Microsoft Visual Studio 2010

$
0
0
I'm creating a game similar to Minesweeper, and I'd like to have a button that shares the game on Facebook. It's a Windows Form Application. I'd like to know the code I'd have to use to do this. I've already looked on Facebook Design and it was less than helpful about what to do for sharing with VB.

need help for graphic developing of interior site font.

$
0
0
Hello Sir ,

I am avani and working as architect but currently i need help for font developing in 3d which is 3d interior website content.
How i am using ghraphic tool for that?
please suggest me some idea.

By Avani,

need help for creat article on 3d architetcural animation

$
0
0
Hi,

i am avani and i m content writer ,which tool is best for getting good content writing idea?
please suggest any tool for content wrting.

By Avani,

[VB 6] [RESOLVED] video game save load

$
0
0
hello i am having trouble with a save load system for a game i am making as a school project, i am able to save to a file but i am unsure as to how i can input the variable back into the program, it is only a single variable at the moment, which is the level number, any help would be great, if need be i can post part of my code to show what i currently have.

[RESOLVED] Draw Parallel Line At Given Point

$
0
0
Normally when I draw a parallel line I take the two end points and adjust it (offset it) by some Y value from the original line.
Remembering my old algebra class some 60 odd years ago, I rememebered y=mx + b and found the following:

Quote:


Find the equation of the straight line that has slope m = 4
and passes through the point (–1, –6).

Okay, they've given me the value of the slope; in this case, m = 4. Also, in giving me a point on the line, they have given me an x-value and a y-value for this line: x = –1 and y = –6.

In the slope-intercept form of a straight line, I have y, m, x, and b. So the only thing I don't have so far is a value for is b (which gives me the y-intercept). Then all I need to do is plug in what they gave me for the slope and the x and y from this particular point, and then solve for b:

y = mx + b
(–6) = (4)(–1) + b
–6 = –4 + b
–2 = b

I know the point where the parallel line should start (x,y) and also have computed the slope of the original line.
Where my problem is, is that if I recall correctly, the y-intercept is on the zero axis.
So how do I compute the y-intercept value (or y value) for an x axis value that is Not on the zero axis?

For example using positive numbers only -- standard VB where (0,0) is in upper left hand corner --
If my known starting point is at (5, 5) and the line slopes upward (or downward) and I want the line with my known slope
to end at x = 25, how do I compute the y value?

[RESOLVED] Why doesn't this work???

$
0
0
Public Class frmHngMan
Dim word As String
Dim GenWord As String
Dim guesscount As Integer = 1

Private Sub frmHngMan_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim oFile As System.IO.File
Dim oRead As System.IO.StreamReader
oRead = oFile.OpenText("C:\Users\michael.hudson\Documents\Visual Studio 2015\Projects\Hangman\Words.txt")
While oRead.Peek <> -1
word = oRead.ReadLine()
End While

pboFrame1.Visible = False
pboFrame2.Visible = False
pboFrame3.Visible = False
pboHead.Visible = False
pboBody.Visible = False
pboLeftArm.Visible = False
pboRightArm.Visible = False
pboLeftLeg.Visible = False
pboRightLeg.Visible = False

End Sub

Private Sub btnGenWord_Click(sender As Object, e As EventArgs) Handles btnGenWord.Click
GenWord = word
lblWord.Text = ""
Dim max As Integer
Dim i As Integer = 0
max = Len(GenWord)

'For i = 0 To max
'lblWord.Text = lblWord.Text + "A"
'i = i + 1
'Next

While i <> max
lblWord.Text = lblWord.Text + "| _ "
i = i + 1
End While
lblWord.Text = lblWord.Text + "|"

End Sub

Private Sub btnGuess_Click(sender As Object, e As EventArgs) Handles btnGuess.Click
GenWord = word
Dim guess As String
Dim n As Integer = 1
Dim max As Integer
guess = txtLetter.Text
max = Len(GenWord)

'For n = 1 To max
'If guess = Mid(GenWord, n, 1) Then
'Replace(lblWord.Text, Mid(lblWord.Text, n, 1), guess)
'End If
'n = n + 1
'Next

n = 1
While n <> max
If guess = Mid(GenWord, n, 1) Then
Replace(lblWord.Text, Mid(lblWord.Text, n + 2, 1), guess)
End If
n = n + 1
End While

If guess <> Mid(GenWord, n, 1) Then
lblGuesLet.Text = lblGuesLet.Text + guess + ", "
Select Case guesscount
Case 1
pboFrame1.Visible = True
Case 2
pboFrame2.Visible = True
Case 3
pboFrame3.Visible = True
Case 4
pboHead.Visible = True
Case 5
pboBody.Visible = True
Case 6
pboLeftArm.Visible = True
Case 7
pboRightArm.Visible = True
Case 8
pboLeftLeg.Visible = True
Case 9
pboRightLeg.Visible = True
End Select
guesscount = guesscount + 1
End If
txtLetter.Clear()

If guesscount > 9 Then
MessageBox.Show("You lose! Try again.")
End If

End Sub

Private Sub btnReset_Click(sender As Object, e As EventArgs) Handles btnReset.Click

Dim oFile As System.IO.File
Dim oRead As System.IO.StreamReader
oRead = oFile.OpenText("C:\Users\michael.hudson\Documents\Visual Studio 2015\Projects\Hangman\Words.txt")
While oRead.Peek <> -1
word = oRead.ReadLine()
End While

pboFrame1.Visible = False
pboFrame2.Visible = False
pboFrame3.Visible = False
pboHead.Visible = False
pboBody.Visible = False
pboLeftArm.Visible = False
pboRightArm.Visible = False
pboLeftLeg.Visible = False
pboRightLeg.Visible = False

lblWord.Text = ""
lblGuesLet.Text = ""
txtLetter.Clear()

guesscount = 1

End Sub
End Class
------------------------------------------------

Everything works as it should, apart from;
n = 1
While n <> max
If guess = Mid(GenWord, n, 1) Then
Replace(lblWord.Text, Mid(lblWord.Text, n + 2, 1), guess)
End If
n = n + 1
End While

I initially thought that after pressing the button the first time this loop hits its highest value and stays there, and doesn't reset to 1 when the button is pressed again (hence the n=1). However this has not fixed the problem, after using break points and all debugging tools I can see that all of the values and variables are correct and are picking up the correct values, however the Replace function does not work:mad:! If anyone has any idea why or what I can do to fix it I would greatly appreciate it!
Viewing all 263 articles
Browse latest View live




Latest Images