Author Topic: GUI example anyone?  (Read 5083 times)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
GUI example anyone?
« on: May 25, 2010, 10:02:17 pm »
I always fail when trying to create some gui components...may it be swing's or Android's. It's somehow not compatible with my way of thinking, i guess. I tried to open a simple dialog box after rendering some gl stuff....i just have no idea how. I can choose between some Looper.prepare()-blah exceptions, some called from wrong thread exceptions, array out of bounds and similar stuff. I know that raft has some gui elements in the bones demo, so it has to be possible. Does anybody has some simple example to get me started?
« Last Edit: May 25, 2010, 10:04:42 pm by EgonOlsen »

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: GUI example anyone?
« Reply #1 on: May 25, 2010, 10:14:42 pm »
source of Bones demo can be downloaded from download page, maybe it helps..

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: GUI example anyone?
« Reply #2 on: May 25, 2010, 10:41:36 pm »
Only in the way that i shows me that i'm actually doing it right...at least not totally wrong. I can happily open my dialog, but it has to happen inside the thread that created the Activity. That's the same one that is active when pressing a key or something. I think of it as some kind of event dispatch thread. However, onDrawFrame() of the renderer doesn't seem to run in this thread...but that's where i want to open the dialog. It's a benchmark and after running all the tests, the dialog with the results should open. But i have no onKeyUp or onCreateOptionsMenu...or whatever. I'm in onDrawFrame() knowing that i want to open my dialog...i just can't. When trying it, it tells me that i have to call Looper.prepare() before doing so. When calling this, it tells me that only the thread that created the Activity is allowed to fiddle around with the views. But i can't find anything to execute something in this thread. I also tried to create the dialog myself and somehow assign it to the Activity, but you can't do that. You can add views...but a dialog isn't a view!?
« Last Edit: May 25, 2010, 10:43:45 pm by EgonOlsen »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: GUI example anyone?
« Reply #3 on: May 25, 2010, 11:01:39 pm »
Somehow got it working by sending a Broadcast from the onDrawFrame-method() that the Activity has a receiver for. If that is called, i'm in the right thread to open the dialog...but come on, that can't be right. I must be doing something really really stupid here...
« Last Edit: May 25, 2010, 11:17:59 pm by EgonOlsen »

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: GUI example anyone?
« Reply #4 on: May 25, 2010, 11:16:29 pm »
i guess this is what you look for ;)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: GUI example anyone?
« Reply #5 on: May 26, 2010, 07:00:26 am »
Splitted the topic into this and a thread for the benchmark.