Author Topic: CalGUI -- A GUI library by flyingfisch  (Read 31819 times)

0 Members and 2 Guests are viewing this topic.

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: CalGUI -- A GUI library by flyingfisch
« Reply #45 on: January 06, 2012, 04:21:02 am »
just do
Code: [Select]
cursortypes = {
*cursor image data here*
}
cursor:init(x,y,type)
 self.x = x
 self.y = y
 self.type = cursortypes[type]
end
Cursor = cursor(50,50,*number here*)
this way you can add different cursor like we have in nspire, which you can find here
it contains a zip with all the cursors in a different image

and then assign a function to it to change the cursor
Code: [Select]
function cursor:set(type)
Cursor.type = cursortypes[type]
end


cursor:set(*number here*)
« Last Edit: January 06, 2012, 04:23:08 am by Nick »

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: CalGUI -- A GUI library by flyingfisch
« Reply #46 on: January 06, 2012, 09:11:58 am »
Thanks nick for your code :)

and for your cursor images (i was having trouble making one that didnt look silly. lol)

@jwalker: Is there a sample program that uses your library that I look at? I want to see how the library is used in a program. Also, which post in your thread has the latest code?



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: CalGUI -- A GUI library by flyingfisch
« Reply #47 on: January 06, 2012, 09:14:20 am »
im actualy about to upload a prerelease version right now, check in a few miniutes, im using an old crappy school computer so it might take some time :P
EDIT: uploaded!
« Last Edit: January 06, 2012, 09:16:19 am by jwalker »
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: CalGUI -- A GUI library by flyingfisch
« Reply #48 on: January 06, 2012, 09:16:31 am »
im actualy about to upload a prerelease version right now, check in a few miniutes, im using an old crappy school computer so it might take some time :P
OK. :D

just do
Code: [Select]
cursortypes = {
*cursor image data here*
}
cursor:init(x,y,type)
 self.x = x
 self.y = y
 self.type = cursortypes[type]
end
Cursor = cursor(50,50,*number here*)
this way you can add different cursor like we have in nspire, which you can find here
it contains a zip with all the cursors in a different image
...

OK, does that code use classes or what? (This is my first major program with lua so please bear with me :) )

« Last Edit: January 06, 2012, 09:17:20 am by flyingfisch »



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: CalGUI -- A GUI library by flyingfisch
« Reply #49 on: January 06, 2012, 09:17:35 am »
this code does use classes, the one he gave you and mine also
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: CalGUI -- A GUI library by flyingfisch
« Reply #50 on: January 06, 2012, 09:19:32 am »
I'm gonna have to take another look at jimbauwens explanation of classes :)



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: CalGUI -- A GUI library by flyingfisch
« Reply #51 on: January 06, 2012, 09:23:37 am »
thats a good idea too, my code only uses one instance of inheritance though, in the form class, do to the fact that the lib is quit large and poeple should be able to choose what code they need and take the other stuff out.
this way if they take out some class and some other class had to inherit from it there would be errors.
also i might add a control class for the controls to inherit from, but i may not do to the fact im trying to make it smaller and more optimized :)
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: CalGUI -- A GUI library by flyingfisch
« Reply #52 on: January 06, 2012, 09:26:40 am »
thats a good idea too, my code only uses one instance of inheritance though, in the form class, do to the fact that the lib is quit large and poeple should be able to choose what code they need and take the other stuff out.
this way if they take out some class and some other class had to inherit from it there would be errors.
also i might add a control class for the controls to inherit from, but i may not do to the fact im trying to make it smaller and more optimized :)

OK.

Is there a list of on events and their usage?



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: CalGUI -- A GUI library by flyingfisch
« Reply #53 on: January 06, 2012, 09:46:40 am »
no i didnt list them but they are descriptive...
for example:
function on.mouseDown(x, y) means the mouse was clicked and returns to us x and y
function on.charIn(char) means that a key other than an arrow key was pressed and returns char to us
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: CalGUI -- A GUI library by flyingfisch
« Reply #54 on: January 06, 2012, 09:52:16 am »
i thought he meant functions from your gui jwalker.. here are all the functions standard in nspire lua

Function name        Arguments                                                  Called when
on.paint(gc)        GC is the graphical context (explained later)       platform.window:invalidate() is called
on.arrowKey(arrow)   Arrow returns ‘left’,’right’,’up’ or ‘down’           An arrow key had been pressed
on.arrowLeft()        -                                                                   The left arrow key has been pressed
on.arrowRight()        -                                                                   The right arrow key has been pressed
on.arrowUp()        -                                                                   The up arrow key has been pressed
on.arrowDown()   -   The down arrow key has been pressed
on.enterKey()   -   The enter key has been pressed
on.escapeKey()   -   The escape key has been pressed
on.tabKey()   -   The tab key has been pressed
on.charIn(char)   Char can return any char, e.g. char = ‘+’   Any character key has been pressed
on.mouseMove(x,y)   x and y return the position of the mouse   The mouse moves
on.mouseDown(x,y)   x and y return the position of the mouse   The mouse has been pressed
on.mouseUp(x,y)   x and y return the position of the mouse   The mouse has been released
on.create()   -   The file gets opened (made)
on.destroy()   -   The file gets closed (destroyed)
on.resize()   -   The screen is resized (when in the pc software)
on.timer()   -   The timer is called
on.deleteKey()   -   The delete key has been pressed
on.backspaceKey()   -   The backspace key has been pressed
on.returnKey()   -   The return key has been  pressed
on.contextMenu()   -   The [ctrl][menu] key has been pressed
on.help()   -   The [ctrl][trig] has been pressed
on.clearKey()   -   The clear key has been pressed
on.activate()   -   The tab/page gets activated
on.deactivate()   -   The tab/page gets inactivated
on.blink()   -   The focus gets lost on the page

or just go here
it's the events part
« Last Edit: January 06, 2012, 09:54:05 am by Nick »

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: CalGUI -- A GUI library by flyingfisch
« Reply #55 on: January 06, 2012, 10:03:51 am »
in my GUI on. events are ususaly sent to the window that was retrieved from the curwin() function, except mouse down will check all windows because then a user can give them focus and effectively redraw them overtop of the other windows
some on. events i dont implement, because i dont use them, like on.blink
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: CalGUI -- A GUI library by flyingfisch
« Reply #56 on: January 06, 2012, 10:11:43 am »
i thought he meant functions from your gui jwalker.. here are all the functions standard in nspire lua

Function name        Arguments                                                  Called when
on.paint(gc)        GC is the graphical context (explained later)       platform.window:invalidate() is called
on.arrowKey(arrow)   Arrow returns ‘left’,’right’,’up’ or ‘down’           An arrow key had been pressed
on.arrowLeft()        -                                                                   The left arrow key has been pressed
on.arrowRight()        -                                                                   The right arrow key has been pressed
on.arrowUp()        -                                                                   The up arrow key has been pressed
on.arrowDown()   -   The down arrow key has been pressed
on.enterKey()   -   The enter key has been pressed
on.escapeKey()   -   The escape key has been pressed
on.tabKey()   -   The tab key has been pressed
on.charIn(char)   Char can return any char, e.g. char = ‘+’   Any character key has been pressed
on.mouseMove(x,y)   x and y return the position of the mouse   The mouse moves
on.mouseDown(x,y)   x and y return the position of the mouse   The mouse has been pressed
on.mouseUp(x,y)   x and y return the position of the mouse   The mouse has been released
on.create()   -   The file gets opened (made)
on.destroy()   -   The file gets closed (destroyed)
on.resize()   -   The screen is resized (when in the pc software)
on.timer()   -   The timer is called
on.deleteKey()   -   The delete key has been pressed
on.backspaceKey()   -   The backspace key has been pressed
on.returnKey()   -   The return key has been  pressed
on.contextMenu()   -   The [ctrl][menu] key has been pressed
on.help()   -   The [ctrl][trig] has been pressed
on.clearKey()   -   The clear key has been pressed
on.activate()   -   The tab/page gets activated
on.deactivate()   -   The tab/page gets inactivated
on.blink()   -   The focus gets lost on the page

or just go here
it's the events part


So yeah, this should be pretty easy to do with classes, right?



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: CalGUI -- A GUI library by flyingfisch
« Reply #57 on: January 06, 2012, 10:13:15 am »
certainly, you will only have to use loops to determine if a function needs to be called or not..
luaFX is in loops, isn't it?

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: CalGUI -- A GUI library by flyingfisch
« Reply #58 on: January 06, 2012, 10:14:10 am »
certainly, you will only have to use loops to determine if a function needs to be called or not..
luaFX is in loops, isn't it?

As in, it supports loops?



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: CalGUI -- A GUI library by flyingfisch
« Reply #59 on: January 06, 2012, 10:15:44 am »
no, i mean, is it event-based? or just like basic programs that you have to create a loop that gets repeated constantly and from which you call certain functions if a statement is true