flat assembler
Message board for the users of flat assembler.

Index > Linux > windowsAPI linux equivalent

Author
Thread Post new topic Reply to topic
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee
On Windows, we can make a default window in c using Win32 API (CreateWindow, etc).

There is a "equivalent" Linux API to build window, button, labels, etc.. without using GTK+, Qt, etc.?

Im testing Ubuntu and im thinking seriously to change to that system.

_________________
Sorry if bad english.
Post 14 May 2011, 12:04
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
Most of Linux distributions (and almost all other Unixes) uses XWindow client/server interface for GUI. It is flexible but really slow system that uses a lot of machine resources only in order to transfer a some bunch of strings back and forth. Very Happy The idea of this approach is that the application, using network layer, sends GUI commands to the X server. The server interprets these commands and creates/manipulates needed windows.
The X protocol is pretty complex, so most of the applications don't communicate with the server directly, but use some library, that provides functions or objects based API.
Unfortunately all these libraries are C-centric with all HLL drawbacks.
If we are talking about low level API (similar to Win32 API) there are only 2 viable alternatives - XLib and XCB. XCB is newest and probably fastest, but it was never supposed to be used directly, so it have really inconvenient interface and almost total lack of reference materials.
XLib is the another library accessible - it have more "human-centric design" and more reference information (examples, etc.)
There is also assembly written AsmLibX. It is NASM project (on sourceforge) but the project is abandoned and I was never able to run application that use AsmLibX.
Another approach is to use some HLL "widget toolkit" like GTK or Qt or any other (there are many of them) but all they are overbloated HLL monsters and IMHO should be avoided in assembly programming. Wink
Post 14 May 2011, 12:40
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4242
Location: 2018
edfed
then, there is no good way to do graphic programming under linux?

can opengl be used as under windows?
in that case, we have a common interface simple enough to become a good basis for a graphic programming framework.
Post 22 Jul 2011, 02:23
View user's profile Send private message Visit poster's website Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 764
Location: Massachusetts, USA
bitshifter
< can opengl be used as under windows?
Yep, and Mesa is open source too!
Post 22 Jul 2011, 02:31
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
edfed wrote:
then, there is no good way to do graphic programming under linux?

can opengl be used as under windows?
in that case, we have a common interface simple enough to become a good basis for a graphic programming framework.


You can use OpenGL, but you still need some widget toolkit to make the GUI.
AFAIK, there are some widget toolkits based on OpenGL, but they are still overbloated. Very Happy
XLib really looks most suitable for assembly programming.
Well, at least I choose it for FreshLib linux port, after some tests of XCB and AsmLibX.
Post 22 Jul 2011, 09:11
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
r22



Joined: 27 Dec 2004
Posts: 805
r22
* completely useless suggestion, but could be interesting/funny *
1- On program start switch to an empty desktop
2- Render your UI to a BMP and switch to desktop background for your BMP
3- Process keyboard/mouse input on the desktop as UI commands
4- Goto step 2
That would be a truly innovative UI Very Happy
Post 22 Jul 2011, 16:36
View user's profile Send private message AIM Address Yahoo Messenger Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4242
Location: 2018
edfed
r22 wrote:
* completely useless suggestion, but could be interesting/funny *
1- On program start switch to an empty desktop
2- Render your UI to a BMP and switch to desktop background for your BMP
3- Process keyboard/mouse input on the desktop as UI commands
4- Goto step 2
That would be a truly innovative UI Very Happy


my graphic lib fool renders the ui like you said, as a bmp, and then, put it on the video memory. but in fact, what you are suggesting is to make a triple or double buffering, that is what i make for gui, and even tui. each time the cpu and the ram are used as a simulation of any machine, it can be cool to render the simulation periodically, in order to have something like real time.
a simple windows is the simulation of an electronic front panel or display board.

1: render all the graphical objects in one single image (buffer)
2: wait for vsynch (optional)
3: transfert the image to screen (video memory)
goto 1
Post 22 Jul 2011, 19:42
View user's profile Send private message Visit poster's website Reply with quote
praddo



Joined: 09 Oct 2011
Posts: 10
praddo
Why not just use GTK?
Post 10 Oct 2011, 10:32
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.