Search Results

Search found 19322 results on 773 pages for 'sdl image'.

Page 5/773 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Problem with SDL 1.2 when setting videomode with SDL_SetVideoMode

    - by user574911
    I have a very simple program, in which I am initialising with SDL_Init(flags) and using SDL_SetVideoMode but It fails by returning null. I think I am missing some config parameters/options, if any one knows about this erro please let me know. My code is as below : if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER)) { fprintf(stderr, "Could not initialize SDL\n"); exit(1); } screen = SDL_SetVideoMode(640, 480, 0, 0); if(!screen) { fprintf(stderr, "SDL: could not set video mode - exiting\n"); exit(1); }

    Read the article

  • Slick2D - Cannot instantiate the type Image

    - by speakon
    I am getting this strange error and I cannot for the life of me figure out why: Cannot instantiate the type Image CODE: import java.awt.Image; import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.SlickException; import org.newdawn.slick.state.BasicGameState; import org.newdawn.slick.state.StateBasedGame; public class MainMenuState extends BasicGameState { int stateID = -1; Image background = null; Image startGameOption = null; Image exitOption = null; float startGameScale = 1; float exitScale = 1; MainMenuState( int stateID ) { this.stateID = stateID; } public int getID() { return stateID; } public void init(GameContainer gc, StateBasedGame sbg) throws SlickException { try { background = new Image("data/menu.jpg"); Image menuOptions = new Image("data/menuoptions.png"); startGameOption = menuOptions.getSubImage(0, 0, 377, 71); exitOption = menuOptions.getSubImage(0, 71, 377, 71); }catch (SlickException e) { System.err.print(e); } } public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException { } public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException { } } Why do I get this error? I've googled endlessly and nobody else has it, this worked fine in my other game. Any ideas?

    Read the article

  • I want to learn to program in SDL C++where do i start? I want to learn only what i need to to start making 2d games [on hold]

    - by user2644399
    Lazyfoo of Lazyfoo.net of the SDL 2d tutorial wrote that in order for me to start game programming in SDL, I need to know these concepts well; Operators, Controls, Loops, Functions, Structures, Arrays, References, Pointers, Classes, Objects how to use a template and Bitwise and/or. I want to know the fastest way to learn as much as I need of basic c++ that would allow me to make 2d games. Thanks in advance.

    Read the article

  • Best way to distribute graphics, audio and levels with an SDL game?

    - by Kristopher
    I'm working on finishing up a game written in C++ with SDL I've been working on for awhile, and I'm starting to ponder how I'm going to distribute it. It has hundreds of images that are loaded and used throughout the game, as well as a couple dozen .wav files for audio effects. What is the best way to distribute these? Should I just include the folders with all the files? Or is there a way I can package them into a single file, then open and extract them in my application? What's the best way to go about this?

    Read the article

  • PHP Scale image and then create image of specific size

    - by Ronny vdb
    The result I am trying to achieve is that the user can upload an image of any size, and the server side script will convert it to an image that has the dimension 1024x512. To save the aspect ratio of the image I first scale the image down by either the width or height to match the wanted dimensions. to do this I am using imagecopyresampled(): imagecopyresampled( $new_img, $src_img, $dst_x, $dst_y, 0, 0, $new_width, $new_height, $img_width, $img_height ) && $write_image($new_img, $new_file_path, $image_quality); If we take an image that is 1920x1200 as an example, the outputted image will be 819x512. However I still need a final result of 1024x512 so I want to add white borders to the image to will the width to 1024. How can I correct my imagecopyresampled function to acheive this?

    Read the article

  • Error loading PCX image in FreeImage library

    - by khanhhh89
    I'm using FreeImage in C++ for loading texuture from the PCX image. My FreeImage code is as following: FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; //pointer to the image data BYTE* bits(0); fif = FreeImage_GetFileType(m_fileName.c_str(), 0); if (FreeImage_FIFSupportsReading(fif)) dib = FreeImage_Load(fif, m_fileName.c_str()); //retrieve the image data bits = FreeImage_GetBits(dib); //get the image width and height width = FreeImage_GetWidth(dib); height = FreeImage_GetHeight(dib); My problem is the width and height variable are both 512, while the bits array is an empty string, which make the following OPENGL call corrupt: glTexImage2D(m_textureTarget, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, bits); While debugging, I notice that the "fif" variable (which contains the format of the image) is JPEG, while the Image is actually PCX. I wonder whether or not the FreeImage recognize the wrong format (from PCX to JPEG), so tha the bits array is an empty string. I hope to see your explanation about this problem. Thanks so much

    Read the article

  • SDL (And Others) Virtual Key Input

    - by David C
    Today I set up the input in my application for all the different keys. This works fine except for virtual keys, for example, caret or ampersand. Keys that normally need shift to be got at. Using SDL these virtual keys don't work. As in they do not register an event. if (event.type == SDL_KEYDOWN) { switch (event.key.keysym.sym) { case SDLK_CARET: Keys[KeyCodes::Caret] = KeyState::Down; break; case SDLK_UP: Keys[KeyCodes::Up] = KeyState::Down; break; default: break; } I am absolutely sure my system works with physical keys like Up. The program queries a keystate like so: if (Keys[KeyCode] == KeyState::Down) { lua_pushboolean(L, true); } else { lua_pushboolean(L, false); } KeyCode is passed in as an argument. So why are virtual keys, or keys that need shift to get at not working using SDL's KeyDown event type? Is more code needed to get to them? Or am I being stupid?

    Read the article

  • Image in Image Algorithm

    - by Paul
    I need an algorithm written in any language to find an image inside of an image, including at different scales. Does anyone know a starting point to solving a problem like this? For example: I have an image of 800x600 and in that image is a yellow ball measuring 180 pixels in circumference. I need to be able to find this image with a search pattern of a yellow ball having a circumference of 15 pixels. Thanks

    Read the article

  • How can I create a rectangular SDL surface filled with a particular color?

    - by user3689
    I'm learning SDL. I'd like to create rectangular surface filled with a flat color (not an image). Below is my code -- it compiles fine, but doesn't work. I'm passing the function these parameters: SDL_Surface* m_screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE ); SDL_FillRect( m_screen, &m_screen->clip_rect, SDL_MapRGB(m_screen->format,0xFF, 0xFF, 0xFF) ); ... Button button(m_screen,0,0,50,50,255,0,0) ... ... Button::Button(SDL_Surface* screen,int x,int y,int w,int h,int R, int G, int B) { SDL_Rect box; SDL_Surface * ButtonSurface; ButtonSurface = NULL ; Uint32 rmask, gmask, bmask, amask; #if SDL_BYTEORDER == SDL_BIG_ENDIAN rmask = 0xff000000; gmask = 0x00ff0000; bmask = 0x0000ff00; amask = 0x000000ff; #else rmask = 0x000000ff; gmask = 0x0000ff00; bmask = 0x00ff0000; amask = 0xff000000; #endif box.x = x; box.y = y; box.w = w; box.h = h; ButtonSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, box.w,box.h, 32, rmask, gmask, bmask, amask); if(ButtonSurface == NULL) { LOG_MSG("Button::Button Button failed"); } SDL_FillRect(screen,&box,SDL_MapRGB ( ButtonSurface->format, R, G, B )); //ut.ApplySurface(0,0,ButtonSurface,screen); SDL_BlitSurface(ButtonSurface,NULL,screen,&box); } What am I doing wrong here?

    Read the article

  • Inline image and caption in article - conform caption's width to image's width

    - by Micah
    Here's my code: <div class="image"> <img src="image.jpg" alt="Image description" /> <p class="caption">This is the image caption</p> </div> Here's my CSS: .image { position: relative; float: right; margin: 8px 0 10px 10px; } .caption { font-weight: bold; color: #444666; } As is above, the caption will conform to the width of div.image. My problem is often the img varies in size, from 100px width to 250px width. I'd like to make the caption width conform to the corresponding width of the image, no matter the size. While I'd love for this to be more semantic as well, I'm not sure how easy it would be to switch p.caption with img. Of course, I'd prefer that method but am taking this a step at a time. Is there some jquery code that I can use to detect the width of the image and add that width as an inline style to the caption tag? Is there a better way to do this? I'm open to suggestions.

    Read the article

  • Calculating length of objects in binary image - algorithm

    - by Jacek
    I need to calculate length of the object in a binary image (maximum distance between the pixels inside the object). As it is a binary image, so we might consider it a 2D array with values 0 (white) and 1 (black). The thing I need is a clever (and preferably simple) algorithm to perform this operation. Keep in mind there are many objects in the image. The image to clarify: Sample input image:

    Read the article

  • Displaying Image On SmallBASIC

    - by Nathan Campos
    I want to display a image using SmallBASIC. For this I've started by searching on the references, then I found a reference for IMAGE, that is like this: IMAGE #handle, index, x, y [,sx,sy [,w,h]] Then I found another to open files(OPEN): OPEN file [FOR {INPUT|OUTPUT|APPEND}] AS #fileN But I want to know some things: What image types this function can display? There is any real example to use IMAGE?

    Read the article

  • How do i resize image file to optional sizes

    - by shuxer
    Hi I have image upload form, user attaches aimage file, and selects image size to resize the uploaded image file(200kb, 500kb, 1mb, 5mb, Original). Then my script needs to resize image file size based on user's optional size, but im not sure how to implement this feature, For example, user uploads image with one 1mb size, and if user selects 200KB to resize, then my script should save it with 200kb size. Does anyone know or have an experience on similar task ? Thanks for you reply in advance.

    Read the article

  • Image Classification - Detecting an image is cartoon-like

    - by kingb
    I have a large amount of jpeg thumbnail images ranging in size from 120x90 to 320x240 and I would like to classify them as either Real Life-like or Cartoon-like. Are there any applications that will have cartoon classification capabilities? This application should work on Linux, and should take an image path on the command-line and return either 0 or 1 (echo $?).

    Read the article

  • Which is better: SDL or SFML?

    - by William
    I'm thinking about switching from SDL to SFML, but before I do I want to know which is better. I'm mainly looking for easy sound/music, sprite rotations that are easy on the framerate/cpu, portability, and ease of installation.

    Read the article

  • Compiling SDL Games on Mac

    - by dejai
    I have a mac and I am trying to compile my projects. The standard on the wiki: g++ sdl.cpp -lSDLmain -lSDL -framework Cocoa does not seem to be working it returns that it cannot find -lSDL and -lSDLmain. Any help would be greatly appreciated.

    Read the article

  • Which library should I use for server-side image manipulation on Node.JS?

    - by Andrew
    I found a quite large list of available libraries on Node.JS wiki but I'm not sure which of those are more mature and provide better performance. Basically I want to do the following: load some images to a server from external sources put them onto one big canvas crop and mask them a bit apply a filter or two Resize the final image and give a link to it Big plus if the node package works on both Linux and Windows.

    Read the article

  • Multiple ToggleButton image with different highlight image in WPF

    - by Ryan
    I am very new to WPF and needed some pointers as to why this is not working correctly. I am trying to make a maximize button that will change to a restore button when clicked. I thought a toggle button with 2 different styles that would be changed in the code behind could work. I am first trying to get the maximize button working and have ran into a problem. I get the error 'System.Windows.Controls.Image' is not a valid value for the 'System.Windows.Controls.Image.Source' property on a Setter. in my xaml. I seem to be not understanding something completely. Any help would be most helpful :) Ryan <Style x:Key="Maximize" TargetType="{x:Type ToggleButton}"> <Style.Resources> <Image x:Key="MaxButtonImg" Source="/Project;component/Images/maxbutton.png" /> <Image x:Key="MaxButtonHighlight" Source="/Project;component/Images/maxbutton-highlight.png" /> </Style.Resources> <Setter Property="ContentTemplate"> <Setter.Value> <Image> <Image.Style> <Style TargetType="{x:Type Image}"> <Setter Property="Source" Value="{DynamicResource MaxButtonImg}"/> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Source" Value="{DynamicResource MaxButtonHighlight}"/> </Trigger> </Style.Triggers> </Style> </Image.Style> </Image> </Setter.Value> </Setter> </Style> <ToggleButton Name="MaxButton" Width="31" Height="31" BorderThickness="0" Click="MaxButton_Click" Margin="0,0,10,0" Tag="Max" Style="{DynamicResource Maximize}" /> My code behind would do something simple like this: private void MaxButton_Click(object sender, RoutedEventArgs e) { ToggleButton tg = (ToggleButton)sender; if ( tg.IsChecked == true) { tg.Style = (Style)FindResource("Restore"); this.WindowState = WindowState.Maximized; } else { tg.Style = (Style)FindResource("Maximize"); this.WindowState = WindowState.Normal; } }

    Read the article

  • J2ME Reduce Image color-depth/ Compress Image size

    - by updateraj
    Hi, I need to transmit the image from the mobile phone to the server. I am able to reduce the image screen size but not the memory size. I understand i have to deal with the color depth. J2ME does not seem to offer any scaling method which is available in J2SE: image rescaled = image.getScaledInstance(thumbWidth, thumbHeight, Image.SCALE_AREA_AVERAGING); BufferedImage biRescaled = toBufferedImage(rescaled, thumbWidth, thumbHeight, BufferedImage.TYPE_INT_RGB); How i would i tackle this ? I would like to reduce the image memory size before i transmit to the server. Thank you

    Read the article

  • Convert inline image tags like [image:123:title:size] into HTML img tags

    - by Jacques Joubert
    I am looking for help with regular expression $pattern to convert inline image tags like [image:123:title:size] into HTML img tags. here is the code: //[image:ID:caption:size] $content = '[image:38:title:800x900]'; preg_match_all( '/\[image:(\d+)(:?)([^\]]*)\]/i', $content, $images ); if( !empty( $images[0] ) ) { // There are image inline tags in the content foreach( $images[0] as $i => $tag ) { $link_ID = (int)$images[1][$i]; $caption = empty( $images[2][$i] ) ? '#' : $images[3][$i]; $size = empty( $images[4][$i] ) ? '#' : $images[4][$i]; } echo '<br />'; echo 'ID: '.$link_ID.'<br />'; echo 'Tag: '.$caption.'<br />'; echo 'size: '.$size.'<br />'; } which outputs: ID: 12 Tag: caption:size size: # Any help would be great!

    Read the article

  • how to display a image in java application after downloading the image

    - by Nubkadiya
    i want to display a image after downloading that image from a web-server i have wrote the code for downloading the image. but i cant set it up to a label or any thing other than jframe (because i want to add more buttons and labels to the GUI). here is the code to download the image from the webserver. now i want to set it to a label. please help me URL url = new URL("http://www.personal.psu.edu/acr117/blogs/audrey/images/image-2.jpg"); image = ImageIO.read(url);

    Read the article

  • how to get transform a local image to a web accessable image

    - by hguser
    Hi: Generally,if we want to display a image in the web page,we give the uri of the image resource like: http://host:port/image/xxx.jpg. Now,there are some images in my file system,and I save its absolute path in the db. Like this; id name address image 1 xxxx xxxx C:/images/xxx.jpg Now if the entity is retrived,its image should be displayed in the page. How to make it? What I thought is copy the image under the web server dir,then build its url,then the page can render it. But I wonder if this is a good idea? Is there any other way?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >