Advertisement Jump to content
  • Advertisement

Del Snd of Thndr

  • Content Count

  • Joined

  • Last visited

Community Reputation

190 Neutral

About Del Snd of Thndr

  • Rank
  1. Quote:Original post by Khaos Dragon Without Tao, would I have to individually wrap each opengl function into dll that could be loaded from my c# app? You could also use [DllImport] statements from within your C# project. This is how Tao works, IIRC (it's been awhile). However, I would definitely recommend using Tao, as making all those statements would be a pretty tall order; there are a lot of them. Plus, Tao already offers a nice control that would take considerable time to re-invent; this is true for me at least. Is there some reason that you do not want to use Tao? If it's something you hold against Tao, you could always use the C# basecode from NeHe, though it isn't nearly as complete or correct, at least of the time I last used it. If this is what you want, just look for the link on one of the sidebars on the left side of the page. At any rate, I would try to use some existing solution because wrapping the OpenGL library would probably take considerable time. And I'm lazy.
  2. Del Snd of Thndr

    [.net] Problem with syntax highlighting

    I think the following line is the cause of the headache: .Select(match.Index, match.Length) It returns the index into the string that you matched against, not the character index in the text box; you would always select the index into the RichTextBox text instead of going to the line and then indexing into it. Here is some code that does it for you (and it gets rid of the annoying flickering [smile]) Hope this helps. Imports System.Text Imports System.Text.RegularExpressions Public Class Form1 Dim textColor As Color = Color.Black Dim syntaxColor As Color = Color.Blue Dim keywords() As String = {"apple", "orange", "grape", "pear", "banana"} ' this is used to prevent the flickering from all the selecting and deselecting Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Integer) As Integer Private Sub RichTextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged LockWindowUpdate(RichTextBox1.Handle) Dim selectionStart As Integer = RichTextBox1.SelectionStart ' stores the caret position Dim firstCharIndex = RichTextBox1.GetFirstCharIndexOfCurrentLine() Dim lineNumber As Integer = RichTextBox1.GetLineFromCharIndex(firstCharIndex) Dim currentLine As String = RichTextBox1.Lines(lineNumber) ' first, make sure that the entire line is set to the text color RichTextBox1.Select(firstCharIndex, currentLine.Length) RichTextBox1.SelectionColor = textColor ' build a regular expression string that contains all the keywords Dim builder As StringBuilder = New StringBuilder() For i As Integer = 0 To keywords.Length - 1 If i > 0 Then builder.Append("|") End If builder.Append("\b" + keywords(i) + "\b") Next ' get each of the matches and set the text color to the syntaxColor value Dim matches As MatchCollection = Regex.Matches(currentLine, builder.ToString(), RegexOptions.IgnoreCase) For i As Integer = 0 To matches.Count - 1 With RichTextBox1 .Select(firstCharIndex + matches(i).Index, matches(i).Length) .SelectionColor = syntaxColor .SelectionStart = firstCharIndex + matches(i).Index + matches(i).Length .SelectionColor = textColor End With Next ' set the caret back to its starting position RichTextBox1.SelectionStart = selectionStart LockWindowUpdate(0) End Sub End Class If you have any questions, feel free to drop me a line.
  3. Del Snd of Thndr

    [.net] how do you return a ref from a function

    Take a look at the ref and out keywords. The decision between which is used is more or less the context in which you are going to use it. ref requires that the referenced variable be initialized, whereas out does not. In the call to the function, be sure to use whichever keyword you deemed appropriate (it should match the one in the function definition). The variable is then passed by reference. The examples on the two pages should be enough to get you going. HTH.
  4. Del Snd of Thndr

    dx multi threading and input

    I think you need to poll your device before calling GetKeyboardState. See IDirectInputDevice8::Poll in the DX docs (or by clicking here). HTH.
  5. I'm not sure if this is what you are looking for, but check here. I've used this before - it's pretty straightforward to use. HTH
  6. Del Snd of Thndr

    [.net] Consequences of making M34 negative...?

    Well, at least now I know. Thanks a lot for the reply. :)
  7. At work, we're developing a data visualization program based on the Earth. The data comes to us in a right-handed coordinate system, and we want to display the data in our Earth scene. The decision has already been made to use Managed DirectX to build our "engine." (I use the term very loosely.) However, it's kinda tough to think about plotting data from a right-handed coordinate system inside a left-handed one (at least for me, anyway!), so we have a small predicament on our hands. One idea being researched is drawing everything using the *RH functions (half of us were OpenGL programmers..). The other is converting data to a left-handed system, then plotting it (something I'm not necessarily opposed to). So we drew the Earth using a right-handed system, set the CullMode to CW, the works. However, in doing so, we ended up making M34 in the projection matrix negative. The MDX documentation says the following: In Microsoft Direct3D, the M34 element of a projection matrix cannot be a negative number. If an application needs to use a negative value in this location, it should scale the entire projection matrix by -1 instead. We didn't see any immediate consequences to doing this, but we're trying to make sure that everything is kosher before moving in that direction. Does anyone know the consequences of this? Please note that I didn't write the code, so I might have some of the facts wrong, but the question is right, this much I am sure. If I have some info wrong, please forgive my ignorance. Thanks in advance for your help.
  8. Del Snd of Thndr

    [.net] My game works on no computer

    This is a stab in the dark, but did you install DirectX with Managed Extensions on the machine? This has been a source of a lot of our nightmares on our senior project at school (9.0c installed, but not the managed extentions...bah!). See this page for more info. It's an older page, but the first one I ran across when I went to look. HTH Edit: BTW, we got the FileIOException when we tried to run on the school machines, which is how we knew it wasn't there.
  9. Me too. I can't wait to get my hands on it; it looks great!
  10. Del Snd of Thndr

    WindowMessage object in C#

    You don't need to connect to Microsoft.Win32. Just put the Message struct and DllImport function definition in a class called "NativeMethods." That should do the trick. [smile]
  11. Del Snd of Thndr

    WindowMessage object in C#

    There was a thread around here at one point that addressed this issue, but I can't for the life of me remember when I saw it. If you change WindowMessage to uint, it should work okay for you. Someone here ('s in Google cache), even said that changing it to Int32 seemed to work without any problems (I guess you would use this if you wanted to write CLS-compliant code). HTH!
  12. Del Snd of Thndr

    can i get some help with C# and DirectX 3D?

    To quote a Dilbert comic discussing Catbert's horrible customer service: "It works fine on my machine." In the past, I have had some problems with the IDE "forgetting" all the Intellisense information in the middle of writing a file...and this happened while I was writing an MDX program, oddly enough. A quick restart of the IDE solved all my problems then. If you haven't restarted it since the problem cropped up, I would recommend trying that. (If you have, let us know and we'll try something else. [smile]) A couple of other hints: you can use plain old HTML to post links, and you can use [_source lang="c#"][_/source] (just remove the underscores) to post your code in some nice boxes with syntax highlighting and everything. =) HTH!
  13. I'm not sure how to do this from the IDE itself, but you can easily edit your *.csproj file. All you have to do is open it up with Notepad and find the line that looks like this: <Compile Include="cGraphics.cs" /> Just change this line to look like: <Compile Include="cGraphics.cs"> <DependentUpon>cFleurin.cs</DependentUpon> </Compile> Now repeat the process with cInput.cs. If you do this while the IDE is open, it will let you know that the *.csproj file has been edited outside the environment, and it will ask you if you wish to reload it. Say yes, and you'll see that the two files now hang from cFleurin.cs. This method isn't the easiest, but it gives you a peek inside your project files (you can read the solution files just the same!) and kind of give you an inside look at what all the environment uses. This, I think at least, is pretty cool. HTH!
  14. Del Snd of Thndr

    OO Design Question

    Thanks for the speedy responses. I've implemented both and am much happier with the result.
  15. Del Snd of Thndr

    OO Design Question

    I'm currently working through Introduction to 3D Game Engine Design Using DirectX9 and C#, by Lynn Harris, and I have a question about a design decision that he evidently made for the book. In the book, he creates a heirarchy of classes that comprise a game engine for an outdoor racing game. The highest level class I have seen thus far is GameEngine, and it contains variables representing many of the other classes created throughout the book. SplashScreen is an example, and it is its Render function about which I have questions. The Render function performs several tasks, such as enabling fog, setting textures, etc. For these tasks, it is obvious that one would need a reference to a Direct3D.Device. In the book, Lynn creates a property in GameEngine that returns that Device, and SplashScreen.Render uses this property heavily. This translates into SplashScreen "knowing" about the higher-level class GameEngine. To me, this seems wrong. I can only think of one way that I would feel better about the OO design, and that would be to pass a reference of the device (through constructor parameters or a property) to the class, and leave the class ignorant of any class that may use it. OO Design is something with which I really struggle, and I want to get this right. So I ask, which approach, if either, is better and why? If both approaches have flaws, what is another approach? I really appreciate your help.
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!