• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

148 Neutral

About ConorH

  • Rank
  1. if I have const bool foo = false if ( foo && ExpensiveCall() ) { DoStuff() } Will VS2008 see foo as false at compile time, and have the resulting code never call ExpensiveCall() when it gets to that particular if statement?
  2. I did wonder how VB handled that, but it didnt help. Any other ideas? Cheers
  3. Im having trouble implementing a Mergesort routine on a List in VB.net. It sorts the first time, but subsequent sorts reduce the list size. This might just be because Im translating pseudocode. Im more suited to C++ so could someone give this a quick glance and tell me where Im going wrong? The site im using for reference http://www.codecodex.com/wiki/Merge_sort#Pseudocode Chars Public Function mergesort(ByVal m As List(Of Customer)) Dim left As New List(Of Customer) Dim right As New List(Of Customer) Dim middle As Integer Dim aftermiddle As Integer Dim result As New List(Of Customer) If m.Count < 2 Then 'Already sorted Return m Else 'Sort here middle = (m.Count - 1) / 2 aftermiddle = middle + 1 For t = 0 To middle left.Add(m(t)) Next t For y = aftermiddle To m.Count - 1 right.Add(m(y)) Next y left = mergesort(left) right = mergesort(right) result = merge(left, right) Return result End If End Function Function merge(ByVal l As List(Of Customer), ByVal r As List(Of Customer)) Dim result As New List(Of Customer) While l.Count > 0 And r.Count > 0 If l(0).Name <= r(0).Name Then result.Add(l(0)) l.RemoveAt(0) Else result.Add(r(0)) r.RemoveAt(0) End If End While If l.Count > 0 Then result.Add(l(0)) l.RemoveAt(0) End If If r.Count > 0 Then result.Add(r(0)) r.RemoveAt(0) End If Return result End Function
  4. Those are the parent directory ".." and the other is something like that as well but I cant remember what it is. put "dir" into command prompt and youll see what I mean. "cd .." takes you to the parent folder
  5. Unity SDL memory problem

    or if you made TTF_Font* font = TTF_OpenFont(); to: static TTF_Font* font = TTF_OpenFont();
  6. SDL/Opengl transparency

    glEnable(GL_BLEND); Yeah I am
  7. When loading an image into SDL, are there any things I need to do special because I cant set transparency with glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); nothing appears if i use the above. So, I use: glBlendFunc(GL_ONE,GL_ONE); Should I be doing anything different when loading. On windows, using vc++ 2005 EE, sdl 1.2 w/sdl_image
  8. www.72dpiarmy.com Theres a section on 2D scrollers with just what youre looking for. I wish he'd rekindle that tutorial series
  9. Cos/Sin problems

    my bad, but even with this ammended code, its moving in weird directions
  10. Cos/Sin problems

    From wikipedia Conversion between radians and degrees As stated above, one radian is equal to 180/&#960; degrees. Thus, to convert from radians to degrees, multiply by 180/&#960;.
  11. Cos/Sin problems

    Im trying to move my sprites around screen by giving them angles. My code is: int Physics::CalcX(int x,float ang, int vel) { ang=(180 / 3.1415926535897932) * ang; float scalex=sin(ang); float xvel = scalex * vel ; x+=xvel; return x; } int Physics::CalcY(int y,float ang, int vel) { ang=(180 / 3.1415926535897932) * ang; float scaley=cos(ang); float yvel = scaley * vel; y+=yvel; return y; } The angles given are always 0,90,180 or 270, but the sprites seem to move in arbitrary directions. Is there anything im obviously doing wrong?
  12. Cheers, that worked. I did public DB as New Database Do I have to instantiate all my vars in VB? Im familiar with c++ so does VB have constructors? I know i could Google but thats at least 4 clicks away
  13. Dim temp As Entry temp = New Entry temp.Surname = TextBox_AddSurname.Text temp.Address1 = TextBox_AddAdd1.Text temp.Address2 = TextBox_AddAdd2.Text temp.PostCode = TextBox_AddPC.Text temp.PhoneNum = TextBox_AddPN.Text temp.InvoiceNum = TextBox_AddIN.Text temp.InstallNum = TextBox_AddIsN.Text temp.Windows = 1 temp.Doors = 1 DB.Entries.Add(temp) Iv tried to add an object to my Arraylist, but it tells me the refernce isnt set to an object. The compiler tells me to use the New keyword, which Im doing. What am I doing wrong?

    Depends what your Libs your using, but I think that jnrdev (that link) covers it in the pixel perfect bit. Unfortunately he doesnt have any source code up atm

    check this http://jnrdev.72dpiarmy.com/en/jnrdev5/
  • Advertisement