µLua DS - Forum officiel | Official forum Forum Index

µLua DS - Forum officiel | Official forum
Le bon endroit pour en savoir plus sur MicroLua et pour parler de vos projets ! | The right place to learn more about MicroLua and talk about your projects !

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

gros bug clavier

 
Post new topic   Reply to topic    µLua DS - Forum officiel | Official forum Forum Index -> Section française -> Report de bugs
Previous topic :: Next topic  
Author Message
killer01


Offline

Joined: 04 Oct 2008
Posts: 545

PostPosted: Mon 10 Nov 2008 - 17:45    Post subject: gros bug clavier Reply with quote

quand j'utilise la fonction keyboard et que je valide mon texte le clavier ne s'éfface pas de la mémoire (l'image) donc sa prend toute la mémoire et les claviers sont inutilisables... donca  changer pasque pour l'instant on ne peux pas faire taper du texte par l'utilisateur si on a pas un clavier perso genre lua éditor...

Back to top
Publicité






PostPosted: Mon 10 Nov 2008 - 17:45    Post subject: Publicité

PublicitéSupprimer les publicités ?
Back to top
Risike
Administrateur

Offline

Joined: 26 Aug 2008
Posts: 362
Localisation: Nancy (54)

PostPosted: Wed 12 Nov 2008 - 10:50    Post subject: gros bug clavier Reply with quote

Voilà la librairie clavier modifiée, insère la dans ton code avec un dofile

Code:
Keyboard = {}
Keyboard.mapKeyboardKeys = {
{"1", "!", 5, 3, 19, 17},
{"2", "@", 21, 3, 35, 17},
{"3", "#", 37, 3, 51, 17},
{"4", "$", 53, 3, 67, 17},
{"5", "%", 69, 3, 83, 17},
{"6", "^", 85, 3, 99, 17},
{"7", "&", 101, 3, 115, 17},
{"8", "*", 117, 3, 131, 17},
{"9", "(", 133, 3, 147, 17},
{"0", ")", 149, 3, 163, 17},
{"-", "_", 165, 3, 179, 17},
{"=", "+", 181, 3, 195, 17},
{"=", "+", 181, 3, 195, 17},
{"q", "Q", 13, 19, 27, 33},
{"w", "W", 29, 19, 43, 33},
{"e", "E", 45, 19, 59, 33},
{"r", "R", 61, 19, 75, 33},
{"t", "T", 77, 19, 91, 33},
{"y", "Y", 93, 19, 107, 33},
{"u", "U", 109, 19, 123, 33},
{"i", "I", 125, 19, 139, 33},
{"o", "O", 141, 19, 155, 33},
{"p", "P", 157, 19, 171, 33},
{"##BACKSPACE", "##BACKSPACE", 173, 19, 195, 33},
{"##CAPS", "##CAPS", 5, 35, 19, 49},
{"a", "A", 21, 35, 35, 49},
{"s", "S", 37, 35, 51, 49},
{"d", "D", 53, 35, 67, 49},
{"f", "F", 69, 35, 83, 49},
{"g", "G", 85, 35, 99, 49},
{"h", "H", 101, 35, 115, 49},
{"j", "J", 117, 35, 131, 49},
{"k", "K", 133, 35, 147, 49},
{"l", "L", 149, 35, 163, 49},
{"\n", "\n", 169, 35, 195, 49},
{"##SHIFT", "##SHIFT", 5, 51, 27, 65},
{"z", "Z", 29, 51, 43, 65},
{"x", "X", 45, 51, 59, 65},
{"c", "C", 61, 51, 75, 65},
{"v", "V", 77, 51, 91, 65},
{"b", "B", 93, 51, 107, 65},
{"n", "N", 109, 51, 123, 65},
{"m", "M", 125, 51, 139, 65},
{",", "<", 141, 51, 155, 65},
{".", ">", 157, 51, 171, 65},
{"/", "?", 173, 51, 187, 65},
{";", ":", 37, 67, 51, 81},
{"'", "~", 53, 67, 67, 81},
{" ", " ", 69, 67, 147, 81},
{"[", "{", 149, 67, 163, 81},
{"]", "}", 165, 67, 179, 81}
}
Keyboard.color = {}
Keyboard.color.gray = "gray"
Keyboard.color.blue = "blue"
Keyboard.color.red = "red"
Keyboard.color.green = "green"
Keyboard.color.yellow = "yellow"
Keyboard.input = function(maxLength, KBColor, KBColorPressed, colorBgUp, colorBgDown, colorTextUp, colorTextDown)
assert(maxLength > 0, "Max lenght must be > 0")
assert(KBColor ~= nil , "You must choose a keyboard color")
assert(KBColorPressed~= nil , "You must choose a second keyboard color")
assert(colorBgUp ~= nil, "Color can't be null")
assert(colorBgDown ~= nil, "Color can't be null")
assert(colorTextUp ~= nil, "Color can't be null")
assert(colorTextDown ~= nil, "Color can't be null")
local imgKB = Image.load("/lua/libs/images/keyboard/"..KBColor..".png", VRAM)
local imgKBPressed = Image.load("/lua/libs/images/keyboard/"..KBColorPressed..".png", VRAM)
local tmrCursor = Timer.new()
tmrCursor:start()
local capsOn = false
local text = ""
local X_KEYBOARD = 27
local Y_KEYBOARD = 10
local pressedKeyIndex = nil
local shift = 0

local scanPressedKey = function()
pressedKeyIndex = nil
for i=1, table.getn(Keyboard.mapKeyboardKeys) do
if Stylus.X >= Keyboard.mapKeyboardKeys[i][3]+X_KEYBOARD and Stylus.X <= Keyboard.mapKeyboardKeys[i][5]+X_KEYBOARD and Stylus.Y >= Keyboard.mapKeyboardKeys[i][4]+Y_KEYBOARD and Stylus.Y <= Keyboard.mapKeyboardKeys[i][6]+Y_KEYBOARD then
pressedKeyIndex = i
if capsOn then
screen.blit(SCREEN_DOWN, X_KEYBOARD+Keyboard.mapKeyboardKeys[i][3], Y_KEYBOARD+Keyboard.mapKeyboardKeys[i][4], imgKBPressed, Keyboard.mapKeyboardKeys[i][3], 86+Keyboard.mapKeyboardKeys[i][4], Keyboard.mapKeyboardKeys[i][5] - Keyboard.mapKeyboardKeys[i][3], Keyboard.mapKeyboardKeys[i][6] - Keyboard.mapKeyboardKeys[i][4])
else
screen.blit(SCREEN_DOWN, X_KEYBOARD+Keyboard.mapKeyboardKeys[i][3], Y_KEYBOARD+Keyboard.mapKeyboardKeys[i][4], imgKBPressed, Keyboard.mapKeyboardKeys[i][3], Keyboard.mapKeyboardKeys[i][4], Keyboard.mapKeyboardKeys[i][5] - Keyboard.mapKeyboardKeys[i][3], Keyboard.mapKeyboardKeys[i][6] - Keyboard.mapKeyboardKeys[i][4])
end
break
end
end
end
Controls.read()
while not Keys.newPress.Start do
Controls.read()

startDrawing()
screen.drawFillRect(SCREEN_UP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, colorBgUp)
screen.drawFillRect(SCREEN_DOWN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, colorBgDown)

-- Draw keyboard
if capsOn then
screen.blit(SCREEN_DOWN, X_KEYBOARD, Y_KEYBOARD, imgKB, 0, 86, 202, 86)
else
screen.blit(SCREEN_DOWN, X_KEYBOARD, Y_KEYBOARD, imgKB, 0, 0, 202, 86)
end

if Stylus.held then
scanPressedKey()
end
if Stylus.newPress and pressedKeyIndex ~= nil then
if string.sub(Keyboard.mapKeyboardKeys[pressedKeyIndex][1], 1, 2) ~= "##" then
if not capsOn then
text = text..Keyboard.mapKeyboardKeys[pressedKeyIndex][1]
else
text = text..Keyboard.mapKeyboardKeys[pressedKeyIndex][2]
end
else
if Keyboard.mapKeyboardKeys[pressedKeyIndex][1] == "##BACKSPACE" and string.len(text) ~= 0 then
text = string.sub(text, 1, string.len(text)-1)
end
if Keyboard.mapKeyboardKeys[pressedKeyIndex][1] == "##CAPS" then
capsOn = not capsOn
end
if Keyboard.mapKeyboardKeys[pressedKeyIndex][1] == "##SHIFT" then
if shift == 0 then
shift = 2
else
shift = 0
capsOn = false
end
end
end
if shift > 0 then
shift = shift - 1
capsOn = true
if shift <= 0 then capsOn = false end
end
pressedKeyIndex = nil
end

if string.len(text) > maxLength then text = string.sub(text, 0, string.len(text) - 1) end
screen.drawTextBox(SCREEN_UP, 8, 8, 240, 176, text, colorTextUp)
screen.print(SCREEN_DOWN, 70, 150, "[START]: Validate", colorTextDown)
stopDrawing()
end

Image.destroy(imgKB)
imgKB = nil
Image.destroy(imgKBPressed)
imgKBPressed = nil
return text

end
 

_________________
Qu'est-ce que tu bois ? Du blanc !
Mais ça compte pas le blanc !


Back to top
killer01


Offline

Joined: 04 Oct 2008
Posts: 545

PostPosted: Wed 12 Nov 2008 - 18:43    Post subject: gros bug clavier Reply with quote

je peux la renommer keyboard.lua et remplacer l'ancienne par celle la ou sa va buguer?

Back to top
Risike
Administrateur

Offline

Joined: 26 Aug 2008
Posts: 362
Localisation: Nancy (54)

PostPosted: Thu 13 Nov 2008 - 09:10    Post subject: gros bug clavier Reply with quote

Non ça ira mais quand tu vas distribuer ton jeu tu ne va pas imposer aux utilisateurs d'aller bidouiller les librairies système... ça craint non ?
_________________
Qu'est-ce que tu bois ? Du blanc !
Mais ça compte pas le blanc !


Back to top
killer01


Offline

Joined: 04 Oct 2008
Posts: 545

PostPosted: Thu 13 Nov 2008 - 21:00    Post subject: gros bug clavier Reply with quote

oui mais il faudra prévoir pour la nouvelle version de microlua une mise a jour de cette librairie, la sa fait écrire 50 ligne a la place d'une ligne^^
ce serait peut être l'occasion de sortir un v 2.1 béta , si d'autre bug sont corrigés et si il y a déja des ajouts de prêt^^


Back to top
Display posts from previous:   
Post new topic   Reply to topic    µLua DS - Forum officiel | Official forum Forum Index -> Section française -> Report de bugs All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  

Index | Create a forum | Free support forum | Free forums directory | Report a violation | Cookies | Charte | Conditions générales d'utilisation
Powered by phpBB © 2001, 2005 phpBB Group