Astorek86
Prole
Posts: 16
Joined: Fri Jul 13, 2018 7:35 pm

Hello @ all,

I've written a little Menu Engine and thought, it can be useful for others. So I share it here^^.

With this Menu Engine, it is possible to create a *dun dun duuun* Menu, that contains Entries which can be navigated & selected through Keyboard (WASD, Arrow-Keys, NumPad) and Mouse.

I've opened a github-Page for this (including a so-called API-Reference), which can be found here:

Example Screenshot:

Sourcecode for this Example:

Code: Select all

local menuengine = require "menuengine"

local text = "Nothing was selected."

-- Start Game
local function start_game()
text = "Start Game was selected!"
end

-- Options
local function options()
text = "Options was selected!"
end

-- Quit Game
local function quit_game()
text = "Quit Game was selected!"
end

-- ----------

love.window.setMode(600,400)
love.graphics.setFont(love.graphics.newFont(20))

end

function love.update(dt)
end

function love.draw()
love.graphics.clear()
love.graphics.print(text)
end

function love.keypressed(key, scancode, isrepeat)

if scancode == "escape" then
love.event.quit()
end
end

function love.mousemoved(x, y, dx, dy, istouch)
end

More Screens
- Supports different Colors:

- Different Fonts, Sizes...

- ...and Positions for every Entry

- It can handle with LÖVE's scaling-Options:

- It works with Sound-Objects: One for Moving through the Menu, one for Selecting an Entry. Every Entry can have it's own Sound-Object.
- You can hide and unhide Entries on-the-fly as you wish.

Alle Examples can be found in the menu-examples.zip.

Feel free to comment, and if you found bugs, please tell it .
Attachments
Last edited by Astorek86 on Wed Jan 09, 2019 2:02 am, edited 5 times in total.

Мэтю
Prole
Posts: 31
Joined: Mon Jan 06, 2014 1:24 pm
Location: Espírito Santo, Brazil
Contact:

### Re: [11.1] Litte Menu Engine

Really cool and simple, nice work.
Actually I'm not a very good programmer, I'm just used to use local variables almost all the time.
I'm going to use your library and give a more consistent feedback later
World needs love.

Astorek86
Prole
Posts: 16
Joined: Fri Jul 13, 2018 7:35 pm

### Re: [11.1] Litte Menu Engine

Thanks.
Мэтю wrote:
Wed Jul 18, 2018 1:38 pm
Actually I'm not a very good programmer, I'm just used to use local variables almost all the time.
To be honest, I didn't fully understand how global and/or local Variable works in Lua (I'm not a beginner in Programming, but I am a Beginner in Lua^^). I've just updated a new version which doesn't use a global menuengine anymore^^. (I also replaced the Attachments on the 1st Post)
I'm going to use your library and give a more consistent feedback later
That's great, looking forward to hear about it.

Мэтю
Prole
Posts: 31
Joined: Mon Jan 06, 2014 1:24 pm
Location: Espírito Santo, Brazil
Contact:

### Re: [11.1] Litte Menu Engine

Quick update:
I used it briefly, and something I missed was passing an argument to the entry function. So, I made a pull request to your repository on github
You might review if it's suitable for your library xD
World needs love.

Astorek86
Prole
Posts: 16
Joined: Fri Jul 13, 2018 7:35 pm

### Re: [11.1] Litte Menu Engine

That's a good idea, I've just updated Github + Attachments; now it supports Arguments.

Code: Select all

-- before:
-- now:


Thank you very much . I've totally forgotten that use case^^...

coolphill
Prole
Posts: 1
Joined: Mon Jan 07, 2019 1:59 am

### Re: [11.1] Litte Menu Engine

This menu engine is nice. I've been making my own now for a while. I'm kind of shock how you got the the feel and look I was trying to achieve with mine.

4vZEROv
Prole
Posts: 35
Joined: Wed Jan 02, 2019 8:44 pm

### Re: [11.1] Litte Menu Engine

You don't have to declare local i / local k , v when you do

for i = 0, 10 do ... end
&
for k,v in pairs(tbl) do ... end

### Who is online

Users browsing this forum: No registered users and 6 guests