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 - JeZ-l-Lee

Pages: 1 ... 3 4 [5] 6
61
General / Having trouble setting icon...App.SetIcon(32, 32, Icon);
« on: February 06, 2009, 05:27:01 pm »
Having trouble setting icon...App.SetIcon(32, 32, Icon);

Code: [Select]
sf::Image Icon;
if (!Icon.LoadFromFile("data/graphics/Icon.bmp"))
return EXIT_FAILURE;

App.SetIcon(32, 32, Icon);


What I do wrong?
Thanks...

62
General / Release Date Of S.F.M.L. Version 1.5
« on: February 06, 2009, 05:05:01 pm »
Release Date Of S.F.M.L. Version 1.5


Hi,

I have the I.Q. of a tomato.
I do not understand how to build SFML from SVN.

When will SFML version 1.5 be released?

Thanks...

63
Audio / 1/2 Second Delay in Sound playing... Any Ideas ???
« on: February 06, 2009, 04:35:54 pm »
Quote from: "quasius"
It's most likely the time it takes to load the media from the hard drive.  If you load the sound ahead of when you need it, it should play immediately.



Hi,

No, I load the sound ahead of time outside the main game loop.
Then I play the sound in the main game loop (when [Spacebar] is pressed to skip screens.

Code: [Select]
// Load a sound effect to play...
sf::SoundBuffer Buffer;
if (!Buffer.LoadFromFile("data/sound/Click.wav"))
return EXIT_FAILURE;

sf::Sound Sound;
Sound.SetBuffer(Buffer); // Buffer is a sf::SoundBuffer

//===============================================================================================
while (visuals->App.IsOpened())
{
visuals->MilliSeconds = visuals->MyClock.GetElapsedTime();
visuals->NextFrameMS  = visuals->MilliSeconds + .01815;

visuals->FramesPerSecond++;

if (visuals->MilliSeconds >= visuals->NextSecond)
{
visuals->FPS_Array[visuals->FPS_ArrayIndex] = visuals->FramesPerSecond;

visuals->FramesPerSecond = 0;
visuals->NextSecond = visuals->MyClock.GetElapsedTime() + 1;

visuals->FPS_ArrayIndex++;
if (visuals->FPS_ArrayIndex > 9)  visuals->FPS_ArrayIndex = 0;
}

// Process events
sf::Event Event;
while (visuals->App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
visuals->App.Close();

if (Event.Type == sf::Event::KeyPressed)
{
if (Event.Key.Code == sf::Key::Space)
if (visuals->ScreenStatus == DisplayScreenForWhile)
{






//=============================================
Sound.Play(); //<-PLAY SOUND HERE (User pressed [Spacebar]...
//=============================================








visuals->ScreenStatusCounter = 1000;
}
}
}

if (visuals->ScreenToDisplay == SFMLInformationScreen)  DisplaySFMLInformationScreen();
else if (visuals->ScreenToDisplay == SilentHeroProductionsScreen)  DisplaySilentHeroProductionsScreen();
else if (visuals->ScreenToDisplay == TitleScreen)  DisplayTitleScreen();

uint16_t total = 0;
for (uint16_t index = 0; index < 10; index++)
{
total = total + visuals->FPS_Array[index];
}
total = total / 10;
sprintf(visuals->VariableText, "%d", total);
visuals->DrawTextOnScreenBuffer(visuals->VariableText, 22, sf::Color(0, 255, 0, 255), sf::Color(0, 0, 0, 255), true, 10, 10, TextLeft);

visuals->DisplayScreenBufferOnScreen();

visuals->MilliSeconds = visuals->MyClock.GetElapsedTime();
if (visuals->NextFrameMS > visuals->MilliSeconds) sf::Sleep(visuals->NextFrameMS - visuals->MilliSeconds);
}
//===============================================================================================
visuals->UnloadFontsFromMemory();

visuals->UnloadAllBMPsFromMemory();

//delete Buffer;


delete visuals;

return EXIT_SUCCESS;
}
// A 100% By JeZ+Lee and mattmatteh of Silent Hero Productions(R)...

64
Audio / 1/2 Second Delay in Sound playing... Any Ideas ???
« on: February 06, 2009, 04:00:59 am »
1/2 Second Delay in Sound playing... Any Ideas ???

Platform is Windows Vista 32bit

Code: [Select]
// Load a sound effect to play...
sf::SoundBuffer Buffer;
if (!Buffer.LoadFromFile("data/sound/Click.wav"))
return EXIT_FAILURE;

sf::Sound Sound;
Sound.SetBuffer(Buffer); // Buffer is a sf::SoundBuffer

//...

Sound.Play();


Here is the sound effect file:
http://silentheroproductions.com/files/Click.wav

65
LastDefense 100%™
Open Source 2d Space Shooter Game Using SFML
[UPDATED_08-19-2009]

--------------------------------------------------------------------------
I could use some help with testing this on various platforms!
Email me at SLNTHERO@aol.com if interested in helping.

--------------------------------------------------------------------------

DIRECT URL TO WINDOWS OS BETA:
http://www.silentheroproductions.com/files/LD100_Setup.exe
(PC Windows XP/2003/Vista/2008/7)
--------------------------------------------------------------------------

DIRECT URL TO SOURCE AND DATA:
http://www.silentheroproductions.com/files/lastdefense-linux.zip
(Builds and runs on Windows XP / Vista / 7 and ubuntu Linux - maybe OS X too)
NOTE: There was some problems on Linux - I fixed that now so should be ok now, sorry
--------------------------------------------------------------------------

Hi, I am the Autistic game designer/programmer JeZ+Lee...

My small independent video game design studio:
Silent Hero Productions(R)
www.SilentHeroProductions.com
Has completed a new game called:
LastDefense 100%™
(2-d Space Shooter)
Platform: Windows, Linux, Mac OS X
Technology: S.F.M.L. (1.5)
License: Open Source Freeware
Status: Beta version 0.99 100%

Click below for official web page URL:
http://www.silentheroproductions.com/LastDefense100PercenT.htm








66
General / Trying to center horizontally a String on screen...
« on: February 05, 2009, 06:30:05 pm »
Wow, thanks so much, got it working now...

Moving forward with game engine design!

67
General / Trying to center horizontally a String on screen...
« on: February 05, 2009, 04:08:37 am »
Hi,

Here is what I got to center a String on a 640x640 window:
Code: [Select]
//----------------------------------------------------------------------------------------------------------
void Visuals::DrawTextOnScreenBuffer(char text[256], float size, sf::Color textColor, sf::Color textOutlineColor, float screenX, float screenY, uint16_t xJustification)
{
sf::String textToDisplay(text, Arial, size);

if (xJustification == TextLeft)
{
//do nothing..
}
else if (xJustification == TextCenter)
// SHOULD WORK, BUT DOES NOT CENTER TEXT ON SCREEN (Screen = 640x640)
{
sf::Vector2<float> vector;
vector = textToDisplay.GetCenter();
screenX = 320 - vector.x;
}
else if (xJustification == TextRight) // NOT DONE YET...
{

}

for (float outlineY = screenY - 3; outlineY < screenY + 3; outlineY++)
for (float outlineX = screenX - 3; outlineX < screenX + 3; outlineX++)
{
textToDisplay.SetX(outlineX);
textToDisplay.SetY(outlineY);
textToDisplay.SetColor(textOutlineColor);
App.Draw(textToDisplay);
}

textToDisplay.SetX(screenX);
textToDisplay.SetY(screenY);
textToDisplay.SetColor(textColor);
App.Draw(textToDisplay);
}
//----------------------------------------------------------------------------------------------------------

It builds with no errors or warnings,
but the text is not centered on the screen:

68
General / JeZ+Lee is Autistic game designer, sorry...
« on: February 05, 2009, 12:39:30 am »
JeZ+Lee is Autistic game designer, sorry...

My last project using SDL game engine library:
TetriCrisis 100% Version 5.9 Remix
for PC Windows computers

http://www.silentheroproductions.com/TetriCrisis100PercenT.htm

I can make a pretty good game, but only with help from others like you!

I am a game designer with some basic C++ programming skills

Again, sorry for my stupidity - I am disabled and am just trying to make a new game for people to play and enjoy!!!

69
General / Trying to center horizontally a String on screen...
« on: February 04, 2009, 08:34:15 pm »
Trying to center horizontally a String...

Here is the code:
Code: [Select]
void Visuals::DrawTextOnScreenBuffer(char text[256], float size, sf::Color textColor, sf::Color textOutlineColor, float screenX, float screenY, uint16_t xJustification)
{
sf::String textToDisplay(text, Arial, size);

if (xJustification == TextLeft)
{
//do nothing..
}
else if (xJustification == TextCenter)
{
screenX = ( 320 - (textToDisplay.GetCenter / 2) ); //<-ERROR
|

for (float outlineY = screenY - 3; outlineY < screenY + 3; outlineY++)
for (float outlineX = screenX - 3; outlineX < screenX + 3; outlineX++)
{
textToDisplay.SetX(outlineX);
textToDisplay.SetY(outlineY);
textToDisplay.SetColor(textOutlineColor);
App.Draw(textToDisplay);
}

textToDisplay.SetX(screenX);
textToDisplay.SetY(screenY);
textToDisplay.SetColor(textColor);
App.Draw(textToDisplay);
}


Does not compile - see ERROR
Please help, thanks

70
General / Need an official SFML logo to place in my game...
« on: February 04, 2009, 05:47:08 pm »
Need an official SFML logo to place in my game...

Send to my email address:
SLNTHERO@aol.com

I do this in all of my games.
I put logo and web site at beginning of the library I am using.

Thanks....

71
General / sf::Image Image;// How I delete after use ???
« on: February 04, 2009, 05:28:17 pm »
sf::Image Image;// How I delete after use ???

Hi Again,

Killer game engine library!
Well here is part of my source, please look and help me !

Code: [Select]
sf::Image Image;

if (!Image.LoadFromFile("cute_image2.bmp"))
return EXIT_FAILURE;

Image.CreateMaskFromColor(sf::Color(0, 255, 0, 255), 0);

#define NumberOfSprites 400
sf::Sprite Sprites[NumberOfSprites];
for (uint16_t index = 0; index < NumberOfSprites; index++)
Sprites[index].SetImage(Image);

// delete Image;//  <- compiler ERROR, why? How do I delete Image???

72
General / 1st Demo Using SFML - Only Get Console Window - HELP
« on: February 04, 2009, 03:13:40 pm »
Hi,

This is known bug in 1.4 version.
If you have a USB joystick plugged into computer then unplug it and rerun your SFML application, should work now!


JeZ+Lee
SLNTHERO@aol.com
Silent Hero Productions(R)
Video Game Design Studio
http://www.SilentHeroProductions.com

73
General / sf::RenderWindow App - Call it from a C++ Class?
« on: February 04, 2009, 03:09:52 pm »
Quote from: "Laurent"
My god! I strongly recommend that you learn C++ first :)



Sorry, yes I am learning C++ as I go...
If someone can tell me why it does not work then I will be happy :)


JeZ+Lee
SLNTHERO@aol.com
Silent Hero Productions(R)
Video Game Design Studio
http://www.SilentHeroProductions.com

74
General / sf::RenderWindow App - Call it from a C++ Class?
« on: February 04, 2009, 02:44:08 pm »
Hi,

How would I call:
"sf::RenderWindow App" from within a C++ class structure ?

I declare in the header:
sf::RenderWindow App;

And have this in the Class constructor:
sf::RenderWindow App(sf::VideoMode(800, 600), "SFML window");

It builds ok, but crashes on Window creation???


Here is the source:

Class Header File:
Code: [Select]
// Visuals header File...

#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>

class Visuals
{
public:

Visuals(void);
virtual ~Visuals(void);

sf::RenderWindow App;

sf::Font Arial;

int LoadFontsIntoMemory(void);
void UnloadFontsFromMemory(void);

void DrawTextOnScreenBuffer(char text[256]);
};


Class C++ File:
Code: [Select]
// Visuals C++ File...

#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>

#include "Visuals.h"

//----------------------------------------------------------------------------------------------------------
Visuals::Visuals(void)
{
sf::RenderWindow App(sf::VideoMode(800, 600), "SFML window");
}
//----------------------------------------------------------------------------------------------------------
Visuals::~Visuals(void)
{

}
//----------------------------------------------------------------------------------------------------------
int Visuals::LoadFontsIntoMemory(void)
{
if (!Arial.LoadFromFile("arial.ttf"))
return EXIT_FAILURE;

return EXIT_SUCCESS;
}
//----------------------------------------------------------------------------------------------------------
void Visuals::UnloadFontsFromMemory(void)
{
delete &Arial;
}
//----------------------------------------------------------------------------------------------------------
void Visuals::DrawTextOnScreenBuffer(char text[256])
{
sf::String Text2(text, Arial, 50);
App.Draw(Text2);
delete &Text2;
}
//----------------------------------------------------------------------------------------------------------


main.cpp file
Code: [Select]
// SFML PerfecT+EnginE Version 5.0 GT

#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>

#include "Visuals.h"

Visuals *visuals;

int main()
{
visuals = new Visuals();

// sf::RenderWindow App(sf::VideoMode(800, 600), "SFML window");



// Load a sprite to display
sf::Image Image;

if (!Image.LoadFromFile("cute_image2.bmp"))
return EXIT_FAILURE;

Image.CreateMaskFromColor(sf::Color(0, 255, 0, 255), 0);

#define NumberOfSprites 400
sf::Sprite Sprites[NumberOfSprites];
for (uint16_t index = 0; index < NumberOfSprites; index++)
Sprites[index].SetImage(Image);
/*
// Create a graphical string to display
sf::Font Arial;
if (!Arial.LoadFromFile("arial.ttf"))
return EXIT_FAILURE;
sf::String Text("Hello SFML", Arial, 50);
*/
// Load a music to play
sf::Music Music;
if (!Music.OpenFromFile("nice_music.ogg"))
return EXIT_FAILURE;

// Play the music
Music.Play();

// Globals to be moves later:
sf::Clock MyClock;
float MilliSeconds;
float NextFrameMS;
float NextSecond = MyClock.GetElapsedTime() + 1;
uint16_t FramesPerSecond = 0;
uint16_t FPS_Array[10];
for (uint8_t index = 0; index < 10; index++)  FPS_Array[index] = 0;
uint16_t FPS_ArrayIndex = 0;

char VariableText[256];

float SpriteRotation = 0;

// For testing graphic engine speed:
for (uint16_t index = 0; index < NumberOfSprites; index++)
{
Sprites[index].SetX(sf::Randomizer::Random(0.f, 640.f));
Sprites[index].SetY(sf::Randomizer::Random(0.f, 640.f));
}

if (!visuals->LoadFontsIntoMemory())
return EXIT_FAILURE;
//===============================================================================================
// Start the game loop
while (visuals->App.IsOpened())
{
MilliSeconds = MyClock.GetElapsedTime();
NextFrameMS  = MilliSeconds + .01667;

FramesPerSecond++;

if (MilliSeconds >= NextSecond)
{
FPS_Array[FPS_ArrayIndex] = FramesPerSecond;

FramesPerSecond = 0;
NextSecond = MyClock.GetElapsedTime() + 1;

FPS_ArrayIndex++;
if (FPS_ArrayIndex > 9)  FPS_ArrayIndex = 0;
}

// Process events
sf::Event Event;
while (visuals->App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
visuals->App.Close();
}

// Clear screen
visuals->App.Clear();

SpriteRotation++;
if (SpriteRotation > 359)  SpriteRotation = 0;

//Testing...
for (uint16_t index = 0; index < NumberOfSprites; index++)
{
Sprites[index].SetCenter(Sprites[index].GetSize().x / 2, Sprites[index].GetSize().y / 2);
Sprites[index].SetRotation(SpriteRotation);
// Draw the sprite
visuals->App.Draw(Sprites[index]);
}

uint16_t total = 0;
for (uint16_t index = 0; index < 10; index++)
{
total = total + FPS_Array[index];
}
total = total / 10;
sprintf(VariableText, "%d", total);
sf::String Text(VariableText, visuals->Arial, 50);
// visuals->DrawTextOnScreenBuffer("Hi there :)");

// Update the window
visuals->App.Display();

MilliSeconds = MyClock.GetElapsedTime();
if (NextFrameMS > MilliSeconds) sf::Sleep(NextFrameMS - MilliSeconds);
}
//===============================================================================================

visuals->UnloadFontsFromMemory();

delete visuals;

return EXIT_SUCCESS;
}
// A 100% By JeZ+Lee and mattmatteh!



Thanks in advance!!!


JeZ+Lee
SLNTHERO@aol.com
Silent Hero Productions(R)
Video Game Design Studio
http://www.SilentHeroProductions.com

75
General / Is There A Work-Around For Big Joystick BUG ?
« on: February 03, 2009, 11:42:46 pm »
Is There A Work-Around For Big Joystick BUG ?


Hi,

Killer library!
Migrating from SDL to SFML now,
developing a new 2-d game engine.

Made a demo,
but on Windows and USB joystick plugged in,
the demo wont run.

SFML locks when a USB joystick in plugged in.
Is there a work-around for this (besides unpluging joystick)??


Thanks


JeZ+Lee
SLNTHERO@aol.com
Silent Hero Productions(R)
Video Game Design Studio
http://www.SilentHeroProductions.com

Pages: 1 ... 3 4 [5] 6