Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions dev/msvc/olcPGE3_BuildSH/olcPGE3_BuildSH.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
<ClCompile Include="..\..\..\examples\olcPGE3_3DCube.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\examples\olcPGE3_AntiAliasing.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
Expand Down Expand Up @@ -140,8 +140,8 @@
<ClCompile Include="..\..\..\examples\olcPGE3_Pixels.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\examples\olcPGE3_Polygons.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
Expand Down
40 changes: 36 additions & 4 deletions dev/src/draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,16 +242,48 @@ void Draw::Pixel(const olc::vf2d& pos, const olc::Pixel col, const olc::Pixel ti
// otherwise do nothing
}

olc::Pixel olc::Draw::GetPixel(olc::Image& image, const olc::vf2d& pos)
olc::Pixel olc::Draw::GetPixel(olc::Image& image, const olc::vf2d& pos, const olc::Pixel failcol)
{
olc::vf2d tpos = transformAffine.forwardRound(pos);
if (tpos.x >= 0 && tpos.y >= 0 && tpos.x < float(image.Size().x) && tpos.y < float(image.Size().y))
{
PrepareImageForSW(image);
return image.Pixel(tpos);
}
else
return failcol;
}

olc::Pixel olc::Draw::GetPixel(const olc::vf2d& pos, const olc::Pixel failcol)
{
return GetPixel(GetTarget(), pos, failcol);
}

olc::Pixel olc::Draw::GetRawPixel(olc::Image& image, const olc::vi2d& pos, const olc::Pixel failcol)
{
if (pos.x >= 0 && pos.y >= 0 && pos.x < float(image.Size().x) && pos.y < float(image.Size().y))
{
PrepareImageForSW(image);
return image.Pixel(pos);
}
else
return failcol;
}

olc::Pixel olc::Draw::GetRawPixel(const olc::vi2d& pos, const olc::Pixel failcol)
{
return GetRawPixel(GetTarget(), pos, failcol);
}

olc::Pixel olc::Draw::GetUnsafeRawPixel(olc::Image& image, const olc::vi2d& pos)
{
PrepareImageForSW(image);
return image.Pixel(pos);
}

olc::Pixel olc::Draw::GetPixel(const olc::vf2d& pos)
olc::Pixel olc::Draw::GetUnsafeRawPixel(const olc::vi2d& pos)
{
PrepareImageForSW(GetTarget());
return GetTarget().Pixel(pos);
return GetUnsafeRawPixel(GetTarget(), pos);
}

void olc::Draw::Clear(const olc::Pixel& col)
Expand Down
26 changes: 24 additions & 2 deletions dev/src/draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,33 @@ namespace olc
// Read a pixel from an image (guarantees fresh)
olc::Pixel GetPixel(
olc::Image& image,
const olc::vf2d& pos);
const olc::vf2d& pos,
const olc::Pixel failcol = olc::Colour::BLACK);

// Read a pixel from target image (guarantees fresh)
olc::Pixel GetPixel(
const olc::vf2d& pos);
const olc::vf2d& pos,
const olc::Pixel failcol = olc::Colour::BLACK);

// Read an untransformed pixel from an image (guarantees fresh)
olc::Pixel GetRawPixel(
olc::Image& image,
const olc::vi2d& pos,
const olc::Pixel failcol = olc::Colour::BLACK);

// Read an untransformed pixel from target image (guarantees fresh)
olc::Pixel GetRawPixel(
const olc::vi2d& pos,
const olc::Pixel failcol = olc::Colour::BLACK);

// Read an untransformed pixel from a target image with no bounds checking (gurantees fresh)
olc::Pixel GetUnsafeRawPixel(
olc::Image& image,
const olc::vi2d& pos);

// Read an untransformed pixel from target image with no bounds checking (gurantees fresh)
olc::Pixel GetUnsafeRawPixel(
const olc::vi2d& pos);

// Clear entire draw target to specific colour
void Clear(const olc::Pixel& col);
Expand Down
2 changes: 1 addition & 1 deletion dev/src/transform2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ namespace olc
template<typename Q>
inline constexpr void rotate(const Q& v, const olc::v_2d<T>& p = { 0,0 })
{
m_stackForward.push(m_stackForward.top() * (olc::m_3d<T>::translation(-p) * olc::m_3d<T>::rotation(v) * olc::m_3d<T>::translation(p)));
m_stackForward.push(m_stackForward.top() * (olc::m_3d<T>::translation(p) * olc::m_3d<T>::rotation(v) * olc::m_3d<T>::translation(-p)));
m_stackInverse.push(m_stackForward.top().invert());
}

Expand Down
41 changes: 37 additions & 4 deletions dev/xcode_macos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,47 @@


<ul>
<li>Launch XCode and select **Clone and existing project** <br/> <img src="https://github.com/user-attachments/assets/6f3bab51-06e9-422d-acb8-27f5bfbce974"/></li>
<li>Enter the repo git link and click **Clone** <br/> <img src="https://github.com/user-attachments/assets/48273ab4-5941-43b0-ad2c-33adb70be23c" /> </li>
<li>Once the project is cloned, XCode will automatically detect the olcPGE3.xcodeproj folder and load the solution for you</li>
<li>Finally althought the olcPGE3.xcodeproj is displayed as a folder in GitHub, XCode will detected and display it as an XCode project <br/> <img src="https://github.com/user-attachments/assets/83453229-f3df-4f7f-a919-b842179abe64" /> </li>
<li>
1:Naviage to <a href="https://github.com/OneLoneCoder/olcPixelGameEngine3">https://github.com/OneLoneCoder/olcPixelGameEngine3</a><br/>
2: Select the <b>Main</b> branch <br/>
3: Click the green <b>Code</b> button dropdown <br/>
4: Click the <b>Copy</b> button to copy the git url <br/>
<img width="899" height="545" alt="image" src="https://github.com/user-attachments/assets/eda18c2a-c04b-4d33-9a6e-e9ccdab8847d" /><br/>
</li>
<li>
Launch XCode and select <b>Clone Git Repository...</b><br/>
<img width="688" height="420" alt="image" src="https://github.com/user-attachments/assets/a1316453-484b-4ee3-9db4-ea4271434f30" /><br/>
</li>
<li>
1 :Enter the repo git link and click <b>Clone</b> <br/>
<img width="688" height="420" alt="image" src="https://github.com/user-attachments/assets/2cbd1ba6-6df2-474c-bdde-fbbdca2ec4ff" /> <br/>
2: At the branch prompt select <b>main</b> <br/>
3: At the folder prompt select defaults <br/>
</li>
<li>
Open the xcode-macos folder and double click olcPGE3.xcodeproj<br>
<img width="1536" height="284" alt="image" src="https://github.com/user-attachments/assets/f116d949-c78f-41c9-ae14-50fd898239fd" /> <br/>
Wait for the project to load<br/>
</li>
<li>
1: Select Project Filter <br/>
2: Select Project,
<br/> - <b>olcPGE</b> is a Multi-header file, builds all headers in the **src** directory
<br/> - <b>olcPGE_SH</b> is a Single-header file (released version), builds the selected example in the <b>examples</b> directory using olcPixelGameEngine3.h
<img width="1385" height="888" alt="image" src="https://github.com/user-attachments/assets/12a0e283-5e9b-4a6d-bf33-1bb72f87899f" /> <br/>
3: Press play and watch the magic happen <br>
</li>
<li>
<hr/>
**IMPORTANT**<br/> This Xcode project is setup using all the defaults of xcode, therefore the debug/release folders are held within the xcode **Derived Data** folder, hence why the project is setup to auto copy the **assets** folder to the debug/release output. <br/>
If you use a different setup, please edit the xcode project settings to suit
<hr/>
</li>

</ul>

<p>
<ul >
<b>Some simple rules:</b>
<li>The olcPGE3.xcodeproj folder and files are all auto generated</li>
<li>The olcPGE3.xcodeproj folder and files should never be editied outside of XCode itself</li>
Expand Down
Loading
Loading