Jump to content




Multitasking Window API


15 replies to this topic

#1 Jummit

  • Members
  • 306 posts
  • LocationJulfander Squad Studio

Posted 12 April 2018 - 05:38 PM

This is kind of the advanced version of ShellSplit, my first program that uses coroutines to achieve multitasking. This one is way more complex, featuring movable, resizable windows.
Demo at work:
Posted Image
Download:
API: pastebin get UQM4T3J3 programs.lua
DEMO: pastebin get HiqdSExG demo.lua
To try it out, just download the api and run the demo

Edited by Jummit, 12 April 2018 - 07:19 PM.


#2 CCTech

  • Members
  • 40 posts
  • LocationGermany

Posted 14 April 2018 - 06:18 PM

nice work ;) looks pretty cool.

Would it be ok if I use this in my OS? I surely will credit you

#3 Jummit

  • Members
  • 306 posts
  • LocationJulfander Squad Studio

Posted 14 April 2018 - 06:45 PM

View PostOneTech, on 14 April 2018 - 06:18 PM, said:

nice work ;) looks pretty cool.

Would it be ok if I use this in my OS? I surely will credit you
I actually made this with my coming OS in mind. Sure, give it a go!
<greedy me>
It only costs one upvote!
</greedy me>

Edited by Jummit, 14 April 2018 - 06:46 PM.


#4 CCTech

  • Members
  • 40 posts
  • LocationGermany

Posted 14 April 2018 - 09:33 PM

View PostJummit, on 14 April 2018 - 06:45 PM, said:

<greedy me>
It only costs one upvote!
</greedy me>

Upvote? Sorry i‘m not so often here..

#5 Lupus590

  • Members
  • 1,976 posts
  • LocationUK

Posted 14 April 2018 - 09:44 PM

View PostOneTech, on 14 April 2018 - 09:33 PM, said:

Upvote? Sorry i‘m not so often here..

the little green arrow in the bottom right of posts (your posts won't have one as you cannot upvote your own post).

#6 CCTech

  • Members
  • 40 posts
  • LocationGermany

Posted 14 April 2018 - 09:55 PM

View PostLupus590, on 14 April 2018 - 09:44 PM, said:


the little green arrow in the bottom right of posts (your posts won't have one as you cannot upvote your own post).

Thanks didn‘t saw it.. it‘s because I‘m using this on phone.. (can‘t access my laptop right now)


#7 Jummit

  • Members
  • 306 posts
  • LocationJulfander Squad Studio

Posted 16 April 2018 - 06:57 AM

A new version is out, now will display on top when selected. The api has not changed, so you can use the code you have made before the change.

#8 minebuild02

  • Members
  • 97 posts

Posted 20 June 2018 - 09:11 AM

I would like to try and use it in my new OS that is currently in development.

#9 InFluXx

  • New Members
  • 1 posts
  • LocationBrasil

Posted 27 March 2019 - 10:44 PM

May I use this API on the OS I'm working on? I credit you

#10 CCTech

  • Members
  • 40 posts
  • LocationGermany

Posted 02 April 2019 - 02:05 PM

Well uhm.. I'm not really sure that this is the right place but asking in "Ask a pro" would be not the best choice (I think?)

I tried to add this windows system to my OS and now I stuck at making a window handler.

It kinda works. It draws the windows but... they're black

Here are the codes:

inside the handler
function drawWindows()
  while true do
    local event, var1, var2, var3 = os.pullEventRaw()
    if event == "terminate" then end
    windows.update(kernel.programs, event, var1, var2, var3)
  end
end

And then if a new window is created:
function taskBar()
  windows.new(function()
    shell.run("/PowerOS/sys/taskBar)")
  end, 9, 1, 35, 2)
end
function drawDesktop()
  opscy.drawColor(colors.white)
  table.insert(kernel.programs, taskBar())
end

The window that should appear is black without the topbar (Even if the positions aren't 1,1)

I tried it with some other programs which should run inside the window but with no success...

I have often rewrote the full code

I hope you can help me :P

#11 Jummit

  • Members
  • 306 posts
  • LocationJulfander Squad Studio

Posted 03 April 2019 - 05:05 PM

View PostCCTech, on 02 April 2019 - 02:05 PM, said:

I tried to add this windows system to my OS and now I stuck at making a window handler.

- snip -

I need more of your code to help you. What does windows.update and windows.new do?

#12 CCTech

  • Members
  • 40 posts
  • LocationGermany

Posted 03 April 2019 - 07:38 PM

View PostJummit, on 03 April 2019 - 05:05 PM, said:

I need more of your code to help you. What does windows.update and windows.new do?

Uhh.. it's from your window API i just did

local windows = require(TheApiPath)

instead of

local program = require(TheApiPath)

It was all of my code that I posted which is for handling the Windows

#13 Jummit

  • Members
  • 306 posts
  • LocationJulfander Squad Studio

Posted 03 April 2019 - 07:49 PM

View PostCCTech, on 03 April 2019 - 07:38 PM, said:

View PostJummit, on 03 April 2019 - 05:05 PM, said:

I need more of your code to help you. What does windows.update and windows.new do?

Uhh.. it's from your window API i just did

local windows = require(TheApiPath)

instead of

local program = require(TheApiPath)

It was all of my code that I posted which is for handling the Windows
Oops, I didn't spot that. I havn't worked with this api for quite some time, so I didn't notice.
Your issue is that the taskBar function never returns anything. Here is the fixed code:
function taskBar()
  return windows.new(function()
    shell.run("/PowerOS/sys/taskBar)")
  end, 9, 1, 35, 2)
end


#14 CCTech

  • Members
  • 40 posts
  • LocationGermany

Posted 04 April 2019 - 04:11 PM

View PostJummit, on 03 April 2019 - 07:49 PM, said:

View PostCCTech, on 03 April 2019 - 07:38 PM, said:

View PostJummit, on 03 April 2019 - 05:05 PM, said:

I need more of your code to help you. What does windows.update and windows.new do?
Uhh.. it's from your window API i just did
 local windows = require(TheApiPath) 
instead of
 local program = require(TheApiPath) 
It was all of my code that I posted which is for handling the Windows
Oops, I didn't spot that. I havn't worked with this api for quite some time, so I didn't notice. Your issue is that the taskBar function never returns anything. Here is the fixed code:
 function taskBar() return windows.new(function() shell.run("/PowerOS/sys/taskBar)") end, 9, 1, 35, 2) end 

Oh, indeed! Thanks for the quick support! Didn't thought about that it may needs to return something :P

#15 CCTech

  • Members
  • 40 posts
  • LocationGermany

Posted 05 April 2019 - 04:22 PM

aaand... sorry if I disturb you

I just think that I'm too... well I think you know what I mean..

Is there a way to reparent a window? I have a program that starts other programs but their windows only appear inside the programs window and not as seperate windows.

I also tried making a table and the update function inside the window handler (not your API) checks if it is empty. If not then it should move the window from inside the table inside the right table that contains all windows. Still only inside the window that runs it... So is there any way of "parenting" a window?

Thanks in advance

and: Am I allowed to modify the API a bit to change the window designs? I want to be on the safe side :P

#16 CCTech

  • Members
  • 40 posts
  • LocationGermany

Posted 05 April 2019 - 09:15 PM

Never mind.. got it to Work :P





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users