Updated Using raylib with Cpp (markdown)

master
Eldinur 1 년 전
부모
커밋
a83e4bc76d
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. +1
    -1
      Using-raylib-with-Cpp.md

+ 1
- 1
Using-raylib-with-Cpp.md

@ -60,7 +60,7 @@ Push_back on the vector will make a copy of aSprite in the vector and then aSpri
The copy constructor for MySprite does not load a new texture, it just copies the ID values from the source texture.
So then you have (for a short time) two objects that point to the same texture. When aSprite goes out of scope, it will call UnloadTexture and remove the texture ID from the GPU. So now you have a copy of the sprite in the container that points to an unloaded texture. This will not work for drawing.
If you want to use this pattern, you need to ensure that you don't make copies of things that contain shared resources. The simplest way to handle this is to remove the assignment and copy constructor operators and use std::move or emplace features to ensue that the container owns the data and manages the lifetime.
If you want to use this pattern, you need to ensure that you don't make copies of things that contain shared resources. The simplest way to handle this is to remove the assignment and copy constructor operators and use std::move or emplace features to ensure that the container owns the data and manages the lifetime.
```
class MySprite
{

불러오는 중...
취소
저장