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.


Topics - coral

Pages: [1]
1
General / Loading the Image in a class?
« on: October 18, 2008, 10:34:09 pm »
Hi!

I am trying a bit with dynamic Image loading but i can't get it to work:

Code: [Select]

#include "KillPillar.h"
#include "libs.h"

using namespace std;

class Pillar {
private:
//Pillarinfo
int number;
string name;
int layer;

//SRPITELOADING
vector<sf::Sprite> sprites;
vector<sf::Image> images;
vector<string> names;

public:

bool loadsprite (string filename, string name) {
sf::Image Image;
if (!Image.LoadFromFile(filename)) {
return 0;
}
images.push_back(Image);
sf::Sprite Sprite(Image);
sprites.push_back(Sprite);
names.push_back(name);
return 1;
}

sf::Sprite & fetchSprite (string name) {

for(int i = 0; i <= sprites.size(); i++) {
if(name == names[i]) {
  return sprites[i];
}
}
}

};


int main() {
sf::RenderWindow App(sf::VideoMode(1024, 768), "PILLAR KILLER EXTREME");
const sf::Input& Input = App.GetInput();
Pillar forsta;
if(!forsta.loadsprite("pillar.png", "start")) {
return EXIT_FAILURE;

}

while (App.IsOpened())
{

bool         LeftKeyDown     = Input.IsKeyDown(sf::Key::Left);
bool         RightKeyDown     = Input.IsKeyDown(sf::Key::Right);
bool         UpKeyDown     = Input.IsKeyDown(sf::Key::Up);
bool         DownKeyDown     = Input.IsKeyDown(sf::Key::Down);
bool EnterKeyDown = Input.IsKeyDown(sf::Key::Return);

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

if(RightKeyDown) {
forsta.fetchSprite("start").Move(2,0);
}
// Clear screen
App.Clear();

// Draw the sprite
App.Draw(forsta.fetchSprite("start"));

// Update the window
App.Display();
}

return EXIT_SUCCESS;
}


The screen turns up like this:


The proportions are right of the image but it won't show the actual picture.

I am running the SVN version of SFML, built on Mac OSX 10.5.5

2
Graphics / Layering?
« on: September 22, 2008, 07:25:12 pm »
Hi, in the process of making a game and it became very clear to me that i need to use a heavy amount of layers.

Is there a function for doing this (like moving the objects in 3d space) or do i need to write my own functions like Layer1() Layer2() which them contains app draw and that?

And i wondered if there was an easy way of loading VERY EASY models into SFML (in 3D) or opengl from Blender?

3
Feature requests / Objective-C Binding?
« on: September 08, 2008, 05:20:43 pm »
Now that the OSX Cocoa port has reached a stage where it is near completion, isn't it time to make an Objective-C binding for us Cocoa developers?

Pages: [1]
anything