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

Diamond Computers: Graphics Mode, full compatability with old programs!

Started by Egor305, 12 December 2013 - 11:16 PM
Egor305 #1
Posted 13 December 2013 - 12:16 AM
Have fun:

|																							   |
======
DIAMOND COMPUTERS
======
Hi! This is suggestion, well, all about diamond computers!
Diffrence between diamond computers and advanced computers is that
diamond ones have 256 colors and graphics mode.
I'm gonna call those DPC, just because I don't want to write
"Diamond Computer" all the time.
======
New API
======
DPCs gonna have new API. I will call it "lol" for simplicity.
Basicly lol gonna have all low level functions.
lol.pixel(nX,nY,color) will set some pixel to some color.
--more draw functions here--
lol.clear() clears screen.
lol.clearLine(nY) clears row of pixels.
lol.getCursorPos() returns cursor position in pixels (used for writing text)
lol.setCursorPos(nX,nY) will set cursor position in pixels. (used for text writing)
lol.getSize() returns size of screen in pixels.
lol.redirect(mTarget) of course for Diamond Monitors. :D/>/>/>
lol.restore() You get the deal...
======
Compat.
======
term API of course will be fixed for using with DPCs.
As you can see all text functions are built around graphics functions.

function term.write(sStr)
  --Lowlevel function that uses lol.pixel() and lol.getCursorPos() to draw sStr.
end
function term.clear()
  lol.clear()
end
function term.clearLine()
  local _,y=lol.getCursorPos()
  for i=y,y+8,1 do --let's say that one char is 8x8 (it is, actually. or atleast in font map)
	lol.clearLine(i)
  end
end
function term.getCursorPos()
  local x,y = lol.getCursorPos()
  return x/8,y/8 --8x8 :D/>/>/>
end
function term.setCursorPos(nX,nY)
  lol.setCursorPos(nX*8,nY*8) --ololololol 8x8 chars.
end
Do I need to explain the rest?
======
PC Speaker :D/>/>/>
======
Did I said something about PC Speaker?
I'm don't know how those works, but they do *beep*-*boop* sounds.
It's epic!
======
Last words
======
Because of expencivenes, and difficulty to code, those will not destroy APC scripting like,
APC destroyed PC scripting.
Sorry for bad english and really poor writen text, it's night in here.
If you got any questions - ask.

--Your best MS-DOS-nerd-friend, Egor305
|																							   |
What do you think about it?
Lyqyd #2
Posted 13 December 2013 - 12:39 AM
This is a totally original idea that has never been posted before. I'm glad you skipped right past reading the sticky and boldly posted your highly original idea!