U++ framework
Do not panic. Ask here before giving up.

Home » Developing U++ » U++ Developers corner » Rainbow, first iteration  () 1 Vote
Rainbow, first iteration [message #32829] Mon, 13 June 2011 15:03 Go to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
I took time, especially considering it is mostly preprocessor compile time hack, but I believe that I have reached important milestone in Rainbow development, I believe it should be now possible to develop custom GUI for U++ without the need dir directly changing CtrlCore/CtrlLib (like MacOS or Android or OpenGL).

How is it supposed to work, at least, starting point:

The CtrlCore.h now begins with:

#include <guiplatform.h>

#ifndef GUIPLATFORM_INCLUDE

#ifdef PLATFORM_WIN32
#define GUIPLATFORM_INCLUDE "Win32Gui.h"
#endif

#ifdef PLATFORM_X11
#define GUIPLATFORM_INCLUDE "X11Gui.h"
#endif

#endif


guiplatform.h is in uppsrc root (not in package) and it is empty, so for normal operations "defaults" kick in.

If you are about to develop custom GUI backend, create a new nest, place guiplatform.h into it and using #define GUIPLATFORM_INCLUDE 'redirect' it to your own GUI specification header.

As for development itself, I believe that two 'default' backends give a good hint... I am using quite ugly combination of macros, includes and platform defined functions/methods; for now it seems to be the most cost efficient way. We will say how that works in practice...

Important notice: Whereas in the past we were using PLATFORM_WIN32 and PLATFORM_X11 in CtrlLib and other GUI code for #ifdefs to tell apart the GUI backend, this should be now replaced by 'GUI_WIN' and 'GUI_X11' (those are defined in GUIPLATFORM_INCLUDE), because it is no longer true that Windows backend has to used on Windows platform...

OK, this should work as first introduction. I am now plannig for actually developing generic framebuffer backend to tune this thing.

Perhaps Daniel could now also try to 'port' OpenGL U++ to rainbow too.

Mirek
Re: Rainbow, first iteration [message #32832 is a reply to message #32829] Mon, 13 June 2011 21:24 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
I have created 'rainbow' nest in svn for general rainbow development and as a proof of concept I have 'reimplemented' Win32 backend (simply by copying existing Win32 backend).

BTW, interesting stat: Win32 backend is about 6000 lines, chameleon excluded...
Re: Rainbow, first iteration [message #32841 is a reply to message #32829] Tue, 14 June 2011 10:36 Go to previous messageGo to next message
chickenk is currently offline  chickenk
Messages: 171
Registered: May 2007
Location: Grenoble, France
Experienced Member
/home/lionel/upp/uppsrc/CtrlCore/CtrlCore.h:10:2: erreur: #error 


I think the '#error' line is a garbage stuff, isn't it?
Re: Rainbow, first iteration [message #32842 is a reply to message #32829] Tue, 14 June 2011 14:06 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

Excellent news.
Quote:


Perhaps Daniel could now also try to 'port' OpenGL U++ to rainbow too.


Yes, I'm gonna do that.
Re: Rainbow, first iteration [message #32845 is a reply to message #32841] Tue, 14 June 2011 17:59 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
chickenk wrote on Tue, 14 June 2011 04:36

/home/lionel/upp/uppsrc/CtrlCore/CtrlCore.h:10:2: erreur: #error 


I think the '#error' line is a garbage stuff, isn't it?


Yes, sorry about that...

Mirek
Re: Rainbow, first iteration [message #32859 is a reply to message #32845] Wed, 15 June 2011 09:33 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
There is now rainbow/Skeleton package - empty GUI backend, it only compiles and links and does nothing.
Re: Rainbow, first iteration [message #32863 is a reply to message #32829] Wed, 15 June 2011 16:21 Go to previous messageGo to next message
harmac is currently offline  harmac
Messages: 16
Registered: January 2011
Promising Member
mirek wrote on Mon, 13 June 2011 15:03

I am now plannig for actually developing generic framebuffer backend to tune this thing.


Lacking knowledge about U++ implementation and style and graphics programming in general so far, I don't know if the following resources are helpful in the endeavour, as at present I'm too much of a C/C++ newbie, but still:

There is portable framebuffer library pxCore that seems to have been ported already to Windows, PocketPC (ARM4), Linux(X11), OSX. Maybe you can recycle some code of it for U++ if it fits the need or maybe it suits as a generic backend already.

It may not be directly framebuffer related, but when I read about the Fog-Framework, its Fog-UI component seems to use an abstract interface for GUI descriptions that is later mapped to different native targets. It sounds somewhat like what Rainbow seems to be trying. I haven't looked at the implementation but conceptually it sounds cleaner than the current U++ approach, which you name ugly yourself. Coming from different languages, from what I understand about the C/C++ preprocessor, it is an ugly kludge in the first place, and maybe it is worth to consider not using it at all.

If not for Rainbow, looking at Fog might be worthy in its own right, as some of its explicit design notes (like for instance not using STL) seem to be in accord with U++ philosophy, so that it might possibly be interesting to recycle code from there or maybe even join some efforts, as some purposes of both projects seem to overlap.

I don't know in what state Fog currently is, though, as the author seems to be concerned with another project (AsmJit), part of which he but seems to plan to integrate into Fog in the form of BlitJit, and in a post on a blog about the Fog-Framework (which also has a post with a number of vector geometry resources, which are probably a bit over my mind at the moment but which more involved people or those interested in learning might find interesting) he assures that the project is not dead. One of the goals at least seems to be high performance with maximum compatibility and adaptation to the target.

Speaking of which, when somebody recently posted about jslinux, I also read in an article about Fabrice Bellard that he had implemented with TinyGL a small subset of OpenGL that can be used as a fallback for systems that normally don't have hardwaresupport for it. As it is very old and probably incomplete, I don't know how close it is to OpenGL ES, but maybe it might be interesting for implementers of U++ OpenGL backends to take a look at such a limited subset whose GL instruction implementation for some arbitrary target platform can be done with reasonable effort and use that subset as a portable target for translations from U++ GUI descriptions.

Finally, there is Agar, which I hadn't heard about before. It may not follow any U++ philosophy but also has different raw targets and might therefore be interesting for somebody interested in the topic to see how different folks are doing their implementations.

pxCore, Fog-Framework and Agar are BSD-licensed, TinyGL zlib-like. As also some external links on their respective websites might be interesting for one or another and some of the projects themselves might be interesting for the U++ folks, I thought that pointing to these projects might be worthwhile. Note that I currently lack the knowledge to decide whether or not they actually are useful.
Re: Rainbow, first iteration [message #32934 is a reply to message #32863] Wed, 22 June 2011 10:21 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
this is really nice news..

MacOSX wont take long either with this helper. thanks.

as of android, it might be quite difficult to circumvent the whole java stuff. the only possibility will be the NDK.

concerning the 'uglyness' of rainbow:
as a program usually only uses one single graphics/ui backend, the compiled-in option is definitely the fastest way. of corse a clean HAL like GUI abstraction layer would be more clean but this al comes at expenses: complexity and speed. i think the current approach, though a bit 'ugly' and not transparent at first glance, is a moonolite solution. id definitely needs kind of a tutorial on how to start and what is what and what is expected to happen inside some functions. but this managable.

pxCore seems appealing. especially in terms of designing apps on PC framebuffer emulation whilst the still run on bare embedded frambuffer. that'd be a niiiiice advantage in embededded world. believe me Smile one often breaks the neck there. recompiling untouched code is just heaven.

anyways, for the clean fb0 solution, i have found somewhere a test prog once, and tried to use it in u++.

find it attached.

@mirek: the Framebuffer / WinFB is a starter isn't it?
Framebuffer.h:60 lacks a ';'
do you already use the WinFB stuff? when i try to compile rainbow/Paint i get some errors.. have any working environment?

if you could provide a slight description on the files/some crucial functions i could try to make some steps.
  • Attachment: fb0test.rar
    (Size: 1.39KB, Downloaded 482 times)

[Updated on: Wed, 22 June 2011 10:25]

Report message to a moderator

Re: Rainbow, first iteration [message #32938 is a reply to message #32934] Wed, 22 June 2011 20:40 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
kohait00 wrote on Wed, 22 June 2011 04:21

this is really nice news..

MacOSX wont take long either with this helper. thanks.

as of android, it might be quite difficult to circumvent the whole java stuff. the only possibility will be the NDK.



AFAIK, it is not longer needed. NDK is good enough now (I believe was ugraded at the end of last year).

Quote:


concerning the 'uglyness' of rainbow:



Well, as I am now working on FB backend, it is perhaps ugly by concept, but in "live" development it does not look so bad...

Quote:


and of a tutorial on how to start and what is what and what is expected to happen inside some functions. but this managable.



Actually, that is one purpose of FB backend...

Quote:


@mirek: the Framebuffer / WinFB is a starter isn't it?
Framebuffer.h:60 lacks a ';'
do you already use the WinFB stuff? when i try to compile rainbow/Paint i get some errors.. have any working environment?



It's under development. Frankly, it barely compiles now. A lot has to be done before it even paints something Smile

Mirek
Re: Rainbow, first iteration [message #32942 is a reply to message #32938] Thu, 23 June 2011 00:02 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
looking forward to have it Smile
really havent found the time to actually fully get this stuff done, didnt get past the point of extracting/extending the interface just as you did for rainbow now, in a much cleaner way... but i'm still interested.
Re: Rainbow, first iteration [message #32973 is a reply to message #32942] Mon, 27 June 2011 09:52 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
really nice progress in Frambuffer.

i tried to compile it in suse, making WinFB dependant of WIN32 flag. it depends on a the windows virtual key codes and the stuff from stdids.h.. the virtual key codes are in WinUser.h, how should we tread this stuff? can we pack them together?

fb0 shows first Upp stuff [message #32975 is a reply to message #32973] Mon, 27 June 2011 14:49 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
hi mirek

i played around with rainbow a bit.

thanks to your work, i've been able to have fb0 show the fullscreen view of Paint package. attached are the 2 patches.

patch0 has some fixes concerning PLATFORM_X11, which should be GUI_X11 or PLATFORM_POSIX now, please review it. there also arises a slight problem with Image, it still has some code PLATFORM_WIN32 and PLATFORM_X11 dependant. but due to elimination of PLATFORM_X11, which is available from Core level, GUI_X11 is available from CtrlCore level only, Image, which is included by CtrlCore does not know anything from GUI_X11. i dont have any solution for this. maybe the platform dependant stuff should be made a special class, which is implemented platform dependantly.

patch1 has got the changes for the real framebuffer, it is veery basic only, just to make it show sth. what idea did you have concerning ProcessEvent / Eventloop? read /dev/input in another thread? and what about non MT environment? there is no way to make the ImageBuffer directly be based on framebuffer pointer? one could save the copying..

i also attached the sources directly. in case you arent able to aply the diff patch (created under suse 11.3 with git make patch)

i am getting really excited. upp becomes really an option for embedded stuff Smile..and a good option.

EDIT: for those of you trying it out: make sure to execute the app in a console, where fb is enabled. do not try to execute it in your GNOME or the like environment. it wont show the fb.
  • Attachment: stuff.tar.gz
    (Size: 74.13KB, Downloaded 486 times)

[Updated on: Mon, 27 June 2011 15:25]

Report message to a moderator

Re: fb0 shows first Upp stuff [message #32980 is a reply to message #32975] Mon, 27 June 2011 16:54 Go to previous messageGo to next message
Sgifan is currently offline  Sgifan
Messages: 37
Registered: February 2010
Location: France
Member
Just for the pleasure of the eyes, could you please send a screen shot of this.

thxs
Re: fb0 shows first Upp stuff [message #32981 is a reply to message #32980] Mon, 27 June 2011 17:14 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
this is the quickest option i could find Smile my phone
as mentioned, input handling is not implemented..so the cursor down left is there..
it's from my opensuse enterprise laptop, started from one of the virtual terminals..

index.php?t=getfile&id=3344&private=0

[Updated on: Mon, 04 July 2011 13:59] by Moderator

Report message to a moderator

Re: Rainbow, first iteration [message #32982 is a reply to message #32973] Mon, 27 June 2011 17:43 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
kohait00 wrote on Mon, 27 June 2011 03:52

really nice progress in Frambuffer.

i tried to compile it in suse, making WinFB dependant of WIN32 flag. it depends on a the windows virtual key codes and the stuff from stdids.h.. the virtual key codes are in WinUser.h, how should we tread this stuff? can we pack them together?




Well, that is one of ToDo now... My current plan is to make keycodes defined in 'final' framebuffer backend, perhaps through rainbow #define.

Alternative approach would be to define framebuffer specific keycodes and translate (from Win or X11) to them. IMO, much more work...
Re: fb0 shows first Upp stuff [message #32983 is a reply to message #32975] Mon, 27 June 2011 17:50 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
kohait00 wrote on Mon, 27 June 2011 08:49

hi mirek

i played around with rainbow a bit.

thanks to your work, i've been able to have fb0 show the fullscreen view of Paint package. attached are the 2 patches.




rainbow now has the same rights as bazaar - you are welcome to join the development and apply patches. Please commit linux fb as new backend if you wish so.

Just keep in mind please that the "Framebuffer" is meant to be generic, then there should be some kind of "final" backend, like WinFB.

Mirek
Re: Rainbow, first iteration [message #32984 is a reply to message #32829] Mon, 27 June 2011 17:52 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
P.S.: Give it an hour to rights become active...
Re: Rainbow, first iteration [message #32986 is a reply to message #32984] Mon, 27 June 2011 18:14 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
i'll be checking it.. thanks for welcoming Smile hope to help.

current name was RealFb which should probably be set to LinuxFb or sth. like PosixFB?

you are currently using the windows virtual key codes. why not keep them? stdids.h is lend from win32 as well and is part of CtrlCore (for X11) so why not? save some work actually. i admit i havent spend much on this isue anyhow..i just copied the VK codes from WinUser.h to make it run.

did you think about the GUI_X11 problem and how to solve it?
for best performance , ImageBuffer should be initializable from a given buffer as well. thus we can spare ourselves some copy time..
but it has Buffer<char> pixels inside..maybe to use sth different? maybe it will be difficult because of ref count Image data takeovers.. but think about it.
Re: Rainbow, first iteration [message #32987 is a reply to message #32986] Mon, 27 June 2011 21:05 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
kohait00 wrote on Mon, 27 June 2011 12:14


you are currently using the windows virtual key codes. why not keep them? stdids.h is lend from win32 as well and is part of CtrlCore (for X11) so why not? save some work actually. i admit i havent spend much on this isue anyhow..i just copied the VK codes from WinUser.h to make it run.



I believe it will be easier to define a new set for particular framebuffer backend...

Actual revision moved keys.h to WinFB.

Quote:


ImageBuffer should be initializable from a given buffer as well. thus we can spare ourselves some copy time..



Well, I expect 'backpaint' operation to be default for framebuffer for now. It is easier to develop and perhaps the required mode anyway.

Quote:


but it has Buffer<char> pixels inside..maybe to use sth different? maybe it will be difficult because of ref count Image data takeovers.. but think about it.


Actually, I already did and in the future, I plan to change BufferPainter to use raw binary buffer too (instead of ImageBuffer).

Mirek
Re: Rainbow, first iteration [message #32994 is a reply to message #32987] Tue, 28 June 2011 12:39 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
we actually dont need a common codes set, the backends normally provide them as well. i.e. linux input subsystem...

do you plan to detach the gui backends from CtrlCore completely?
i'd find it pretty nice to have the backends in seperate packages..
i noticed that WinAlt does not use cham. is this planned?

generally, from where do you plan to have the final GUI backend selection? from the top ackage like it is now or from the CtrlCore package? i mean where the guiplatform.h is finally situated. it could be 'overridden' in case of special specification. but all provided backends could live at some bottom level, to be selected with a compile flag like WINFB, LINUXFB, MACFB (those that are known and already exist).

this would reliev the user to specify it's own guiplatform, instead he could only take the Framebuffer package and select the backend via compileflag.

BTW: i commited the state of yesterday. what is missing, are the patch0 changes.. i found a mean to convert git patches to tortoise patches. so here it comes again.
Re: Rainbow, first iteration [message #32995 is a reply to message #32994] Tue, 28 June 2011 13:32 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
kohait00 wrote on Tue, 28 June 2011 06:39

we actually dont need a common codes set, the backends normally provide them as well. i.e. linux input subsystem...

do you plan to detach the gui backends from CtrlCore completely?



I plan to keep Win32/X11 in CtrlCore. Most apps use just this and it would be 2 packages more in the list. In future, when MacOS and Android are available, I consider moving them there too.

Quote:


i noticed that WinAlt does not use cham. is this planned?



Unlike, WinAlt is only the first "proof of concept", nothing more.

Quote:


generally, from where do you plan to have the final GUI backend selection? from the top ackage like it is now or from the CtrlCore package? i mean where the guiplatform.h is finally situated. it could be 'overridden' in case of special specification. but all provided backends could live at some bottom level, to be selected with a compile flag like WINFB, LINUXFB, MACFB (those that are known and already exist).



I agree with compile flag and will be moving in that direction.

However, guiplatform.h placement is what it is supposed to be. I mean, first guiplatform.h in nest chain gets used. This is to allow everybody to groom his own backand withou fiddling with uppsrc code..

Quote:


this would reliev the user to specify it's own guiplatform, instead he could only take the Framebuffer package and select the backend via compileflag.



Actually, I believe we are heading right there.


BTW: i commited the state of yesterday. what is missing, are the patch0 changes.. i found a mean to convert git patches to tortoise patches. so here it comes again. [/quote]

I have found a problem there: In Image.h, GUI_X11 is not yet defined....
Re: Rainbow, first iteration [message #32996 is a reply to message #32995] Tue, 28 June 2011 13:37 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
GUI_X11 not defined:

Quote:


patch0 has some fixes concerning PLATFORM_X11, which should be GUI_X11 or PLATFORM_POSIX now, please review it. there also arises a slight problem with Image, it still has some code PLATFORM_WIN32 and PLATFORM_X11 dependant. but due to elimination of PLATFORM_X11, which is available from Core level, GUI_X11 is available from CtrlCore level only, Image, which is included by CtrlCore does not know anything from GUI_X11. i dont have any solution for this. maybe the platform dependant stuff should be made a special class, which is implemented platform dependantly.




Smile
Re: Rainbow, first iteration [message #32997 is a reply to message #32996] Tue, 28 June 2011 15:02 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
kohait00 wrote on Tue, 28 June 2011 07:37

GUI_X11 not defined:

Quote:


patch0 has some fixes concerning PLATFORM_X11, which should be GUI_X11 or PLATFORM_POSIX now, please review it. there also arises a slight problem with Image, it still has some code PLATFORM_WIN32 and PLATFORM_X11 dependant. but due to elimination of PLATFORM_X11, which is available from Core level, GUI_X11 is available from CtrlCore level only, Image, which is included by CtrlCore does not know anything from GUI_X11. i dont have any solution for this. maybe the platform dependant stuff should be made a special class, which is implemented platform dependantly.




Smile


OK, sorry. Will deal with this soon...
Re: Rainbow, first iteration [message #32998 is a reply to message #32997] Wed, 29 June 2011 11:43 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
i'm twiddleing a bit with SDL, it should be possible to treat it as Framebuffer backend, right Smile ?

here, we got a problem with GUI_APP_MAIN define in After.h of Framebuffer. in PLATFORM_WIN32 environment, Framebuffer makes FBInit(hInstance). for SDL environment under win32 i need console app stuff Smile

wouldn't it be good to just have an APP_MAIN and the rest via compile flags? as depricated means CONSOLE_APP_MAIN and GUI_APP_MAIN would redirect to APP_MAIN.. it's just an idea. it surely implies a lot more that i dont know of.

EDIT: tried to make APP_MAIN..see patch

the decision is made automatically, via flagGUI. the others redirect to APP_MAIN. i left DLL_APP_MAIN untouched.

[Updated on: Wed, 29 June 2011 14:01]

Report message to a moderator

Re: Rainbow, first iteration [message #33003 is a reply to message #32998] Wed, 29 June 2011 19:11 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
kohait00 wrote on Wed, 29 June 2011 05:43

i'm twiddleing a bit with SDL, it should be possible to treat it as Framebuffer backend, right Smile ?

here, we got a problem with GUI_APP_MAIN define in After.h of Framebuffer. in PLATFORM_WIN32 environment, Framebuffer makes FBInit(hInstance). for SDL environment under win32 i need console app stuff Smile

wouldn't it be good to just have an APP_MAIN and the rest via compile flags? as depricated means CONSOLE_APP_MAIN and GUI_APP_MAIN would redirect to APP_MAIN.. it's just an idea. it surely implies a lot more that i dont know of.

EDIT: tried to make APP_MAIN..see patch

the decision is made automatically, via flagGUI. the others redirect to APP_MAIN. i left DLL_APP_MAIN untouched.


Hm, I guess that perhaps we should move GUI_APP_MAIN to final backend...
Re: Rainbow, first iteration [message #33004 is a reply to message #33003] Wed, 29 June 2011 20:47 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

It seems that latest svn have not Framebuffer/FB.iml file
SVN version is: 3578.
Re: Rainbow, first iteration [message #33009 is a reply to message #33004] Thu, 30 June 2011 08:33 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1428
Registered: September 2007
Ultimate Contributor
Just a quick though based on my experience with my Irrlicht back-ended GUI experimentation (without Rainbow).

What would be your recommendation on handling the lack of a windowing system? My solution is to use a "hidden" master window, which ownes everything, and the actual windows are actually fake windows, basically a slightly smarter StaticRect with frame.

Does rainbow have any support for defining an underlying windowing framework?
Re: Rainbow, first iteration [message #33011 is a reply to message #33009] Thu, 30 June 2011 09:04 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
we recently thought about extending ownership behaviour to Ctrl itself as well, optionally. but it will bring a lot of problems, i.e. what to do if Remove() is called on an owned Ctrl. destroy it? what it program expects to keep it, but simply wants to hide.. it needs to be thought out well. a windowing framework also implies opening and closing of windows. how to do that in Upp? moving/resizing, layering is already well supported. but the other half (life cycle management) is needed to..
Re: Rainbow, first iteration [message #33013 is a reply to message #33003] Thu, 30 June 2011 11:14 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
mirek wrote on Wed, 29 June 2011 19:11

Hm, I guess that perhaps we should move GUI_APP_MAIN to final backend...

i think so too. the APP_MAIN stuff posted above is running well, though. this would leave the user with only one place to think about GUI switching, this beeing the flag.
a project would always compile with or without GUI flag, even if it uses CtrlCore stuff in a console app (might be a case someday), since CtrlCore/CtrlLib don't depend on GUI flag.

BTW: with that, i managed to override APP_MAIN in SDLFb.
so SDL is painting Upp now, too but it's all rudimentary. when it compiles and draws, one can relax and continue. for me to commit the starting point, i'd need to know which final direction this APP_MAIN stuff goes to.

i'd vote for this too, (but this is sort of taste dependant):
to move the specification of the implemented gui's, beeing native, to guiplatform.h
and have the defaulting take effect in CtrlCore.h
thus it uses the same means as upper guiplatform.h
which can #include "../uppsrc/guiplatform.h"
for backwards compatibility Smile

CtrlCore.h:8
#ifndef GUIPLATFORM_INCLUDE

#ifdef PLATFORM_WIN32
#define flagWIN32GUI
#endif

#ifdef PLATFORM_POSIX
#define flagX11
#endif

//include again for defaults to activate
//guiplatform.h may not have ifndef/define protection
#include <guiplatform.h>
#endif



uppsrc/guiplatform.h
#ifdef flagWIN32GUI
#define GUIPLATFORM_INCLUDE <Ctrlcore/Win32Gui.h>
#endif

#ifdef flagX11
#define GUIPLATFORM_INCLUDE <Ctrlcore/X11Gui.h>
#endif

[Updated on: Thu, 30 June 2011 11:30]

Report message to a moderator

Re: Rainbow, first iteration [message #33040 is a reply to message #33013] Mon, 04 July 2011 13:51 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
Well, looks like it is getting somewhere:

index.php?t=getfile&id=3343&private=0

A lot of issues to resolve in Framebuffer remaining, but I guess that Rainbow itself is now "proven".
  • Attachment: Rainbow1.png
    (Size: 111.27KB, Downloaded 1133 times)
Re: Rainbow, first iteration [message #33041 is a reply to message #33040] Mon, 04 July 2011 14:12 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
looks niice..

the greatest issue for me currently (on SDL) is how to correctly process keys..

can you clarify a bit what K_DELTA and the others mean? K_ALT etc. are supposedly modifiers reported alongside the key codes.
when does Keyboard infrastructure expect ascii / unicode and when the +K_DELTA stuff. what is it for..

i think SDL will need to be a selfsustained (not Framebuffer dependant) thing. while it will loan most code from it.. but i hope to avoid it.. and keep it slim. it currently paints and processes mouse already.

BTW: is the APP_MAIN idea of any value? otherwise i'd drop my changes..


Re: Rainbow, first iteration [message #33042 is a reply to message #33041] Mon, 04 July 2011 14:35 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
kohait00 wrote on Mon, 04 July 2011 08:12


BTW: is the APP_MAIN idea of any value? otherwise i'd drop my changes..





Well, for what is worth, I have moved GUI_APP_MAIN out of Framebuffer.

I do not see the reason for "nonempty" uppsrc/guiplatform.h at the moment (other than ortogonality, but I do not think it is that important here...)
Re: Rainbow, first iteration [message #33043 is a reply to message #33042] Mon, 04 July 2011 15:03 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
no problem. was just a tweak.

do you have any K_DELTA infos Smile?
Re: Rainbow, first iteration [message #33045 is a reply to message #33043] Mon, 04 July 2011 15:32 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
K_DELTA is 65536, which > that all unicode characters (well, in theory it is not, but in practice, it is).

They idea is that Key is supposed to manage ALL key events - that includes (unicode) character events and other key events. Thus first 65536 values are reserved for character events and other events, like "K_UP" or "K_A" have K_DELTA (originally, in Win32, K_DELTA is added to noncharacter keycode).

Maybe we could figure out a better synonym Smile But basically it means "this is not a character".

Mirek
Re: Rainbow, first iteration [message #33046 is a reply to message #33045] Mon, 04 July 2011 20:58 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
did i understand you right, that key, first expects keydown/keyup events to be send, and then (after respective keyup) the corresponding char event? which windows is already doing natively, WM_KEYDOWN/UP and WM_CHAR.. (do you fake this for X11?)

Re: Rainbow, first iteration [message #33047 is a reply to message #33046] Mon, 04 July 2011 22:57 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
kohait00 wrote on Mon, 04 July 2011 14:58

did i understand you right, that key, first expects keydown/keyup events to be send, and then (after respective keyup) the corresponding char event?



Nope, characer is issued after keydown of course. For 'a' the sequence is K_A, 'a', K_A|K_KEYUP.

Quote:


which windows is already doing natively, WM_KEYDOWN/UP and WM_CHAR.. (do you fake this for X11?)



No need to fake, X11 is quite similiar, the only difference is that it only has KeyPress/KeyRelease and you convert to chars using some functions functions...

I guess these two levels naturally have to be on any system.

Mirek
Re: Rainbow, first iteration [message #33048 is a reply to message #33047] Mon, 04 July 2011 23:29 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
OK.

i just commited a first shot SDLFb..
as i am not too experienced in SDL actually, there will be a lot to do yet.

we should think about grouping all the real Fb backends under Framebuffer. so the user actually does not need to add each and every backend at top level. Framebuffer could add them all and enable it with the right compile flag..

the speed of the stuff is actually really suboptimal due to full memcopy each repaint, i will try to fix this soon.

didn't watch the source development too carefully: have you added a BufferPainter creatable from an existing buffer yet? (specify the fb0 memmap directly as base, to speed up things).


[Updated on: Mon, 04 July 2011 23:31]

Report message to a moderator

Re: Rainbow, first iteration [message #33049 is a reply to message #33048] Mon, 04 July 2011 23:44 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
kohait00 wrote on Mon, 04 July 2011 17:29


didn't watch the source development too carefully: have you added a BufferPainter creatable from an existing buffer yet? (specify the fb0 memmap directly as base, to speed up things).



Not yet.
Re: Rainbow, first iteration [message #33053 is a reply to message #33049] Tue, 05 July 2011 10:42 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
during debug of sdl backend i noticed a bug:

Win32Wnd.cpp:857
should have parenthesis around (ctr ? .. : ..)
have the same line in SDLFb, and it properly quits only with paranthesis. so quite sure the compiler does not recognize the meaning properly.
	while(!EndSession() && !quit && (ctrl ? ctrl->IsOpen() && ctrl->InLoop() : GetTopCtrls().GetCount()))


BTW
CtrlCore.h:1007
+	bool    IsIgnoreMouse() const                        { return ignoremouse; }


shouldn't
X11Proc.cpp:49 read this? similar to Win32Proc.. the K_ALT_KEY was missing

dword Ctrl::KEYtoK(dword key)
{
	if(key == K_ALT_KEY || key == K_CTRL_KEY || key == K_SHIFT_KEY)
		return key;
	if(GetCtrl()) key |= K_CTRL;
	if(GetAlt()) key |= K_ALT;
	if(GetShift()) key |= K_SHIFT;
	return key;
}



patch0 suggested PLATFORM_X11 changes for TDraw/util.cpp..
do you have other plans for them? i attach the this single patch again. i know of the PLATFORM_X11 legacy define..but uppsrc should be clean from it..uppsrc is not old legacy Smile

EDIT: btw: is there a reason why the UWord doesnt work with WinGl? (asuming addint the right packeges). it crashes..
  • Attachment: x11.patch
    (Size: 2.50KB, Downloaded 418 times)

[Updated on: Tue, 05 July 2011 14:47]

Report message to a moderator

Re: Rainbow, first iteration [message #33071 is a reply to message #33053] Tue, 05 July 2011 22:39 Go to previous messageGo to previous message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
this has gone recently Smile must come back..
CtrlCore.h:1009
	bool    HasMouse() const;
Previous Topic: Upp Server (SVN, Redmine) down?
Next Topic: Docking package fixed and moved to uppsrc
Goto Forum:
  


Current Time: Sat Apr 25 14:49:32 GMT+2 2026

Total time taken to generate the page: 0.01119 seconds