any idea for make simple text input in LOVE?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
baby_nux
Prole
Posts: 25
Joined: Fri Mar 04, 2011 3:21 pm

Re: any idea for make simple text input in LOVE?

Post by baby_nux »

Robin wrote:Don't think that is simpler. A terminal text input has much more features than a simple text input. You need to worry about scrolling text etc.
hahaha, hell yeah... i dont even know how to put blinked text cursor on it. :cry:
this is like draw a terminal text from graphical mode display ( not from a real text mode display ).
User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: any idea for make simple text input in LOVE?

Post by miko »

baby_nux wrote:
Robin wrote:Don't think that is simpler. A terminal text input has much more features than a simple text input. You need to worry about scrolling text etc.
hahaha, hell yeah... i dont even know how to put blinked text cursor on it. :cry:
this is like draw a terminal text from graphical mode display ( not from a real text mode display ).
I would suggest making simple GUI objects, then (if you get some experience) refactor this to a unified set of libraries with a common API.

You seem to be mixing lower-level (SDL, OpenGL) with higher-level (wxWindows) API, so you really need to get some experience here. For SDL (and love), you need to prepare and draw every single frame of your application. With wxWindows, all this is hidden away from you.

I would throw away your BASIC code - it looks awful :( you can really do it better in lua. I would start with designing API (write your main.lua first), then implementing it (add methods to TextInput.lua).
I am attaching a sample for you. It has no comments, but I will leave it for you as an exercise to understand how and why it works.
Attachments
TextInputExample.love
(2.17 KiB) Downloaded 274 times
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
User avatar
baby_nux
Prole
Posts: 25
Joined: Fri Mar 04, 2011 3:21 pm

Re: any idea for make simple text input in LOVE?

Post by baby_nux »

miko wrote:I would suggest making simple GUI objects, then (if you get some experience) refactor this to a unified set of libraries with a common API.

You seem to be mixing lower-level (SDL, OpenGL) with higher-level (wxWindows) API, so you really need to get some experience here. For SDL (and love), you need to prepare and draw every single frame of your application. With wxWindows, all this is hidden away from you.

I would throw away your BASIC code - it looks awful :( you can really do it better in lua. I would start with designing API (write your main.lua first), then implementing it (add methods to TextInput.lua).
I am attaching a sample for you. It has no comments, but I will leave it for you as an exercise to understand how and why it works.
many thanks, that help me a lot. i will try my best :awesome:
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 7 guests