Author Topic: EGSL IDE (Haiku) Templates  (Read 8936 times)

lelldorin

  • Guest
EGSL IDE (Haiku) Templates
« on: February 10, 2013, 02:50:44 PM »
Hello all,

i need some templates for my EGSL IDE. Somthing like this:

Code: [Select]
Open Window:

openwindow (x,y,b,"Window Name")
closewindow()


Code: [Select]
Write to file:

a = open("/Path/to/file/filename", "w")
fprint(a, "Writing text to filename")
close(a)

Code: [Select]
If exists - write to file:

if (fileexists("/Path/to/file/filename") == false) then
a = open("/Path/to/file/filename", "w")
fprint(a, "Writing to filename")
close(a)
end

Code: [Select]
If Exists:

if (fileexists("test.txt") == false) then
??? How can i make Terminal output ???
end

I need some thing like:

- read file
- read directory
- etc.

All in the same short way like my examples.

Also need my codes a check if they are correct?

Greetings Lelldorin

http://haikuware.com/directory/view-details/development/ides/egsl-ide

lelldorin

  • Guest
Re: EGSL IDE (Haiku) Templates
« Reply #1 on: February 28, 2014, 06:14:23 PM »
Will be funny to get some templates. if you have fun to make some for me, i will be afraid.

GEEK

  • Guest
Re: EGSL IDE (Haiku) Templates
« Reply #2 on: March 01, 2014, 01:23:58 AM »
have a look at the egsl documentation on the website + there are even downloads with example files ;)

lelldorin

  • Guest
Re: EGSL IDE (Haiku) Templates
« Reply #3 on: March 01, 2014, 09:09:54 PM »
I want templates not examples

templates are code parts who are every time used again

Tomaaz

  • Guest
Re: EGSL IDE (Haiku) Templates
« Reply #4 on: March 01, 2014, 10:39:35 PM »
templates are code parts who are every time used again

These are subroutines, functions or methods. ;)

Templates are good for markup languages (like HTML), where content is clearly separated from structure and presentation (you provide the content, while templates take care of structure and presentation), but I don't see a point in templates for programming languages. All you posted in your first post are examples, because only examples are useful in case of programming languages (in fact, you can use them as a mini-templates). Templates could look like

Code: [Select]
for [your variable] = [from], [to] do
    [your code]
end

but what would be the point of it? How would it be helpful in writing programs? If you know the syntax of a language, you'll write something like that from scratch quicker than it would take you to use a template. If you don't know the syntax, well... you should learn it. This is not HTML, when you can download a nice template, change the content (text, pictures etc.) and have a good looking website.
« Last Edit: March 01, 2014, 10:51:42 PM by Tomaaz »

lelldorin

  • Guest
Re: EGSL IDE (Haiku) Templates
« Reply #5 on: March 02, 2014, 06:27:35 PM »
I split viewing this, i have examples, thats are complete programs to show the user that he can do with the programming language and on the other hand there are templates. Little code files to make working with the IDE easier. We have IDE templates and User based templates. The IDE templates should have included some codes like openwindow, read file, save file... and the User templates are stored by the user himself with his own files.

Examples:


Templates:


But if no one find this is a good idea... Thats ok.

GEEK

  • Guest
Re: EGSL IDE (Haiku) Templates
« Reply #6 on: March 02, 2014, 09:09:23 PM »
I don't think it's a bad idea, don't take it that way please.. :-\
Ok, where do you need help?

I saw you don't know how to print something to the console?
use: io.write("hello")

maybe you can give me a list with things I can help you with? (if I have the time for it) :)
also googling "Lua" can be a great help..
« Last Edit: March 02, 2014, 09:21:51 PM by GEEK »

lelldorin

  • Guest
Re: EGSL IDE (Haiku) Templates
« Reply #7 on: March 02, 2014, 10:06:50 PM »
This is nice, have added this into the templates.

I think it will be fine to have somthing like:

- readout a textfile
- readout a directory
- draw a button
- draw a image button
- draw a image
- scrolling left to right
- scrolling right to left
- scrolling bottom to top
- scrolling top to bottom
- scrolling all ways
- get key message
- get joystick message
- get mouse message

I am not a EGSL developer, i use yab to make this IDE, i does not know that templates are good and that not. I will take a look into EGSL if i have a good idea for a game... at the moment i create more programs not games.

GEEK

  • Guest
Re: EGSL IDE (Haiku) Templates
« Reply #8 on: March 02, 2014, 10:59:32 PM »
ok, I let you know if I have something :)

GEEK

  • Guest
Re: EGSL IDE (Haiku) Templates
« Reply #9 on: March 04, 2014, 07:38:22 PM »
hey :) just started:

Code: [Select]
-- readout a textfile

function read_file(path)
         local file = io.open(path)
         local string = file:read("*all")
         file.close()
         print(string)
end

read_file("my_file.txt")

readout a directory ???

for these you just have to take a look at the documentation:
draw a button
draw a image button
draw a image

can you explain these a bit more? don't get what you want "scrolling"

scrolling left to right
scrolling right to left
scrolling bottom to top
scrolling top to bottom
scrolling all ways??

get key message is an internal egsl function = getkey()
get joystick message is internal to:

joystickplugged()
getjoyx()
getjoyy()
getjoybutton(button)
numberjoybuttons()


get mouse message? same here:

mousex()
mousey()
mouseb()

Tomaaz

  • Guest
Re: EGSL IDE (Haiku) Templates
« Reply #10 on: March 04, 2014, 07:58:46 PM »
hey :) just started:

Code: [Select]
-- readout a textfile

function read_file(path)
         local file = io.open(path)
         local string = file:read("*all")
         file.close()
         print(string)
end

read_file("my_file.txt")


It would be better if the function returns the content of the file:

Code: [Select]
-- readout a textfile

function read_file(path)
         local file = io.open(path)
         local string = file:read("*all")
         file.close()
         return (string)
end

content = read_file("my_file.txt")

readout a directory ???

Not possible without luafilesystem. I don't know if it was ported to Haiku. I also don't know if you could use luarocks to install it.

GEEK

  • Guest
Re: EGSL IDE (Haiku) Templates
« Reply #11 on: March 04, 2014, 09:24:08 PM »
yes, you can do that to, i'd just wanted to keep it simple ;)

lelldorin

  • Guest
Re: EGSL IDE (Haiku) Templates
« Reply #12 on: March 08, 2014, 12:55:55 PM »
Nice, thank you :-)

lelldorin

  • Guest
Re: EGSL IDE (Haiku) Templates
« Reply #13 on: November 11, 2017, 08:18:58 PM »
So, EGSL is available for the Haiku operating system again, i would ask again for templates i can add to my IDE.

If you have some things who can be added as template let me know.

Greetings Lelldorin