sdl

converting png to c header for sdl

吃可爱长大的小学妹 提交于 2019-12-08 11:08:41
问题 I want to say, I have searched in the internet about this topic, but it doesn't apply to my situation. I was doing modifications for a game that uses C and I'm editing the images for use for the game, but the images needs to be converted to c headers to make them work. The game is multi-platform, with builds for Windows and Android via NDK. I've actually accomplished some of the editing with "Using .c/.h images exported with gimp in SDL" as my basis for my solution, using mbin2h, which

Installing SDL on Windows for Haskell (GHC)

百般思念 提交于 2019-12-08 06:15:17
问题 Background: I've been using the gloss library for some simple diagram work. But when it came time for something more interactive, I found I wanted a more powerful library. After doing some research, I decided that I liked the features of the SDL library and wanted to try to install the Haskell bindings for it. I have to this point been unsuccessful. Part 1: How do I install and configure the SDL binaries so that they can be used by the Haskell bindings? Part 2: Which one of the numerous and

Mask part of a texture on draw with OpenGL in a fixed pipeline

Deadly 提交于 2019-12-08 05:44:02
问题 I am trying to figure out the best way to mask of sections of a texture when they ar drawn. My issue comes in the fact that I seem to have run our of alpha masks! We are using openGL to draw a custom built 2D game engine. The game is built up off of sprites and simple block textures. My desired outcome is like this: A character sprite is drawn in place (using it's alpha color to not just be a box) An item is drawn into the players hand (also using it's alpha color to draw into the scene

Xcode SDL resources folder

偶尔善良 提交于 2019-12-08 05:34:07
问题 I am making a SDL project in Xcode and I have a folder called resources where my images are stored. For my SDL application to access these images with SDL_LoadBMP the resources folder needs to be in the same folder as the executable file. I don't want to have to copy and paste my resources into the "/Users/admin/Library/Developer/Xcode/DerivedData/SDL_app-awvygturnguyeqgwpjowmouadbjf/Build/Products/Debug" folder every time I want to run an application (I don't know why all the random

SDL_BlitScaled doesn't work

余生颓废 提交于 2019-12-08 04:33:45
问题 here is my c++ code: #include <SDL2/SDL.h> SDL_Window* gWindow = NULL; SDL_Renderer* gRenderer = NULL; int main( int argc, char* args[] ) { SDL_Init( SDL_INIT_VIDEO ); gWindow = SDL_CreateWindow( "test", 0,0,640,480, SDL_WINDOW_SHOWN ); gRenderer = SDL_CreateRenderer(gWindow,-1,SDL_RENDERER_ACCELERATED); SDL_Surface* x = SDL_CreateRGBSurface(0,50,50,32,0xFF,0xFF00,0xFF0000,0XFF000000); SDL_Surface* y = SDL_CreateRGBSurface(0,640,480,32,0xFF,0xFF00,0xFF0000,0XFF000000); SDL_Rect a = {0,0,50,50

how to use SDL in linux?

佐手、 提交于 2019-12-08 03:12:09
问题 The linux server at my school is just a bare-bone server, no x-windows, just a command line interface. I tried to make a graphical c program on that server but found much difficulties. I use SDL library but every time I try to compile my code with gcc, I get: testcursor.c:(.text+0x1ad): undefined reference to `SDL_Init' testcursor.c:(.text+0x1b6): undefined reference to `SDL_GetError' testcursor.c:(.text+0x200): undefined reference to `SDL_SetVideoMode' ... Does anybody knows how to fix the

Installing SDL on Windows for Haskell (GHC)

百般思念 提交于 2019-12-08 03:08:30
Background: I've been using the gloss library for some simple diagram work. But when it came time for something more interactive, I found I wanted a more powerful library. After doing some research, I decided that I liked the features of the SDL library and wanted to try to install the Haskell bindings for it. I have to this point been unsuccessful. Part 1: How do I install and configure the SDL binaries so that they can be used by the Haskell bindings? Part 2: Which one of the numerous and ill documented SDL packages on Hackage it the current preferred binding in the community? How do I get

Add SDL to my path

血红的双手。 提交于 2019-12-08 02:43:49
问题 I install SDL via brew on my mac but I can't include it! Here is my too easy code: #include <SDL.h> int main(){ return 0; } when I compile it with cc, CC could not find SDL.h I found that brew install SDL in Cellar but cc did not check this folder Could you help me? 回答1: I know this post has 9 months old but if someone, somewhere in the internet try to find out how to use SDL with mac, just follow this. DL .dmg file on the SDL website (V2). Put SDL2.framework in /Library/Frameworks In your

Set Logitech Steering Wheel position/angle from SDL?

馋奶兔 提交于 2019-12-08 00:44:37
问题 I'm writing C code that controls a Logitech gaming wheel using SDL. So far I have successfully implemented the code that sets the steering wheel in autocenter mode with: SDL_HapticSetAutocenter(haptic, STRENGTH); //set autocenter I would like to be able to use the motor of the steering wheel to rotate it as desired to particular angle positions. After checking in the documentation of the API, I did not find a simple way to do it. I wonder if anyone has some advice on this. 来源: https:/

Am I calculating my FPS correctly?

心不动则不痛 提交于 2019-12-07 17:03:47
问题 So I was wondering if I'm calculating my FPS correctly: Uint32 delayFrom(float startTime, float endTime){ return(endTime - startTime ); } int main(){ int numFrames = 0; Uint32 startTime = SDL_GetTicks(); while(!done){ frameTime = 0; float fps = ( numFrames/(float)(SDL_GetTicks() - startTime) )*1000; cout << fps << endl; SDL_Delay(delayFrom(frameTime, 1/60)); ++numFrames; } } 回答1: int main() { int numFrames = 0; Uint32 startTime = SDL_GetTicks(); while (!done) { ++numFrames; Uint32 elapsedMS =