How to embed an SDL_Surface into GTK+ - gtk

I am writing a game using SDL, but would like to use GTK+ for controls. I therefore need to embed an SDL_Surface into GTK+. How should I do this?
Edit
The game would be a tile-based transport simulator (like OpenTTD), but instead of using SDL to display the game UI (screenshot), I would use GTK+.
(I find OpenTTD's SDL-based GUI quite clumsy because it doesn't integrate with the OS and therefore doesn't support things like copy-paste, control with the arrow and tab keys, etc.)

Not knowing much about what you're currently trying to do I suspect that SDL and GTK+ may be overlapping quite a bit, so I'm not sure how useful would it be to use both at the same time.
When writing a game the purpose of any toolkit is usually to simply talk to the windowing system and to manage inputs as all the drawing is done using GL.
If you also plan to use GTK+ for controls I'd recommend to just use GTK+ and not mix the two.
With GTK+ the best way to use GL is to use the GtkGLArea widget which gives you a canvas where to draw using standard GL calls.
If instead you don't plan to use GL but you just want to draw in software, the right widget for that purpose would be GtkDrawingArea.
By joining the #gnome-games IRC channel on the irc.gnome.org server you may find people more knownledgeable that can guide you better than me. :)

Related

Fluent Design Menus in Hololens

I'm currently designing a Hololens application and I'm pretty new to everything. The menu right now seems a little "old-school" for my taste. I'd like to create a user-friendly menu that could be pinned in place or move around as the user wishes.
I've been checking out fluent designs and found the DesignLab toolkit (https://unitylist.com/p/19/MR-Design-Labs-Unity) but its from 2017. Is there anything new I could use to make my menus?
You can use the ButtonHolographic from the HoloToolkit Example. These are flat designed uwp buttons. Take a look at the example scenes from the holotoolkit-example.
Check out the PressableButton.prefab in MRTK. This aligns pretty exactly with the system style and fluent design. There's documentation here:
https://microsoft.github.io/MixedRealityToolkit-Unity/Documentation/README_Button.html
It's relatively easy to use the same materials and shaders to create a background panel for text or other things that aren't buttons.
Keep an eye out for how the shader reacts when MRTK's simulated hand approaches it. There's a lot of cool reactive fluent elements there.

PyQt: Drag'n'Drop based Scrabble UI

I've written a simple Scrabble game with a simple Bot and Human part which can interact using consolebased I/O. Although there is already a Qt based overview of the current situation in the game: A simple custom QWidget which simply paints everything. No interaction or anything fancy yet.
(source: b52 at reaktor42.de)
My problem is that I would like to remove the consolebased interaction and switch to a new Drag'n'Drop based approach, but I'm not that familiar with PyQt and GUI development in general.
Therefor my question is, what would be a good way to go? Creating custom Layouts for Board and Rack and custom Letter Widget which would be dragable?
Thanks in advance
Oli
That looks pretty good! If you need to actually move things around on the screen using the mouse, I think the Graphics View Framework would be a better way to go than widgets.

iPad SDK for 2D graphics and gui elements?

Im looking for some sort of SDK or library on top of iOS, which might help me produce iPad/IPHONE games.
The sort of functionality Im looking for is..
GUI elements, skinnable buttons, lists, dialog boxes etc
Any routines to help with tile based games
Functions to paint and move sprites
Any vector libs to help with rotation, skew etc
Im confident I could write all this from scratch, but Im guessing theres some libraries already out there. Im not afraid of getting my hands dirty in code, so please dont slate me for asking for prebuilt stuff :)
Thanks
The defacto answer is cocos2d. Open source, MIT licensed, sprite library (including tiling map support baked in).
As for UI - Cocos has some helper utilities for dealing with UI elements, however its not very hard to skin UIKit (though the more customization you do the more drawing code you end up with).
most of the bits are already available in UIKit, but http://www.cocos2d-iphone.org/ is a framework worth looking at for game dev.
Two notes about cocos-2d:
- cocos has its own implementation of UI control called MenuItem. It can be used to easily emulate the behaviors of Buttons. There is also a simple layout algorithm to dispose this items in columns, rows, grids. There are also other controls that allow you to display text on the screen (labels). No text editors though, AFAIK.
- cocos can be easily integrated with the rest of UIKit, so it is simple to show standard "message boxes", some UIKit elements on top or behind it. I was able to use the cocos view as the child view of a UIImagePicker, for example.

Need some guidelines on iPad animation programming

I'm creating an interactive e-book for the iPad. This book will contain multiple pages that will consist of a lot of animations (frame and motion animations), transitions,... I was wondering what my development options are, should I use OpenGL, Quartz,...?
I've use UIImageView.animationImages before and found that it had really bad performance. What's the best way to draw frame based animations?
Does anybody have some good pointers to resources on this?
thanks in advance,
Thomas
I guess that depends a bit on what you'll be drawing. If you have a need for 3D, then OpenGL is the way to go, but it doesn't sound like it. I have a feeling Quartz2D is going to be just fine for your 2D drawing needs. I've done drawing with both and they have a very similar API. I think the downside of using all the raw power of OpenGL is that you have then signed up for doing most of the work yourself. I don't recommend attempting to using Core Animation high level APIs to manipulate OpenGL views.
If you do use Quartz2D and "normal" UIViews instead of OpenGL/EAGLView, then you can take advantage the many pre-canned animations Apple already build with Core Animation. This include the card flip left/right, resizing, moving (x/y translation), rotation and the ever popular e-book page curl.
The best example of iBook like custom page curl functionality I could find is this example code from High Caffeine Content. However, you don't have to bring that much math to the table if you just want to use the out of the box Core Animation stuff. The bad performance you may have encountered could have been due to anything, including older/slower hardware. They have revved the graphics chips on the new devices.

OpenGL - to use or not to use ? why - iPhone application dev

I have to develop an application "Behavior like an Tetris game".
I have never used "OpenGL" for the iPhone application developement.
Application is something like this
Red / green / blue square boxes drop from top
Red + Red + Red = Points & boxes disappears
same way user has to make combination & get points
Different levels are there.
There are three buttons Left, Right for movement & bottom for speedy fall
For this kind of application should I use open GL or NOT?
i.e. Is it possible to develop entire application with view & it's animation?
If yes then, will it be more complex as compare to open gl?
What is the advantage of using open GL?
(I know that it gives good 2d, 3d look )
(But here my question means - easy coding?)
(Or open gl is more complicated as compare to objective-c?)
(I am just asking because I am not aware of it)
Basically your options are:
Using OpenGL
Using Quartz
Using UIKit
OpenGL is a fairly complicated beast, but is by far the best way to squeeze performance out of the iPhone. Do you need it for a Tetris game, though? Almost certainly not.
Quartz is the toolkit used in Mac OS X and the iPhone to draw images and do image effects. Because I come from an OpenGL background in other languages, I find Quartz strange and frustrating. However, it is probably easier for someone who is new to both.
You can do everything here using UIKit, and it will definitely be much much easier than other options. The main disadvantage is that it's rather slow in comparison, but once again doing a Tetris-like game shouldn't matter at all.
Before you go with UIKit, though, I recommend just checking out something like Cocos 2D, which will give you the advantages of OpenGL without the headache of dealing with all of its inner workings.
From the tone of your question it looks like you're confusing what OpenGL is and isn't with regard to Objective-C.
OpenGL is a library written in the C programming language (to put it simplistically) that excels at rendering shapes (especially 3D shapes) for display on a screen. It doesn't replace Objective-C inside your program, it merely assists you in drawing the shapes. If you don't use OpenGL, you'll need to write some sort of drawing/rendering code in your NSView (or subclass) to render the blocks. By using OpenGL, you will be provided a lot of helpful C methods for drawing shapes, which otherwise you'll have to implement yourself. On top of that OpenGL has thousands of man hours worth of drawing optimizations that you can take advantage of if you use it rather than trying to implement shape rendering yourself.
Having said that, OpenGL isn't all sunshine and roses. It works like a state machine and has its own assumptions about the way it will be used (like any API). Just because you know C and Objective-C doesn't mean that using OpenGL will be trivial. If you've never written any OpenGL code, I suggest you look into a reference like the venerable Red Book.
The thing to keep in mind is that OpenGL is not a language until itself (ignoring the OpenGL shading language). Its merely a set of C functions to aid you in rendering graphics.
You may well want to ask as well on http://iphonegamedev.stackexchange.com/, the new Stack Overflow variant just for iPhone gaming.
To learn & understand what you need.
Please go through following link.
it includes all necessary links for all kind of resources that you needed.
http://maniacdev.com/2009/04/8-great-resources-for-learning-iphone-opengl-es/
Edit :
After reading your question properly ( actually my question - By r & d I found solution).
I think - you need to develop a 2d application.
Go for the following link. Best option for 2d animation.
http://code.google.com/p/cocos2d-iphone/
Don't forget to visit following link, if you needed sample codes.
http://monoclestudios.com/cocos2d_whitepaper.html