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 - lori3

Pages: [1]
1
Graphics / How do I shift background to grayscale?
« on: May 02, 2020, 01:43:12 am »
Hi.

So I'm trying to create a warcraft II clone and I'd like to shift the gameplay's display to grayscale if the in game menu gets opened.
Here is a screenshot:
https://ibb.co/G31nhtX

github to full source (it's huge though): https://github.com/lori2001/Warcraft-II-HD

I found out I'd have to shift each pixel of the image to about this amount (y is a pixel in grayscale)
y=0.3R+0.6G+0.1B

I just have no idea how it's done. =)) Could you guys please help me out?

2
SFML projects / Re: Warcraft II HD
« on: June 20, 2018, 10:52:57 am »
@FRex I honestly don't think blizzard cares abut W2 anymore. Its not really bringing them anymore money so I don't think they bother if someone tries to make a HD clone.. Anyways, I will take down the source at any request of theirs.

3
SFML projects / Warcraft II HD
« on: June 19, 2018, 10:35:00 pm »
Warcraft II HD
Oh well.. I'm working on this project for 2 months now and though I'll do it all by myself but all help is well received :)

Its a Warcraft II clone i m working on. All this time most of my efforts were put in keeping the FPS as high up as possible, and now that i have a menu that is fully working and a somewhat acceptable in-game interface and map displaying technique i thought i might share what I have been doing in hope of getting some help or at least some people who test it.

Sidenote: The source lacks proper commenting so.... uhm... sorry for that.. you may have to think a bit harder on what different functions and classes do :D :)

Here is the source: https://github.com/lori2001/Warcraft-II-HD

P.S: I probably also lack proper programming techniques as I'm new to SFML and even programming in general :D ( please don't go too hardcore on me in the comment section)

Also some screenshots:

4
Graphics / Re: Cannot center text on screen in sfml 2.5.0
« on: June 18, 2018, 10:44:32 pm »
Laurent is right.. In other words:
Quote
text.setOrigin(text.getLocalBounds().left + text.getLocalBounds().width / 2.0f, text.getLocalBounds().top + text.getLocalBounds().height / 2.0f);

5
Graphics / Re: sf::VertexArray pointers. are they possible ?
« on: June 18, 2018, 10:42:30 pm »
I found the answer. I just seem to have forgotten how to use pointers  :'(. For those seeking help in the same topic the answer is:
Quote
(*example)[0].position

6
Graphics / Tilemap behaving WEIRD...
« on: June 18, 2018, 10:39:55 pm »
Well... I don't really know how to describe this problem other than attaching 2 screenshots and my full code from github.. I mostly use the code from the tilemap tutorial ( if this helps) https://www.sfml-dev.org/tutorials/2.5/graphics-vertex-array.php#example-tile-map

The tilemap should look like the second screenshot. but somewhy it looks like the first one. The pattern only appears when going from left to right or from right to left and seems to appear on specific locations and changing the resolution doesn't seem to fix it.

Here is my full code: https://github.com/lori2001/Warcraft-II---clone

7
Graphics / sf::VertexArray pointers. are they possible ?
« on: June 17, 2018, 02:26:38 pm »
Hey.. I am trying to make an rts game.. and i have noticed that my performance is very bad...
For the last 2 weeks or so i remade the entire menu i just made with dynamic allocation however whenever i get to an entity which has a vertexarray ( the tilemap for example) i realise that i can't allocate memory dinamically to that because if i make it a pointer i cant set its position and texture coords.. is there any way to bypass that or something? pls help...

8
Graphics / Vertex Array how to draw many textures,text and outline ?
« on: June 11, 2018, 10:23:00 pm »
I have successfully set up my menu for my game however i saw a significant drop in fps when displaying about 50-60 buttons.

I searched up for ways to improve and found out that VertexArray is quite a good class for my purpose, however
I have problems setting my buttons in it:

I can't set more than one separate texture to the vertex array at once,
I can't set text to the vertex array
I can't set Outlines for my textures(buttons themselves)

here is some snippet from my code that i thought would be helpful:
Button.h
Quote
class Button : public sf::Drawable
{
private:
      const sf::Vector2f size = { 224,28 }; //this is the sprites size

sf::RectangleShape *sprite = new sf::RectangleShape{ size }; //creates a rect with that size
sf::Text *text = new sf::Text; // a text to be on the button
 /*..........*/
public:
void draw(sf::RenderTarget& target, sf::RenderStates states) const;
}

Button.cpp
Quote
   void Button::draw(sf::RenderTarget & target, sf::RenderStates states) const
   {
      target.draw(*sprite, states);
      target.draw(*text, states);
   }
/*...........*/
   void Button::setSelected(const sf::Vector2f & mouse)
   {
      isSelected = (sprite->getPosition().x - this->size.x / 2 * sprite->getScale().x <= mouse.x &&
         sprite->getPosition().x + this->size.x / 2 * sprite->getScale().x >= mouse.x &&
         sprite->getPosition().y - this->size.y / 2 * sprite->getScale().y <= mouse.y &&
         sprite->getPosition().y + this->size.y / 2 * sprite->getScale().y >= mouse.y);

      if (isSelected)
         sprite->setOutlineThickness(-1);
      else
         sprite->setOutlineThickness(0);
   }
/*.............*/

9
General / windows.h and time.h not accepted by the compiler
« on: October 21, 2017, 07:39:50 pm »
Hi.
I recently created a super mario game in windows 7.

https://youtu.be/9vcxNRgnGiY

Since then i had to reinstall windows and i choose to install windows 10 instead of 7.
The problem is that the windows.h and time.h packages are accepted no more by the compiler. It says cannot open source file.

How can i fix this ?

(link for download is in the description)

Pages: [1]