Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Fullscreen text editor using SFML  (Read 1895 times)

0 Members and 1 Guest are viewing this topic.

tobek123

  • Newbie
  • *
  • Posts: 1
    • View Profile
Fullscreen text editor using SFML
« on: December 15, 2010, 06:25:58 pm »
Hello.

I am trying to create a fullscreen minimalistic text editor (by minimalistic I mean having only a blinking caret, black background, keyboard control by arrows to move around the text, backspace delete, etc. and that's it). I have created a RenderWindow, I have a global string buffer for text and I am using String2D class to visualize it on screen(I am developing it in C# using VC2010 and SFML .NET package).

Basicaly what I do is catching keystrokes, checking if they come from letters, digits or any other written symbols useful in writting and add or subtract them from the string buffer which is permanently visualised on-screen using RenderWindow's draw.

Now the problem is, how can I implement the correct caret movement if somebody would like to let's say move around the whole screen of text using down/up/left/right arrow. For left right in one line it is easy but eventualy I am gonna have to break lines where screen ends and what then, how can I correctly "discover" where to render the caret if somebody wants to go line down or up and how to know which position it is in string because somebody could add or delete a portion of text afterwards. Or maybe my approach is completely wrong ? Please advise.