![]() |
compiling SDL2 from source for Android | ![]() |
![]() |
![]() |
Wins_Vefa
![]() |
![]() |
problem solved.
I searched for where to add
Util just added it to glext.h itself at the header. Don't know if it will be correct but the errors are gone. Now next problem:
|
||||||||||||||
|
![]() |
![]() |
Wins_Vefa
![]() |
![]() |
problem solved
For some reason SDL_haptic.c didn't saw SDL_SYS_haptic.c defined functions, though all flags were enabled. I just added SDL_sys_haptic.c contents to SDL_haptic.c in above and it is now compiling. Yeah, fine. next problem .apk application does not even installing on a device giving an error. |
||||||||||
|
![]() |
![]() |
Wins_Vefa
![]() |
![]() |
problem solved.
That was due to .apk key certification. I should have to set up signing option in my compiler fot outgoing *.apk. And Now i am FINALY get SDL to run on Android. !!! Here the next problem:
This error message returned by SDL_GetError(); |
||||||||||||
|
![]() |
How to draw a square using SDL 2.0? | ![]() |
Andrew Havens
Guest
![]() |
![]() |
Hello,
I'm getting started with SDL and am having a hard time finding tutorials that are updated to work with version 2.0. I've got the basic setup/teardown working, now I would like to do something simple like draw a square on the screen. The example that I copied is not working.
It correctly fills the screen white, but fails on the call to SDL_Rect:
How do I correctly draw a square using SDL 2.0? Thanks, -- Andrew |
||||||||||||||
|
![]() |
How to draw a square using SDL 2.0? | ![]() |
MrOzBarry
![]() |
![]() |
SDL_Rect is a struct, and in C, iirc, you can't use default constructors on structs.
That should fix it for you, I think. On Fri, Nov 1, 2013 at 12:28 PM, Andrew Havens wrote:
|
||||||||||||||||||
|
![]() |
How to draw a square using SDL 2.0? | ![]() |
MrOzBarry
![]() |
![]() |
Also, you may want to look into the Renderer API :)
On Fri, Nov 1, 2013 at 12:57 PM, Alex Barry wrote:
|
||||||||||||||||||||
|
![]() |
How to draw a square using SDL 2.0? | ![]() |
Andrew Havens
Guest
![]() |
![]() |
Unfortunately, that did not work. I get this error:
error: incompatible type for argument 2 of ‘SDL_FillRect’ Andrew On November 1, 2013 at 9:57:43 AM, Alex Barry ([email]//[/email])) wrote:
|
||||||||||||||||||||
|
![]() |
How to draw a square using SDL 2.0? | ![]() |
Mason Wheeler
Guest
![]() |
![]() |
That's because it wants a pointer to the rect, not the rect itself.
Mason On Friday, November 1, 2013 10:19 AM, Andrew Havens wrote: Unfortunately, that did not work. I get this error: error: incompatible type for argument 2 of ‘SDL_FillRect’ Andrew On November 1, 2013 at 9:57:43 AM, Alex Barry ([email]//[/email])) wrote: SDL_Rect is a struct, and in C, iirc, you can't use default constructors on structs.
That should fix it for you, I think. On Fri, Nov 1, 2013 at 12:28 PM, Andrew Havens wrote:
_______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org _______________________________________________SDL mailinghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||||||||||
|
![]() |
How to draw a square using SDL 2.0? | ![]() |
arosian
![]() |
![]() |
Andrew,
Your questions indicate that you aren't very familiar with C. You should first begin by getting acquainted with the programming language basics before utilizing a framework like SDL. You can also check out the documentation on the SDL wiki. Justin On Nov 1, 2013 1:19 PM, "Andrew Havens" wrote:
|
||||||||||||||||||||||
|
![]() |
How to draw a square using SDL 2.0? | ![]() |
Andrew Havens
Guest
![]() |
![]() |
I thought that prefixing a variable with an asterisk would create a pointer. Would this be the same thing?
SDL_Rect *rect; … SDL_FillRect(screenSurface, rect, …) It's true, I'm not super familiar with C. I'm still getting used to the syntax. Unfortunately, the SDL wiki doesn't provide many basic examples. -- Andrew On November 1, 2013 at 10:30:32 AM, Mason Wheeler ([email]//[/email])) wrote:
|
||||||||||||||||||||
|
![]() |
How to draw a square using SDL 2.0? | ![]() |
gabomdq
![]() |
![]() |
My first advice is...either look for a C tutorial and take some time to learn the language, or pick one of the scripting languages bindings for SDL (Python comes to mind) and use that, it's a much easier way to get started.
Having said that, what you probably need to do is: SDL_Rect rect = {0,0,100,100}; SDL_FillRect(screenSurface, &rect, somecolor); (You can't use a pointer that's not been initialized, I don't quite remember if you get a warning or an error from the compiler, or just a nice crash). 2013/11/1 Andrew Havens
-- Gabriel. |
||||||||||||||||||||||
|
![]() |
How to draw a square using SDL 2.0? | ![]() |
MrOzBarry
![]() |
![]() |
Yes and no. Using the asterisk creates a pointer, but if you don't assign it anything, it points wherever the compiler or runtime environment decides.Dereferencing a non-pointer variable (using '&') is good in this case because if you used a pointer directly, then you are responsible for allocating and freeing the memory for that variable. If it's not a pointer, then the runtime environment deals with memory management for you, which is always preferable.
On Fri, Nov 1, 2013 at 1:39 PM, Andrew Havens wrote:
|
||||||||||||||||||||||
|
![]() |
How to draw a square using SDL 2.0? | ![]() |
David Olofson
Guest
![]() |
![]() |
The SDL Wiki is about using the SDL API, primarily aimed at C, C++ and
similar languages. It doesn't cover the basics of any specific language - not ever C. You're probably better off learning C from books, tutorials etc specifically aimed at that. That said, C is a rather low level language, and there will be plenty of frustration if you don't really understand what you're doing. You might be better off trying a language a bit further from assembly language, unless you enjoy doing things the hard way. ;-) On Fri, Nov 1, 2013 at 6:39 PM, Andrew Havens wrote:
-- //David Olofson - Consultant, Developer, Artist, Open Source Advocate .--- Games, examples, libraries, scripting, sound, music, graphics ---. | http://consulting.olofson.net http://olofsonarcade.com | '---------------------------------------------------------------------' _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||||
|
![]() |
How to draw a square using SDL 2.0? | ![]() |
Andrew Havens
Guest
![]() |
![]() |
Ah, that makes a lot of sense. Thanks! P.S. Yes, I know C is a lower-level language than Python. I have plenty of experience with higher level languages using SDL and similar libraries. I have been learning C over the past month from online tutorials. I know I'm going to make mistakes but I'm ready to dive into writing C code even if I don't understand everything yet. That's how you learn. I understand the wiki is API documentation and not tutorials, but examples are helpful to see how the various components work together, rather than referenced in isolation. -- Andrew On November 1, 2013 at 10:49:24 AM, Alex Barry ([email]//[/email])) wrote:
|
||||||||||||||||||||||||||
|
![]() |
![]() |
Wins_Vefa
![]() |
![]() |
Oh, nicely done, guys.
Nevermind. SDL2 on android compilation issue was due to some kind of wrong options importing method to Insight Tegra. Check carefully to import existing Android project and KEEEP it's build options / configurations files! YAY, my application running on my phone! |
||||||||||
|
![]() |
How to draw a square using SDL 2.0? | ![]() |
Andreas Schiffler
Guest
![]() |
![]() |
See also this handy resource on C: http://c-faq.com
On 11/1/2013 11:01 AM, Andrew Havens wrote:
|
||||||||||||||||||||||||||||||
|
![]() |
compiling SDL2 from source for Android | ![]() |
Sam Lantinga
![]() |
![]() |
Yay! :)
On Fri, Nov 1, 2013 at 4:27 PM, Wins_Vefa wrote:
|
||||||||||||
|