Jared Maddox | 2 Aug 22:15 2015
Picon

Re: SDL Digest, Vol 104, Issue 4

> Date: Sun, 02 Aug 2015 09:52:49 +0000
> From: ".3lite" <iryont <at> gmail.com>
> To: sdl <at> lists.libsdl.org
> Subject: Re: [SDL] Lack of batching for RenderCopy/RenderCopyEx
> Message-ID: <1438509169.m2f.48439 <at> forums.libsdl.org>
> Content-Type: text/plain; charset="iso-8859-1"
>
>
> Eric Wing wrote:
>> I might suggest that individual array elements for src/dst rect must
>> always have values and can't be NULL, that way the code that is trying
>> to shuffle things into registers isn't needing to check for NULL all
>> the time.
>
>
> I agree. In fact I made a small mistake in my example. I mean't an array of objects, not array of pointers.
Including amount of elements inside the array.
>
> That is:
>
>
> Code:
> SDL_RenderCopies(SDL_Renderer*    renderer,
>                  SDL_Texture*     texture,
>                  const SDL_Rect*  srcrect,
>                  const SDL_Rect*  dstrect,
>                  int              count)
>
>
>
(Continue reading)

Sparks | 2 Aug 04:54 2015
Picon

Is there a reason to use SDL_CreateMutex() vs std::mutex?

Is there a specific reason why one would use SDL's mutex calls instead of the std::mutex calls?
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
.3lite | 1 Aug 18:09 2015
Picon

Lack of batching for RenderCopy/RenderCopyEx

Hey guys

I wanted to create yet another rendering engine for my game which would be SDL2 internal renderer besides pure Direct3D and OpenGL. The reason for that is because SDL2 has a great software renderer which might come in handy sooner or later. However, seeing the lack of batch drawing within those two functions I can deduce the impact of performance when rendering glyphs of a text and few other minor stuff when batching is more than mandatory.

Perhaps it's time to create some functions to batch few rectangles within one primitive draw call? It's pretty much the same as with already available functions of SDL_RenderDrawPoints, SDL_RenderDrawRects, and SDL_RenderFillRects. Perhaps I'm missing something and there is a specific reason behind not implementing it?
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
LBandy | 31 Jul 23:35 2015
Picon

Window resized after lost focus, and clicked inside

Hello guys,

I'm initializing a Window like this:

Uint32 flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_MOUSE_FOCUS | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_OPENGL;
SDL_Window* MainWindow = SDL_CreateWindow("Name", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, WindowMaxWidth, WindowMaxHeight, flags);

SDL_MaximizeWindow(MainWindow);
SDL_SetWindowMinimumSize(MainWindow, WindowMaxWidth, WindowMaxHeight);

This starts up fine, and sets the Window to be maximized. However, when I open up another window (any other program), and then click it, so the SDL program loses focus, when I click back inside the window of the SDL program, it receives a Window event:

event.type = SDL_WINDOWEVENT
event.window.event = SDL_WINDOWEVENT_RESIZED

And being resized to the minimum size I've set. Is there a way to prevent this functionality, and only have the window resized when the actual resize button pressed, or the screen borders are dragged?

Thank you!



ePic Character Generator - endless character stream in your games using SDL 2.0:
http://www.epicgenerator.net

Teaser video:
https://www.youtube.com/watch?v=giFIO1vFw1o&hd=1
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
T. Joseph Carter | 30 Jul 10:06 2015

Re: Under SDL2, how to 3D rotate a image?

Stuff like that isn't part of SDL per se. If you're using OpenGL, you'd follow any number of basic tutorials
on model transformations, with your model being a single flat quad (2 triangles).

If not, the way to do it is to do it yourself. And even if you decide to go the OpenGL route, I recommend you do it
this way just so you understand OpenGL a little more. Create a streaming texture about 40% taller than your
sample image and fill the top and bottom 20% with transparency. Draw your image in the middle and put it on
the screen where you want it.  (Remember to offset your Y axis by the extra 20%! Also save the surface you
loaded the image into for the next step.)

Now modify your program to run a loop with a delay. Each iteration, you'll "rotate" your texture.  We'll
approach that in two separate steps and a few sub-steps.

First let's give the illusion of distance. You're going to lerp (linear[ly] interpolate) the column
pixels to do that. For this example you'll only be working with at most three pixels (possibly at most two)
at a time and you can find formulas for it easily enough online. Basically you need to know your scale factor
(at most 140%) and to figure out how much of any two pixels goes into any one pixel.

You may see weighting described as multiplying each component of a pixel by a fraction representing how
much of it is in the pixel. Have your loop stretch and unstretch your image, say in 4 stages with a
SDL_Delay(200) between each iteration. Not very fluid but it'll move slow enough for you to see if there's
a noticeable delay in your scale routine and stay on screen for you to see the results.

Then go modify your scaler routine to shrink by 20% (but save your logic for the increase!)

Now modify it so it goes from squishing the image to stretching it. :) You should be able to modify your logic
so it will just scale a column up or down based on a single scale factor.

Ready to start making it rotate? To do that we first need to be able to linearly scale our scale factor. If
we're scaling an image by 5% on the left edge, we scale by -5% on the right. That means for a 100px wide image,
column 0 is 105%. Column 1 is 104.9%. You should now be able to make it go from 100% to 120% then down to 80% and
back to 100% on the left and the opposite direction on the right. It should still look like it's being
stretched (and it is), but you should start to get the sense of rotation being a thing.

Last step and it's a big one. You've learned to lerp your columns in choppy jumps so you could see what you're
doing. Now make it happen in two dimensions around your rotation axis—except it always gets smaller on
the X axis the further you get from 100%. How much smaller?  Well, 120% and 80% on the vertical are 0% on the
horizontal. :)  That means weighted averaging more pixels. And you'll probably discover quickly why old
games did their rotation in hops rather that smooth steps. :)

By the way, cosine starts at 1 and drops to 0 at 90 degrees and -1 at 180, then back. If you calculate your
rotation angle in radians, you can use cosine to tell you your horizontal scale (absolute value) and
whether to draw the front of the image or the back (sign).  From that you can calculate your vertical stretch
extremes on a linear scale of 80% to 120% based in both magnitude and sign.

A common speed enhancement is for programmers to use sine/cosine tables with precalculated values based
on rotation in steps. Common step values used in games are 8, 16, 256, and the not very round number of 360 for
some reason. ;)

Hope that gets you thinking.  FWIW, the column-stretch for distance? That's how Wolfenstein 3D works. They
used sprites for bad guys drawn from different angles for everything but walls. That FWIW is why there are
no stairs in Wolf3D, all walls are the same size and uniform so all you have to do is figure out your distance
to the wall for each column. Floor and ceiling are a solid color, so you need only then stretch the wall
texture accordingly.

Joseph
Sent via mobile

> On Jul 29, 2015, at 19:30, Nemo <377307289 <at> qq.com> wrote:
> 
> 3D rotate a image, but not 2D. Just like the attachment image.
> Thanks. ^ ^
> <3d_rotate.png>
> _______________________________________________
> SDL mailing list
> SDL <at> lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Nemo3773 | 30 Jul 05:01 2015

Re: Under SDL2, how to 3D rotate a image?

[IMG]http://img-host.net/image.php?di=08U6[/IMG][/img]
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
JeZ-l-Lee | 29 Jul 21:57 2015
Picon

SDL2 On Microsoft Windows 10...

Hi,

Great work!

All of my SDL2 video games work 100% on the new Windows 10...
Running Microsoft Windows 10 Pro 64Bit R.T.M.(Release To Manufacturers).

Thank you SDL2 people!



JeZxLee
JessePalser <AT> GMail <DOT> com
16BitSoft Inc.
Video Game Design Studio
www.16BitSoft.com
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
madprogrammer24 | 29 Jul 00:19 2015
Picon

Re: SDL Multithreading

Any suggestions on this? If I posted too much code I can narrow it down to the thread functions.
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Murenius | 28 Jul 15:06 2015
Picon

Error: "Renderer already associated with window"

Hello all,

I have a SDL2 project that I built so far successfully in an Ubuntu 15.04 VM. Now I assembled a new Desktop and just freshly installed Ubuntu 15.04 there as well as Code::Blocks and SDL2. I cloned my git repository, opened the Code::Blocks project and get the following error from SDL_GetError():

"Renderer already associated with window"

The call resulting in this error is







Code:
SDL_Renderer *ren = SDL_CreateRenderer(gWindow, -1, SDL_RENDERER_SOFTWARE);


I already tried substituting SDL_RENDERER_SOFTWARE by SDL_RENDERER_ACCELERATED, but the error is the same. Am I missing something obvious here? Could someone please give me a nudge in the right direction?

Thanks!
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
JeZ-l-Lee | 28 Jul 05:13 2015
Picon

"T-Crisis 100% A.I. 3rd Strike"...

Hi,

We are currently preparing our game: "T-Crisis 100% A.I. 3rd Strike" to be released on the Windows Store.
Please download the beta at below URL link and help test:
http://16bitsoft.com/files/TC3rd/Beta/T-Crisis100PercentAI3rdStrike.zip
Please post any suggestions or bugs to this forum, thanks!

Screenshots:




JeZxLee
JessePalser <AT> GMail <DOT> com
16BitSoft Inc.
Video Game Design Studio
www.16BitSoft.com
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
ancientcc | 27 Jul 13:56 2015

(iOS)UIKit_GetSupportedOrientations maybe receive invalid window

Used SDL: SDL 2.0.4(2015.7.7)

Used iOS: iOS 8.4.0

 

When user rotate device, code is into SDL_uikitviewcontroller::supportedInterfaceOrientations. supportedInterfaceOrientations will call UIKit_GetSupportedOrientations, and sends window to its' parameter.

 

But I found, window maybe invalid random. Once invalid, below statement in UIKit_GetSupportedOrientations will result to application crash.

 

SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;

 

How to solve it?

_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Gmane