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

lelldorin

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
    • BeSly - Knowledge base
EGSL IDE (Haiku) Templates
« on: 10. February 2013, 15:50:44 »
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

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
    • BeSly - Knowledge base
Re: EGSL IDE (Haiku) Templates
« Reply #1 on: 28. February 2014, 19:14:23 »
Will be funny to get some templates. if you have fun to make some for me, i will be afraid.

GEEK

  • Jr. Member
  • **
  • Posts: 83
  • want to learn c++, if you want to teach me, pm me!
    • View Profile
Re: EGSL IDE (Haiku) Templates
« Reply #2 on: 01. March 2014, 02:23:58 »
have a look at the egsl documentation on the website + there are even downloads with example files ;)

lelldorin

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
    • BeSly - Knowledge base
Re: EGSL IDE (Haiku) Templates
« Reply #3 on: 01. March 2014, 22:09:54 »
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: 01. March 2014, 23:39:35 »
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: 01. March 2014, 23:51:42 by Tomaaz »

lelldorin

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
    • BeSly - Knowledge base
Re: EGSL IDE (Haiku) Templates
« Reply #5 on: 02. March 2014, 19:27:35 »
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

  • Jr. Member
  • **
  • Posts: 83
  • want to learn c++, if you want to teach me, pm me!
    • View Profile
Re: EGSL IDE (Haiku) Templates
« Reply #6 on: 02. March 2014, 22:09:23 »
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: 02. March 2014, 22:21:51 by GEEK »

lelldorin

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
    • BeSly - Knowledge base
Re: EGSL IDE (Haiku) Templates
« Reply #7 on: 02. March 2014, 23:06:50 »
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

  • Jr. Member
  • **
  • Posts: 83
  • want to learn c++, if you want to teach me, pm me!
    • View Profile
Re: EGSL IDE (Haiku) Templates
« Reply #8 on: 02. March 2014, 23:59:32 »
ok, I let you know if I have something :)

GEEK

  • Jr. Member
  • **
  • Posts: 83
  • want to learn c++, if you want to teach me, pm me!
    • View Profile
Re: EGSL IDE (Haiku) Templates
« Reply #9 on: 04. March 2014, 20:38:22 »
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: 04. March 2014, 20:58:46 »
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

  • Jr. Member
  • **
  • Posts: 83
  • want to learn c++, if you want to teach me, pm me!
    • View Profile
Re: EGSL IDE (Haiku) Templates
« Reply #11 on: 04. March 2014, 22:24:08 »
yes, you can do that to, i'd just wanted to keep it simple ;)

lelldorin

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
    • BeSly - Knowledge base
Re: EGSL IDE (Haiku) Templates
« Reply #12 on: 08. March 2014, 13:55:55 »
Nice, thank you :-)

lelldorin

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
    • BeSly - Knowledge base
Re: EGSL IDE (Haiku) Templates
« Reply #13 on: 11. November 2017, 21:18:58 »
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