I'd even go so far and say that any proper text processing software has a word counting feature already. So you don't even need to download anything.Plu wrote:Why not just download an existing program that does just this?
help with the focus function
Re: help with the focus function
Check out my blog on gamedev
Re: help with the focus function
This is close to what I am trying to make, but I'm trying to make something he can use once when he needs it and turns off when he doesnt
^_^
Re: help with the focus function
Okay, since I gave you such a bad first answer (sorry about that ) I felt obliged to put more thought into it...
And I thought: why not have the program act as where they log the translation? So I put some thought into it, and came up with this:
I hope this works!
P.S.: I never got around to figuring out what the default text is called, but if you do, you can make it look better by changing
to
The one is so that it doesn't look so jumbled.
If you need to make it so that if his typing goes off the page it'll go to a new line I can do that for you.
Happy coding!
And I thought: why not have the program act as where they log the translation? So I put some thought into it, and came up with this:
Code: Select all
function love.load()
love.graphics.setBackgroundColor( 255, 125, 0 )
length = 0
text = {}
text[0] = {}
text[0].letter = ""
text[0].x = 100
text[0].y = 100
spaces = 0
end
function love.keypressed( key ) --unicode might be better if they use a foreign keyboard. Check out this site for unicode characters: http://en.wikipedia.org/wiki/List_of_Unicode_characters
if key == 'backspace' then
if length > 0 then
if text[length].letter == " " then
spaces = spaces - 1
if spaces < 0 then
spaces = 0
end
end
table.remove( text[length], text[length].key )
text[length].letter = ""
length = length - 1
end
if length < 0 then
length = 0
end
elseif key == 'delete' then
for i = 0, #text do
text = {}
text[0] = {}
text[0].letter = ""
text[0].x = 100
text[0].y = 100
spaces = 0
length = 0
end
elseif key == 'return' then
length = length + 1
text[length] = {}
text[length].letter = ""
text[length].x = text[0].x
text[length].y = text[length-1].y + 15
else
length = length + 1
text[length] = {}
text[length].letter = key
text[length].x = text[length - 1].x + 7
text[length].y = text[length - 1].y
if key == ' ' then
spaces = spaces + 1
end
end
end
function love.draw()
for i = 0, #text do
love.graphics.setColor( 255, 255, 255 )
love.graphics.print( text[i].letter, text[i].x, text[i].y )
end
love.graphics.setColor( 255, 255, 255 )
love.graphics.print( "Length: "..length.."", 650, 550 )
love.graphics.print( "Spaces: "..spaces.."", 725, 550 )
end
P.S.: I never got around to figuring out what the default text is called, but if you do, you can make it look better by changing
Code: Select all
text[length].x = text[length - 1].x + 7
Code: Select all
text[length].x = text[length-1].x + NAME:getWidth(text[length]) + 1
If you need to make it so that if his typing goes off the page it'll go to a new line I can do that for you.
Happy coding!
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
Re: help with the focus function
thank you davisdude, but all i need is a way to disable the focus function. is there a way to get into the love engine and disable it or i the config file?
that is all i need, the rest of it i can write myself.
that is all i need, the rest of it i can write myself.
^_^
Re: help with the focus function
Not that I know of. But why couldn't you just use Love itself AS the key logger? In the corner of my code it even displays how many times space has been pressed.
B.T.W.: If you end up using my code you can press delete to clear all of the text if you don't want to press backspace a bunch.
B.T.W.: If you end up using my code you can press delete to clear all of the text if you don't want to press backspace a bunch.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
Re: help with the focus function
i cant becouse when the love window is no longer in focus the program wont count. it just sites there mocking me... if i cant get it to work with love i may need to find another engine or languags to write it in.
^_^
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: help with the focus function
You need to find a low-level API if you want to write this yourself. It would depend on your brother's operating system which one. LÖVE itself only gets key events from SDL, which doesn't know about key presses that occur when its window is not in focus.
Help us help you: attach a .love.
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: help with the focus function
I know Java can do this. I've seen an app written in Java that records all your mouse movements in the background and draws a neat art image of your mousing throughout the day. If you really need to capture input in the background you might want to look into it.
If Java weren't so hard to learn for me I'd probably be using it instead. Lua's just so easy to understand coming from a QBASIC background.
If Java weren't so hard to learn for me I'd probably be using it instead. Lua's just so easy to understand coming from a QBASIC background.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 0 guests