Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - buggy123

Pages: 1 [2]
16
General / Why?
« on: September 05, 2009, 09:33:08 pm »
ok...wtf. On my better computer it still won't let me open the image

Failed to load image "menu_background.bmp." Reason: Can't fopen

(fopen is not a typo on my part)

17
General / Why?
« on: September 05, 2009, 08:12:03 pm »
that's...very possible actually. I'm using a really old computer...
Ok I'll try this on a better one. and see if the results change

18
General / Why?
« on: September 05, 2009, 05:46:58 am »
hm, that's a possibility. But when I used folders the console gave me a different error. (cannot locate file) and such.

but yeh...here's the exact error code I'm getting:

Failed to create image, it's internal size is too high (2048x1024)

19
General / Why?
« on: September 05, 2009, 02:13:31 am »
Ok, now I decided to just take them out of the folder, however i keeps giving me this "Image failed to create, internal size too big (size*) on the console that pops up along with my windows

what's it suppose to mean

20
General / Why?
« on: September 01, 2009, 09:56:38 pm »
yeh...i suspected it was that.

Anyways, thanks for the input guys. If this still doesn't work I'll just avoid all this trouble by taking the pictures out of the folders.

21
General / Why?
« on: September 01, 2009, 05:25:01 am »
well, the spellings correct. except for the "/" on the path it like data\art\menu\.. but if I try to do that it gives me a bunch of warnings about

warning C4129: 'm' : unrecognized character escape sequence

any thoughts?

22
General / Why?
« on: August 31, 2009, 06:14:22 am »
I'm getting the message box error I set up. And yes, I have the data folder right next to my .exe

23
General / Why?
« on: August 31, 2009, 05:33:34 am »
I'm using visual c++ 2008 express edition

24
General / Why?
« on: August 31, 2009, 04:50:57 am »
hmm...doesn't seem to be working. :(  I tried both ways and no avail. thanks for trying though guys. appreciated it

25
General / Why?
« on: August 31, 2009, 04:13:45 am »
k thanks...guess I didn't check carefully enough. btw, it's possible to load images through folders right? I have the folder in the same directory as the application and I'm sure the path is correct but it keeps failing to load O_o

26
General / Why?
« on: August 30, 2009, 11:55:32 pm »
So, I'm trying to draw a menu screen. Here's the header file and the main.cpp:

Code: [Select]
#include <SFML/Graphics.hpp>


//declarations
#define MENU 1
#define GAME 2
#define END 3

int game_state = MENU;

sf::RenderWindow App(sf::VideoMode::GetMode(1), "SFML Window");

// GRAPHICS

int load_graphics_menu(void)
{

//menu background

sf::Image menu_background;
if (!menu_background.LoadFromFile("data/art/menu/menu_background.bmp"))
{
MessageBox(NULL,
  "Fail to load image from file",
  "Error",
  NULL);

return -1;
} //Load image

sf::Sprite spt_menu_background;
spt_menu_background.SetImage(menu_background);

//menu play button

sf::Image menu_playbutton;
if (!menu_playbutton.LoadFromFile("data/art/menu/menu_playbutton.bmp"))
{
MessageBox(NULL,
  "Fail to load image from file",
  "Error",
  NULL);

return -1;
} //Load image

sf::Sprite spt_menu_playbutton;
spt_menu_playbutton.SetImage(menu_playbutton);
spt_menu_playbutton.SetPosition(475.f, 235.f);

//menu play button highlighted

sf::Image menu_playbutton_hl;
if (!menu_playbutton_hl.LoadFromFile("data/art/menu/menu_playbutton_hl.bmp"))
{
MessageBox(NULL,
  "Fail to load image from file",
  "Error",
  NULL);

return -1;
} //Load image

sf::Sprite spt_menu_playbutton_hl;
spt_menu_playbutton_hl.SetImage(menu_playbutton_hl);
spt_menu_playbutton_hl.SetPosition(475.f, 235.f);

//menu instruction button

sf::Image menu_instructionbutton;
if (!menu_instructionbutton.LoadFromFile("data/art/menu/menu_instructionbutton.bmp"))
{
MessageBox(NULL,
  "Fail to load image from file",
  "Error",
  NULL);

return -1;
} //Load image

sf::Sprite spt_menu_instructionbutton;
spt_menu_instructionbutton.SetImage(menu_instructionbutton);
spt_menu_instructionbutton.SetPosition(426.f, 324.f);

//menu instruction button highlighted

sf::Image menu_instructionbutton_hl;
if (!menu_instructionbutton_hl.LoadFromFile("data/art/menu/menu_instructionbutton_hl.bmp"))
{
MessageBox(NULL,
  "Fail to load image from file",
  "Error",
  NULL);

return -1;
} //Load image

sf::Sprite spt_menu_instructionbutton_hl;
spt_menu_instructionbutton_hl.SetImage(menu_instructionbutton_hl);
spt_menu_instructionbutton_hl.SetPosition(426.f, 324.f);
//menu exit button

sf::Image menu_exitbutton;
if (!menu_exitbutton.LoadFromFile("data/art/menu/menu_exitbutton.bmp"))
{
MessageBox(NULL,
  "Fail to load image from file",
  "Error",
  NULL);

return -1;
} //Load image

sf::Sprite spt_menu_exitbutton;
spt_menu_exitbutton.SetImage(menu_exitbutton);
spt_menu_exitbutton.SetPosition(12.f, 580.f);

//menu exit button highlighted

sf::Image menu_exitbutton_hl;
if (!menu_exitbutton_hl.LoadFromFile("data/art/menu/menu_exitbutton_hl.bmp"))
{
MessageBox(NULL,
  "Fail to load image from file",
  "Error",
  NULL);

return -1;
} //Load image

sf::Sprite spt_menu_exitbutton_hl;
spt_menu_exitbutton_hl.SetImage(menu_exitbutton_hl);
spt_menu_exitbutton_hl.SetPosition(12.f, 580.f);

return 0;
}

//INPUT

int process_input_menu(void)
 
{
sf::Event Event;
    while (App.GetEvent(Event))
    {
        // Window closed
        if (Event.Type == sf::Event::Closed)
            App.Close();

        // Escape key pressed
        if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
            App.Close();
    }
}


main.cpp

Code: [Select]
#include "UltrapingMenu.h"

int main()
{
sf::RenderWindow App(sf::VideoMode::GetMode(1), "SFML Window");

App.Create(sf::VideoMode(1024, 768, 32), "Ultraping", sf::Style::Fullscreen); //Windows creation...somehow, (1) works, (0) doesn't

load_graphics_menu();

while (App.IsOpened() && game_state == MENU)
{
process_input_menu();

App.Clear();

App.Draw(spt_menu_background);
App.Draw(spt_menu_playbutton);
App.Draw(spt_menu_instructionbutton);
App.Draw(spt_menu_exitbutton);

App.Display();
}

    return 0;
}


and here's the errors

Code: [Select]
Compiling...
main.cpp
.\main.cpp(17) : error C2065: 'spt_menu_background' : undeclared identifier
.\main.cpp(18) : error C2065: 'spt_menu_playbutton' : undeclared identifier
.\main.cpp(19) : error C2065: 'spt_menu_instructionbutton' : undeclared identifier
.\main.cpp(20) : error C2065: 'spt_menu_exitbutton' : undeclared identifier


it doesn't make any sense since I obviously declared these in my load_graphics_menu section...why do I keep getting this error?

Also, does anyone have any tips on optimizing my code? It's a bit cumbersome right now and I'm not sure how to do some things. for example, if I wanted to draw a seperate image the the mouse is hovering over the play button, how should I do that? I don't want to use pages of if and thens.

Pages: 1 [2]
anything