1

I need to do simple game console - like from Quake, Counter-Strike or other games for simple 3D game using openGL and C#. Just press button for example ~ and it will show the console. I can write my commands in it and it will have effect on my application. For example it will change value of some variable or call some method from my application. Console should be in left top corner of the window. It's just window application(no full screen). Have somebody any idea how to do it? Piece of code - how to draw the the console or some tutorial? Thanks a lot.

user1097772
  • 3,499
  • 15
  • 59
  • 95
  • For this forum, you have to ask specific programming related questions. Please try it yourself (search, implement) and ask questions when you are stuck. Alternatively go to gamedev.stackexchange.com. – Constantinius Dec 14 '11 at 13:01
  • What do you need the console for exactly? If you are going to do it with opengl, you need to write a simple GUI or use a GUI Toolkit. Writing it by yourself is not that hard, but you need some experience with OpenGL and C# of course. – Skalli Dec 14 '11 at 13:47
  • I´m student we have to do a simple 3D game in openGl. I don´t have much experiences with C#, I don't have much experiences with OpenGl, we did just some basic programs - like drawing triangles, textures, lighting ... I don't have time to get more experience. We learnt just basic principes of computer graphic but nothing about OpenGL. I'm used to write programs in java - few years and C# is quite similar so it's not big problem. One of my concrete problem is the console I mentioned, I have no idea where to start ... we have to learn everything on internet :/ – user1097772 Dec 14 '11 at 18:49
  • 1
    @user1097772: If you're a student, then your teachers must be teaching you something about 3D graphics, C#, and so forth. Otherwise, expecting you to magically acquire this knowledge would be admitting that the teachers don't want to do their jobs. In any case, Stack Overflow isn't the place to ask these kinds of open-ended questions. It's for specific problems, not "I need to implement complex system X: how do I do that?" – Nicol Bolas Dec 14 '11 at 22:48
  • Possible duplicate of [How to do OpenGL live text-rendering for a GUI?](http://stackoverflow.com/questions/2071621/how-to-do-opengl-live-text-rendering-for-a-gui) C# bindings are by far the easy part ;-) – Ciro Santilli OurBigBook.com May 01 '16 at 09:23

1 Answers1

1

Text Editing is difficult in Open GL. It isn't something you want to start off with. C# has text fields and rich text windows. The simplest way would be to create a Window with a TextField inside it in C#. When the user pressed ~ slide the window in and give it focus. When the user presses enter any text in the field is captured, the field is cleared, and the captured text is sent off to the game to be processed.

To give the full console feel you want to make re-print that entered text back out in. You can do that with another, non-editable text field above the first on. Just concat the recently entered string on the end of text already entered in that field.

I would not recommend starting with this. Get something on the screen, get it responding to the keyboard directly. Then worry about how you are going to have you debug data entered. For now you can just hardcode debug commands to random keys that you don't user for your control scheme.

TurqMage
  • 3,321
  • 2
  • 31
  • 52