This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
MindenCucc's profile picture

[CC 1.48+][WIP] ASD-Board touchscreen QWERTY keyboard API

Started by MindenCucc, 22 March 2013 - 08:29 AM
MindenCucc #1
Posted 22 March 2013 - 09:29 AM

ASD-Board

Touchscreen QWERTY keyboard API

Ability to input text without entering in the terminal, or using mods.


UPDATED TO 0.07!

Description:
  • Easy-to-use
  • REALLY BUGGY (23*pi %) :D/>/>/>/>
  • C00L
  • UK keyboard layout
API functions:
Spoiler

asdboard	
getTypes(string PerpiheralType) -- Returns table
	button
		createINDEX(string/int INDEX) -- Multiple buttons/pages
		deleteINDEX(string/int INDEX) -- Clears the INDEX
		createButton(string/int INDEX, int startX, int endX, int startY, int endY, string text, function (without () ), table args, bool toggleable, int textColor, int color, nil false)
                createButton(string/int INDEX, int startX, int endX, int startY, int endY, string text, bool toggleable, int textColor, int color, funcName function, string args ...) -- in 0.1
	deleteButton(string/int INDEX, string text)
	drawButtons(string/int INDEX, int bgColor, string headingText, int headingColor) 	setState(string/int INDEX, string text, bool value) 	doButton(string/int INDEX, int mouseX, int mouseY)
	setUp() -- Need to explain? :I  I think, no.
asdboard (DEBUG)
	listInputs() -- Returns a table with monitors, used like this: monitors={} monitors=listInputs()
Usage: Build a 5x4 monitor.

os.loadAPI("asdboard") --Or use APILoader
user=asdboard.readInput()

Please help me keep this project alive, and PLEASE include this in your project, by showing my credits in the source code, or in your project page :lol:/>/>/>/>

-- ASD-Board API by MindenCucc
-- http://www.computercraft.info/forums2/index.php?/topic/11365-

Download from pastebin.
ATTENTION! API change is coming at 0.1 so if you using my API please be ready for that!

To do list:
  • Button API
  • Wired cable API (Requesting changes in the peripheral API) Built in! :rolleyes:/>/>/>/>
  • Buttons :D/>/>/>/>
  • Keyboard table ADDED! YEEY!
  • Transforming program to API DONE! os.loadAPI("asdboard")
  • Moar buttons
  • Reducing buggyness to 1%
  • Other FANCY STUFF!
BUGS!
Spoiler
  • Terminal keyboard not working (button API bug)
  • If in the main menu, monitor work too, but using it bugs the menu (function bug, NEEDS REWRITE) – Probably fixed, not tested
  • Sometimes the input "text box" misaligned, fixed by triggering an event other than "mouse_click" or "monitor_touch" (messy code, my bad English LOL)

term.setCursorPos(math.floor(((btns[INDEX][btn].x1+btns[INDEX][btn].x2)/2) - (string.len(btns[INDEX][btn].debug)/2))+1, math.floor(btns[INDEX][btn].y1+btns[INDEX][btn].y2)/2) -- FANCY CRAP!
WORKING HARD AND FAST!
 pastebin get aLrbYPsM asdboard 

Screenies:
Spoiler
amtra5 #2
Posted 22 March 2013 - 10:19 AM
Nice!
bjornir90 #3
Posted 22 March 2013 - 07:10 PM
Very nice and useful ! Thanks you !