sdl

SDL Mouse position Cropped after resize

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm getting some strange behaviour with the mouse position in SDL. If I re-size the window bigger, the x,y positions from either mouse events, seem to be restricted to the original window Width and Height. If there some function call that I'm missing to tell SDL that the mousing area has increased in size. The relevant parts of the app: void Resize ( int width , int height ) { WindowWidth = width ; WindowHeight = height ; /* update OpenGL */ } void Init () { glClearColor ( 0.f , 0.f , 0.f , 1.f ); Resize ( WindowWidth ,

unresolved external symbol __imp__fprintf and __imp____iob_func, SDL2

匿名 (未验证) 提交于 2019-12-03 01:33:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Could someone explain what the __imp__fprintf and __imp____iob_func unresolved external means? Because I get these errors when I'm trying to compile: 1 > SDL2main . lib ( SDL_windows_main . obj ) : error LNK2019 : unresolved external symbol __imp__fprintf referenced in function _ShowError 1 > SDL2main . lib ( SDL_windows_main . obj ) : error LNK2019 : unresolved external symbol __imp____iob_func referenced in function _ShowError 1 > E : \Documents\Visual Studio 2015 \Projects\SDL2_Test\Debug\SDL2_Test . exe : fatal error LNK1120 :

In SDL Tridion 2011, how can I process metadata on an item using the Core Service?

匿名 (未验证) 提交于 2019-12-03 01:22:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm using the Core Service to read Keyword information in SDL Tridion 2011. How can I process any metadata on the items I'm reading? I can see a Metadata property that contains a string of XML, and a MetadataSchema property that represents a link to a Schema. Should I deal directly with the XML, or is there a way to do something more like the ItemFields processing in the TOM.Net? What if I want to add metadata to an item that doesn't already have any set? 回答1: You'll need to provide your own code to parse and modify that XML, based

Way to increment objects inside an array for 2 hit detection c+

♀尐吖头ヾ 提交于 2019-12-03 01:19:20
问题 Im creating a basic game using SDL/C++. I need a way to implement 2 hit detection. When just trying one hit it works fine. Here is what i have for the two hit detection: int maxHit = 2; int hitCount = 0; // Detect collisions for(auto p : projectiles) { for(auto a : aliens) { if(p->CollidesWith(a) && hitCount == maxHit) { p->HandleCollision(); a->HandleCollision(); } if(p->CollidesWith(a) && hitCount != maxHit) { ++hitCount; } } } For some reason it works on a select few of the enemies on the

Objective-C Address of property expression

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need access address of property but have problem. example code is @interface Rectangle : NSObject { SDL_Rect wall; SDL_Rect ground; } @property SDL_Rect wall; @property SDL_Rect ground; @end @implementation Rectangle @synthesize x; @synthesize y; @end @interface Graphics : NSObject { int w; int h; } -(void) drawSurface @end @implementation Graphics -(void) drawSurface { Rectangle *rect = [[Rectangle alloc] init]; SDL_BlitSurface(camera, NULL, background, &rect.wall); } @end &rect.x is Address of property expression requested 回答1: As the

How to compile a C++ program with SDL2 on OS X?

匿名 (未验证) 提交于 2019-12-03 01:13:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This is a pretty noob question. Basically I can't seem to be able to compile a basic Hello World program on OSX (Yosemite) using the SDL2 external library. I'm trying to do this on console, without the help of any IDEs. I already installed the SDL 2.0.3 and it is located on the /Library/Frameworks/SDL2.framework path. My main file looks like this: #include <SDL2/SDL.h> #include <stdio.h> bool init(); void close(); SDL_Window* gameWindow = NULL; SDL_Surface* gameScreenSurface = NULL; bool init() { ... } void close() { ... } int main( int argc

Can&#039;t run SDL(2) on Ubuntu, No available video device

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When i try to run my program i get the following error message: SDL could not initialize! SDL_Error: No available video device I have all the necessary SDL libraries installed and I'm currently running ubuntu 15.10 Here is my simple SDL code: #include <stdio.h> #include "SDL2/SDL.h" //Screen dimension constants const int SCREEN_WIDTH = 640; const int SCREEN_HEIGHT = 480; int main(int argc, char* argv[]) { //The window we'll be rendering to SDL_Window* window = NULL; //The surface contained by the window SDL_Surface* screenSurface = NULL; /

SDL: Render Texture on top of another texture

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: i am having trouble with the following: I need to render a texture on top of another texture and then render that main texture. For example I have the blue rectangle texture, and I want to draw red rectangles on top of this blue rect. However i want them to restrict the render only on this rectangle. Like the following image: I read something about texture blit between them or something like that but im not sure if this is posible. My code looks like this: SDL_RenderCopy(ren,bluetexture,NULL,dBLUErect); SDL_RenderCopy(ren,redtexture,NULL

Static-linking of SDL2 libraries

匿名 (未验证) 提交于 2019-12-03 01:10:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using Windows 7, Code::Blocks and MinGW. I have little to no experience when it comes to compiling/building anything, especially when Code::Blocks doesn't use makefiles. I downloaded SDL2-devel-2.0.0-mingw.tar.gz (SDL Development Libraries) from http://www.libsdl.org/tmp/download-2.0.php , and I'd like to create a standalone executable using SDL2 libraries, but so far I've always had to bundle the SDL2.dll file with the executable to make it work. I've heard that I can not static-link dynamic libraries, so my only option seems to be

SDL2 Invalid renderer on SDL_GetWindowSurface and/or SDL_CreateRenderer on OSX

匿名 (未验证) 提交于 2019-12-03 01:07:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: So I've been playing around with SDL2 to see if it would suit my needs. I was following introductory examples (from lazyfoo mostly) and made a simple test. #include <stdio.h> #include <SDL.h> const int SCREEN_WIDTH = 640; const int SCREEN_HEIGHT = 480; int main(int argc, char const *argv[]) { /* The window handle */ SDL_Window* window = NULL; /* The surface contained in the window */ SDL_Surface* screen_surface = NULL; /* Init SDL */ if(SDL_Init(SDL_INIT_VIDEO) < 0) { printf("SDL could not initialize! SDL Error: %s\n", SDL_GetError());