android
Prev Previous Post   Next Post Next
  #1  
Old 01-13-2010, 11:26 PM
ThievingSix ThievingSix is offline
Member
 
Join Date: Aug 2008
Posts: 218
Default Apeopex GUI/Event Module

I promised it earlier but finally got around to working on it. What this is, is a module you include in your application to allow event driven GUI code.

For example:
Code:
--[[
  Small application to demonstrate the Apeopex module.
  Displays two buttons, one 3D and one flat. 
--]]

--Clear cached package
package.loaded.Apeopex = nil;
--Load Apoepex module
require "Apeopex";

--Set Exit variable
DoExit = false;

--Our button event functions. Simply sets our Exit variable to true.
function ExitApp()
  DoExit = true;
end;

function DisplayText()
  screen.clear();
  text.color(Apeopex.clRed);
  text.size(10);
  text.draw(10,150,"You pressed the second button!");
  screen.update();
end;

function TouchEvent(x,y)
  screen.clear();
  screen.fillrect(200,10,100,50,Apeopex.clBlack);
  text.color(Apeopex.clWhite);
  text.size(15);
  text.draw(200,10,"X: " .. x);
  text.draw(200,30,"Y: " .. y);
  screen.update();
end;

--Demonstrates screen wrapper and module color usage
Apeopex.FillScreen(Apeopex.clBlack);

--CreateButton(X,Y,Width,Height,IsFlat,MainColor,TextColor,ButtonCaption,ButtonClickEvent)
Apeopex.CreateButton(10,10,100,30,true,Apeopex.clLightGray,Apeopex.clBlack,"Exit",ExitApp);
Apeopex.CreateButton(10,50,100,30,false,Apeopex.clLightGray,Apeopex.clBlack,"Display Text",DisplayText);

--Demonstrate event usage
Apeopex.OnHomeHold = ExitApp;
Apeopex.OnTouchClick = TouchEvent;
Apeopex.OnTouchMove = TouchEvent;

--Our application loop
repeat
  --Call the module event loop to process button clicks
  Apeopex.EventLoop();
  --Exit when button is pressed, which calls the event ExitApp, which sets DoExit to true.
until (DoExit == true);
Right now there is only support for simple buttons, but I wanted to get it out there to see what you think . If I had a camera I'd attempt to get a picture of the buttons, but they are slightly 3Dish and are push/rollover buttons that utilize the touch.down() and touch.up() events.

v0.1 - Release!
v0.2 - Fully event driven. Allowed to add user events for all control events. Works without sleep or wait.
Attached Files
File Type: zip Apeopex(Module + Sample).zip (3.5 KB, 22 views)
File Type: zip Apeopex(Module + Sample)v0.2.zip (4.2 KB, 49 views)

Last edited by ThievingSix; 01-15-2010 at 12:44 PM.
Reply With Quote

Advertisement [Remove Advertisement]

 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 10:59 PM.