JeZ-l-Lee | 18 Apr 03:45 2014
Picon

SDL2: Minimize & Restore On Kubuntu 14.04 64Bit Beta 2 Issue

SDL2: Minimize & Restore On Kubuntu 14.04 64Bit Beta 2 Issue

Hi,

I recently installed Kubuntu 14.04 64Bit Beta 2 Linux OS onto my main development desktop.
I built and ran my SDL2 video game that my team made and noticed the following 2 issue:
(1) Minimize and Restore of SDL2 made window does not work?
(2) Window icon and panel icon don't work?

Any help would be appreciated in fixing the above 2 problems on Kubuntu Linux.

You can download entire source project here:
http://16bitsoft.com/V2/Files/SDL2/TC4/Beta/SDL2-TC4_Beta2.zip

Screenshot of 2 problems:



JeZ+Lee
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
gerben | 16 Apr 20:56 2014
Picon

android accelerometer

Hey all, I've been toying around with porting an old game i wrote to sdl2 and android. Now I'm not sure about the java code in the sdl accelerometer, but it seems buggy. The code below

switch (mDisplay.getRotation()) {
case Surface.ROTATION_90:
x = -event.values[1];
y = event.values[0];
break;
case Surface.ROTATION_270:
x = event.values[1];
y = -event.values[0];
break;
case Surface.ROTATION_180:
x = -event.values[1]; // everything math seems to tell me this should [0]
y = -event.values[0]; // should be [1] ????
break;
default:
x = event.values[0];
y = event.values[1];
break;
}
SDLActivity.onNativeAccel(-x / SensorManager.GRAVITY_EARTH,
y / SensorManager.GRAVITY_EARTH,
event.values[2] / SensorManager.GRAVITY_EARTH - 1);
}

in the last line you subtract 1 from the z-axis. I figure you want to get rid of gravity. But under normal usage and the logic above the gravity axis is in the y direction. The way it now makes both the y-axis close to -1 and the z-axis. With the z-axis overflowing and thus flipping between -2^15 to +2^15 with small movements
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Teknoman117 | 17 Apr 18:56 2014
Picon

Re: iOS 7 Game Controllers support

Has there been any more development on this? If not, I'll be taking a swing at it. I'm currently working on project for my software engineering class and iOS 7 joystick support would be nice for it. As it turns out there is an awesome jailbreak tweak (Controllers for All) that puts a PS4 controller driver on the device so it can be used with GameController.framework. I've read through the joystick and game controller code in the SDL repo, and its doesn't look too difficult to implement and obey the existing convention. Just don't want to do anything redundant...
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Jorge Rodriguez | 17 Apr 10:25 2014
Picon

eglWaitGL() on Android

Hello all,

First of all I've only just started using SDL so apologies for any unfamiliarity with the library or the team.

In Android_GLES_SwapWindow() SDL calls eglWaitGL():

http://hg.libsdl.org/SDL/file/0eed6a72e3c1/src/video/android/SDL_androidgl.c#l41

which the docs say is equivalent to glFinish:

https://www.khronos.org/registry/egl/sdk/docs/man/html/eglWaitGL.xhtml

So the question is, should SDL really be calling glFinish every frame?

I noticed it while trying to figure out why SDL_GL_SwapWindow was blocking for 100ms every frame. It was eglWaitGL's fault, but when I commented that out, eglSwapBuffers started blocking instead. This tells me that eglWaitGL is behaving like glFinish and will stall the pipeline every frame. I'm not sure that's what most people want out of SDL_GL_SwapWindow.

Turns out I'm just sending way too much to the driver, and I have some optimizations to do, meaning this isn't a perf problem for me right now but shakesoda in IRC said s/he does see perf problems in other situations. In the meantime jorgen asked me to post so here I am :)

--
Jorge "Vino" Rodríguez
[ Tw | Fb | G+ | Ht ]
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Nathaniel J Fries | 17 Apr 02:56 2014
Picon

Re: Static linking

when I build SDL2 with msys, there are two libraries built: one is libSDL2.dll.a, the other is libSDL2.a
libSDL2.dll.a is the import library for SDL2.dll
libSDL2.a is the static linking library

maybe it is different on linux. Try ./configure --enable-static=yes --enable-shared=no



Nate Fries
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
JeZ-l-Lee | 16 Apr 18:02 2014
Picon

SDL2 Joystick Problems On Kubuntu 14.04 64Bit Beta 2 ?

SDL2 Joystick Problems On Kubuntu 14.04 64Bit Beta 2 ?

Hi,

I was running Microsoft Windows 8.1 Pro 64Bit for many months,
but have just now installed Kubuntu 14.04 64Bit Beta 2 on my main development desktop.
(grew tired of Win 8 and wanted something better)

I installed SDL2, SDL2_Image, SDL2_Mixer, & SDL2_TTF onto my Linux.
I build my game and it has no errors or warnings.

The problem I am having is that the game registers one of my USB gamepads as being pressed [Up]?
Is the above a bug in SDL2 on Kubuntu 14.04 64Bit Beta 2 ?

I have several USB gamepads plugged into my desktop.
Can someone tell me how to fix this issue on my Linux OS ?
My knowledge of Linux is lacking so please forgive if the above is a basic question.

You can download the entire game project at the URL below:
http://16bitsoft.com/V2/Files/SDL2/TC4/Beta/SDL2-TC4_Beta2.zip
(game is 100% open-source & includes a MakeFile to build on any Linux)

Thanks!



JeZ+Lee
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
REVERSE | 16 Apr 13:20 2014

Minimal Linux configuration?

I have a project to work on, somewhat like an embedded system.

And I want to ask: what is the minimal viable linux configuration for SDL 2.0 to work without X Server?

First of all, I want to install a minimal Debian to VirtualBox, without X Server. What drivers can I use for the graphics (fullscreen and if it is possible with hw-acceleration)?

Thanks in advance!

P.S.: In the project I will use all the subsystems - graphics, sound, mouse and so on.
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Davide Coppola | 16 Apr 11:21 2014
Picon

SDL_image 2 not building JPEG support for Android x86

Yesterday I opened a bug on Bugzilla for a problem I found in SDL_image which doesn't seems to build for Android when JPEG support is enabled.

For details and a patch check the bug report: https://bugzilla.libsdl.org/show_bug.cgi?id=2501

The weird thig is that I didn't find any other mention to such problem online, can someone else confirm this bug?
 
cheers

--
Davide Coppola

_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Eric Wing | 16 Apr 01:43 2014
Picon

What is the API intent for the return value of SDL_GetKeyboardState(NULL)[scancode]?

I'm working on language bindings with SDL.
SDL_GetKeyboardState() is causing me some pain in binding, so I'm just
going to make a wrapper function for my bindings, e.g.

Uint8 SDL_GetKeyStateForScancodeEXT(SDL_Scancode scancode);

So instead of:
		Uint8* current_key_states = SDL_GetKeyboardState( nil );
		if( current_key_states[ SDL_SCANCODE_UP ] == SDL_PRESSED )
I can do this:
	if( SDL_GetKeyStateForScancodeEXT(SDL_SCANCODE_UP) == SDL_PRESSED )

But I wanted to clarify what the API intent of current_key_states[
SDL_SCANCODE_UP ] is supposed to return.

Is this always intended to return a boolean, where SDL_PRESSED is true
and SDL_RELEASED is false? Or is the intent that this is indeed a full
Uint8 and I should be using bit masks instead?

Unlike C, the intent matters for languages like Lua and Ruby because
only nil and false are false values, while 0 (a number) is a true
value. Thus in one of these languages, this won't work as many people
might expect because it is always true in in non-boolean case:

if( current_key_states[ SDL_SCANCODE_UP ] )

Thanks,
Eric
--

-- 
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
Multicoder | 15 Apr 14:28 2014
Picon

Frame rate drops when moving scene

Hello altogether,

first of all, I am kind of new to game development, so please don't beat me for making beginners mistakes
Also english is not my mother-tongue. If something I write is unclear to you, please feel free to ask and I'll try to explain what I mean

I have a tiled background where I add some objects (trees). (Here is a Screenshot: http://imgur.com/RaxKOrX.)
I can move the scene by pressing W, A, S or D.

When everything is standing still, the "Game" runs at 120 frames per second both with and without objects visible.
When I move the scene without any objects visible in it (only background), the frame rate drops to 60.
When showing some objects (which are moved with the scene, too) the frame rate drops down to 40 and I guess it would drop even further when I add more objects.

To show the objects, I use the two methods listed below.








Code:

void Map::BuildMap()
{
   // Build background tiles
   SDL_Rect rSourceTile;
   SDL_Rect rTargetTile;

   // Initialize SDL_Rects
   rSourceTile.x = 0;
   rSourceTile.y = 0;
   rSourceTile.w = 0;
   rSourceTile.h = 0;

   rTargetTile.x = 0;
   rTargetTile.y = 0;
   rTargetTile.w = 0;
   rTargetTile.h = 0;


   int init_y = (int)(fOffsetY * -1) % iBackgroundTileSize;
   int init_x = (int)(fOffsetX * -1) % iBackgroundTileSize;
   int iSpaceToBorderRight = 0;
   int iSpaceToBorderBottom = 0;
   float fTmp = 0.f;

   for (int y = init_y; y    {
      for (int x = init_x; x       {
         rTargetTile.x = x;
         rTargetTile.y = y;

         iSpaceToBorderRight = iWidth - x;
         iSpaceToBorderBottom = iHeight - y;

         // Correct X and Width of the tiles (especially the bordertiles)
         if (x          {
            fTmp = (x * -1) / ((float)iBackgroundTileSize / 100); // how much percent are the negative pixels on iBackgroundTileSize?
            fTmp = fTmp * ((float)MSurfBackgroundTile->w / 100); // how much pixels are that much percent?

            rSourceTile.x = (int)fTmp;
            rSourceTile.w = MSurfBackgroundTile->w - (int)fTmp;
            rTargetTile.x = 0;
            rTargetTile.w = iBackgroundTileSize - (x * -1);
         }
         else if (iSpaceToBorderRight          {
            fTmp = iSpaceToBorderRight / ((float)iBackgroundTileSize / 100); // how much percent are iSpaceToBorderRight pixels on iBackgroundTileSize?
            fTmp = fTmp * ((float)MSurfBackgroundTile->w / 100); // how much pixels are that much percent?

            rSourceTile.x = 0;
            rSourceTile.w = (int)fTmp;
            rTargetTile.w = iSpaceToBorderRight;
         }
         else
         {
            rSourceTile.x = 0;
            rSourceTile.w = MSurfBackgroundTile->w;
            rTargetTile.w = iBackgroundTileSize;
         }

         // Correct Y and Height of the tiles (especially the bordertiles)
         if (y          {
            fTmp = (y * -1) / ((float)iBackgroundTileSize / 100); // how much percent are the negative pixels on iBackgroundTileSize?
            fTmp = fTmp * ((float)MSurfBackgroundTile->h / 100); // how much pixels are that much percent?

            rSourceTile.y = (int)fTmp;
            rSourceTile.h = MSurfBackgroundTile->h - (int)fTmp;
            rTargetTile.y = 0;
            rTargetTile.h = iBackgroundTileSize - (y * -1);
         }
         else if (iSpaceToBorderBottom          {
            fTmp = iSpaceToBorderBottom / ((float)iBackgroundTileSize / 100); // how much percent are iSpaceToBorderBottom pixels on iBackgroundTileSize?
            fTmp = fTmp * ((float)MSurfBackgroundTile->h / 100); // how much pixels are that much percent?

            rSourceTile.y = 0;
            rSourceTile.h = (int)fTmp;
            rTargetTile.h = iSpaceToBorderBottom;
         }
         else
         {
            rSourceTile.y = 0;
            rSourceTile.h = MSurfBackgroundTile->h;
            rTargetTile.h = iBackgroundTileSize;
         }

         SDL_BlitScaled(MSurfBackgroundTile, &rSourceTile, MSurface, &rTargetTile);
      }
   }
}


void Map::BuildMapObjects()
{
   int iObjectCount = vObjects.size();

   MObj* pMObj;
   SDL_Rect rDest;

   int iMapPosX = (int)fOffsetX;
   int iMapPosY = (int)fOffsetY;

   for (int i = 0; i    {
      pMObj = vObjects.at(i);
      MOSurface = pMObj->obj->GetObjectSurface();

      // Only draw if the object is inside the visible area of the map
      // TODO: Fix bug (disappearing object at top right border)
      if ((pMObj->x >= iMapPosX && pMObj->x              pMObj->y >= iMapPosY && pMObj->y             (pMObj->x +  MOSurface->w >= iMapPosX && pMObj->x +  MOSurface->w              pMObj->y + MOSurface->h >= iMapPosY && pMObj->y + MOSurface->h       {
         rDest.x = pMObj->x - iMapPosX;
         rDest.y = pMObj->y - iMapPosY;
         rDest.w = MOSurface->w;
         rDest.h = MOSurface->h;

         SDL_BlitSurface(MOSurface, NULL, MSurface, &rDest);
      }
   }
}



It would be really nice, if you could help me stabilizing the frame rate and/or optimizing my code.

Best regards,
Daniel
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Plazmotech | 14 Apr 00:38 2014

Creating a map of Mix_Music?

I need to create a map of Mix Music with integers to play certain clips when needed. Here's what I have

AudioHandler.cpp







Code:
#ifndef __RunnyMan__AudioHandler__
#define __RunnyMan__AudioHandler__

#include
#include
#include
#include

class AudioHandler {
private:
    std::map clips;
public:
    bool init();
    bool addClip(const char *, int);
};

#endif /* defined(__RunnyMan__AudioHandler__) */


AudioHandler.h







Code:
#include "AudioHandler.h"

bool AudioHandler::init(){
    if (Mix_OpenAudio(22050, AUDIO_S16, 2, 4096) != 0){
        return 1;
    };
   
    return 0;
};

bool AudioHandler::addClip(const char * filename, int index){
    Mix_Music * music = nullptr;
    music = Mix_LoadMUS(filename);
    clips[index] = music;
   
    return true;
};


However, I keep getting








Code:
No viable overloaded '='


Why?[/code][/quote]
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Gmane