Jump to content


Photo
* * * * * 1 votes

Text Editor Example - 400+ Downloads!


  • Please log in to reply
38 replies to this topic

#21 MudbudGoldfish

MudbudGoldfish

    Indie Game Dev Team

  • New Member
  • 494 posts
  • Version:GM8

Posted 27 April 2011 - 06:34 PM

- Change the color of selected text.
- Change the font of selected text.
- Change the size of selected text.

And now?

---Sorry for short message, I not speak english.


why not just do that yourself?Posted Image
  • 0

#22 peter henry

peter henry

    GMC Member

  • GMC Member
  • 70 posts

Posted 27 April 2011 - 10:07 PM

I don't know.
Davve, can you make it?

Bye!

Edited by peter henry, 27 April 2011 - 10:07 PM.

  • 0

#23 Davve

Davve

    Procrastinator

  • GMC Member
  • 3665 posts
  • Version:GM8.1

Posted 28 April 2011 - 07:17 AM

I don't know.
Davve, can you make it?

Bye!

Well, you'll have to use an array which holds the colors for each character in the text. Shouldn't be that hard to implement, maybe I'll add it if I get the time.

Edited by Davve, 28 April 2011 - 12:35 PM.

  • 0

#24 peter henry

peter henry

    GMC Member

  • GMC Member
  • 70 posts

Posted 28 April 2011 - 03:01 PM

Ok.
Thank you.
  • 0

#25 AndrewB

AndrewB

    Kibbles and bits

  • New Member
  • 336 posts
  • Version:GM8

Posted 28 April 2011 - 04:57 PM

Well, you'll have to use an array which holds the colors for each character in the text. Shouldn't be that hard to implement, maybe I'll add it if I get the time.


You won't need to do that. You could use formatting in the string. Run through the string and when you come across something like, "/c", read the next 3 characters as bytes and convert that to an RGB color, then just set the drawing color.

This is how I do it. :)
  • 0

#26 busylop

busylop

    GMC Member

  • New Member
  • 50 posts

Posted 04 May 2011 - 01:04 PM

Yes! exactly what i wanted! Thnx.
  • 0

#27 peter henry

peter henry

    GMC Member

  • GMC Member
  • 70 posts

Posted 07 May 2011 - 12:04 AM

I am waiting.
:rolleyes:

FLW
  • 0

#28 AndrewB

AndrewB

    Kibbles and bits

  • New Member
  • 336 posts
  • Version:GM8

Posted 07 May 2011 - 10:44 AM

@peter henry Are you waiting for someone to make you an example on formatted text?
  • 0

#29 Davve

Davve

    Procrastinator

  • GMC Member
  • 3665 posts
  • Version:GM8.1

Posted 07 May 2011 - 10:52 AM

Looks like he is.
  • 0

#30 AndrewB

AndrewB

    Kibbles and bits

  • New Member
  • 336 posts
  • Version:GM8

Posted 07 May 2011 - 12:09 PM

I actually got a semi working color formatting version working, the only thing I have to do now is make it when removing text that the colors aren't affected. I guess it'll not be too hard...
  • 0

#31 BKSalmon

BKSalmon

    GMC Member

  • New Member
  • 2 posts

Posted 13 August 2011 - 01:34 PM

Hello everyone, I'm new here.

I've been tinkering with this for a little while now and I'm curious: Does anybody know a method for getting the lines to stop? Like if I wanted to make a text box limited to say 10 lines, how would I go about that? I've been plugging away at this for 6 hours and I got the word wrapping to work just how I want, but the line limitations just completely escapes me. I love the text editor though it's EXACTLY what I've been looking for. Thanks much for everyone's time.
  • 0

#32 Davve

Davve

    Procrastinator

  • GMC Member
  • 3665 posts
  • Version:GM8.1

Posted 13 August 2011 - 01:48 PM

Hello everyone, I'm new here.

I've been tinkering with this for a little while now and I'm curious: Does anybody know a method for getting the lines to stop? Like if I wanted to make a text box limited to say 10 lines, how would I go about that? I've been plugging away at this for 6 hours and I got the word wrapping to work just how I want, but the line limitations just completely escapes me. I love the text editor though it's EXACTLY what I've been looking for. Thanks much for everyone's time.

First, replace line 67 in the step event with this (Replace NUMBEROFLINES with the maximum number of lines to allow):
while (string_length(keyboard_string)>0 && string_count(chr(10),typing_string)<NUMBEROFLINES) {
And then add this between line 80 and 81:
keyboard_string=""

  • 0

#33 BKSalmon

BKSalmon

    GMC Member

  • New Member
  • 2 posts

Posted 13 August 2011 - 02:03 PM


Hello everyone, I'm new here.

I've been tinkering with this for a little while now and I'm curious: Does anybody know a method for getting the lines to stop? Like if I wanted to make a text box limited to say 10 lines, how would I go about that? I've been plugging away at this for 6 hours and I got the word wrapping to work just how I want, but the line limitations just completely escapes me. I love the text editor though it's EXACTLY what I've been looking for. Thanks much for everyone's time.

First, replace line 67 in the step event with this (Replace NUMBEROFLINES with the maximum number of lines to allow):
while (string_length(keyboard_string)>0 && string_count(chr(10),typing_string)<NUMBEROFLINES) {
And then add this between line 80 and 81:
keyboard_string=""


You my friend, are my hero of the day! Thanks so much haha! It worked spot on.
  • 0

#34 ihato

ihato

    Destroyed

  • Banned Users
  • 739 posts
  • Version:GM8

Posted 13 August 2011 - 04:13 PM

<Post Destroyed>

Edited by ihato, 22 August 2011 - 12:20 PM.


#35 AlexTM

AlexTM

    GMC Member?

  • GMC Member
  • 1421 posts
  • Version:GM8

Posted 13 April 2012 - 07:35 AM

Its laggy when using alot of text.. But good example!

Edited by A!ex, 13 April 2012 - 07:42 AM.

  • 0

#36 mrsmes

mrsmes

    GMC Member

  • GMC Member
  • 972 posts
  • Version:Unknown

Posted 13 April 2012 - 08:48 AM

yes that all seems handy but how would i go about making multiple text fields?
  • 0

#37 Davve

Davve

    Procrastinator

  • GMC Member
  • 3665 posts
  • Version:GM8.1

Posted 17 May 2012 - 10:21 PM

yes that all seems handy but how would i go about making multiple text fields?

Create more instances of the object?

Edit: But then you'd have to write some extra code to only make the user be able to type in one box at a time, which shouldn't be too hard.

Edited by Davve, 17 May 2012 - 10:22 PM.

  • 0

#38 Craig Davidson

Craig Davidson

    GMC Member

  • GMC Member
  • 120 posts

Posted 27 May 2012 - 11:47 PM

Sonica2, I tried your wrapping code, but there is a new problem. Whenever I paste some text from the clipboard, the program, divides the line into a single character per line column. This only seems to happen if there is nothing on the new line. Is there some way I can fix this, because it's really problematic.

Edited by Craig Davidson, 28 May 2012 - 12:14 AM.

  • 0

#39 Lordfef

Lordfef

    GMC Member

  • GMC Member
  • 163 posts
  • Version:GM:Studio

Posted 18 September 2012 - 07:35 PM

hi, i'm tryng this example. Can anyone tell me how to save the text in a variabile?

thank's
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users