parent
719f6c241e
commit
3688ff574c
@ -0,0 +1,63 @@ |
|||||||
|
############################################################################### |
||||||
|
# Set default behavior to automatically normalize line endings. |
||||||
|
############################################################################### |
||||||
|
* text=auto |
||||||
|
|
||||||
|
############################################################################### |
||||||
|
# Set default behavior for command prompt diff. |
||||||
|
# |
||||||
|
# This is need for earlier builds of msysgit that does not have it on by |
||||||
|
# default for csharp files. |
||||||
|
# Note: This is only used by command line |
||||||
|
############################################################################### |
||||||
|
#*.cs diff=csharp |
||||||
|
|
||||||
|
############################################################################### |
||||||
|
# Set the merge driver for project and solution files |
||||||
|
# |
||||||
|
# Merging from the command prompt will add diff markers to the files if there |
||||||
|
# are conflicts (Merging from VS is not affected by the settings below, in VS |
||||||
|
# the diff markers are never inserted). Diff markers may cause the following |
||||||
|
# file extensions to fail to load in VS. An alternative would be to treat |
||||||
|
# these files as binary and thus will always conflict and require user |
||||||
|
# intervention with every merge. To do so, just uncomment the entries below |
||||||
|
############################################################################### |
||||||
|
#*.sln merge=binary |
||||||
|
#*.csproj merge=binary |
||||||
|
#*.vbproj merge=binary |
||||||
|
#*.vcxproj merge=binary |
||||||
|
#*.vcproj merge=binary |
||||||
|
#*.dbproj merge=binary |
||||||
|
#*.fsproj merge=binary |
||||||
|
#*.lsproj merge=binary |
||||||
|
#*.wixproj merge=binary |
||||||
|
#*.modelproj merge=binary |
||||||
|
#*.sqlproj merge=binary |
||||||
|
#*.wwaproj merge=binary |
||||||
|
|
||||||
|
############################################################################### |
||||||
|
# behavior for image files |
||||||
|
# |
||||||
|
# image files are treated as binary by default. |
||||||
|
############################################################################### |
||||||
|
#*.jpg binary |
||||||
|
#*.png binary |
||||||
|
#*.gif binary |
||||||
|
|
||||||
|
############################################################################### |
||||||
|
# diff behavior for common document formats |
||||||
|
# |
||||||
|
# Convert binary document formats to text before diffing them. This feature |
||||||
|
# is only available from the command line. Turn it on by uncommenting the |
||||||
|
# entries below. |
||||||
|
############################################################################### |
||||||
|
#*.doc diff=astextplain |
||||||
|
#*.DOC diff=astextplain |
||||||
|
#*.docx diff=astextplain |
||||||
|
#*.DOCX diff=astextplain |
||||||
|
#*.dot diff=astextplain |
||||||
|
#*.DOT diff=astextplain |
||||||
|
#*.pdf diff=astextplain |
||||||
|
#*.PDF diff=astextplain |
||||||
|
#*.rtf diff=astextplain |
||||||
|
#*.RTF diff=astextplain |
@ -0,0 +1,363 @@ |
|||||||
|
## Ignore Visual Studio temporary files, build results, and |
||||||
|
## files generated by popular Visual Studio add-ons. |
||||||
|
## |
||||||
|
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore |
||||||
|
|
||||||
|
# User-specific files |
||||||
|
*.rsuser |
||||||
|
*.suo |
||||||
|
*.user |
||||||
|
*.userosscache |
||||||
|
*.sln.docstates |
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio) |
||||||
|
*.userprefs |
||||||
|
|
||||||
|
# Mono auto generated files |
||||||
|
mono_crash.* |
||||||
|
|
||||||
|
# Build results |
||||||
|
[Dd]ebug/ |
||||||
|
[Dd]ebugPublic/ |
||||||
|
[Rr]elease/ |
||||||
|
[Rr]eleases/ |
||||||
|
x64/ |
||||||
|
x86/ |
||||||
|
[Ww][Ii][Nn]32/ |
||||||
|
[Aa][Rr][Mm]/ |
||||||
|
[Aa][Rr][Mm]64/ |
||||||
|
bld/ |
||||||
|
[Bb]in/ |
||||||
|
[Oo]bj/ |
||||||
|
[Oo]ut/ |
||||||
|
[Ll]og/ |
||||||
|
[Ll]ogs/ |
||||||
|
|
||||||
|
# Visual Studio 2015/2017 cache/options directory |
||||||
|
.vs/ |
||||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot |
||||||
|
#wwwroot/ |
||||||
|
|
||||||
|
# Visual Studio 2017 auto generated files |
||||||
|
Generated\ Files/ |
||||||
|
|
||||||
|
# MSTest test Results |
||||||
|
[Tt]est[Rr]esult*/ |
||||||
|
[Bb]uild[Ll]og.* |
||||||
|
|
||||||
|
# NUnit |
||||||
|
*.VisualState.xml |
||||||
|
TestResult.xml |
||||||
|
nunit-*.xml |
||||||
|
|
||||||
|
# Build Results of an ATL Project |
||||||
|
[Dd]ebugPS/ |
||||||
|
[Rr]eleasePS/ |
||||||
|
dlldata.c |
||||||
|
|
||||||
|
# Benchmark Results |
||||||
|
BenchmarkDotNet.Artifacts/ |
||||||
|
|
||||||
|
# .NET Core |
||||||
|
project.lock.json |
||||||
|
project.fragment.lock.json |
||||||
|
artifacts/ |
||||||
|
|
||||||
|
# ASP.NET Scaffolding |
||||||
|
ScaffoldingReadMe.txt |
||||||
|
|
||||||
|
# StyleCop |
||||||
|
StyleCopReport.xml |
||||||
|
|
||||||
|
# Files built by Visual Studio |
||||||
|
*_i.c |
||||||
|
*_p.c |
||||||
|
*_h.h |
||||||
|
*.ilk |
||||||
|
*.meta |
||||||
|
*.obj |
||||||
|
*.iobj |
||||||
|
*.pch |
||||||
|
*.pdb |
||||||
|
*.ipdb |
||||||
|
*.pgc |
||||||
|
*.pgd |
||||||
|
*.rsp |
||||||
|
*.sbr |
||||||
|
*.tlb |
||||||
|
*.tli |
||||||
|
*.tlh |
||||||
|
*.tmp |
||||||
|
*.tmp_proj |
||||||
|
*_wpftmp.csproj |
||||||
|
*.log |
||||||
|
*.vspscc |
||||||
|
*.vssscc |
||||||
|
.builds |
||||||
|
*.pidb |
||||||
|
*.svclog |
||||||
|
*.scc |
||||||
|
|
||||||
|
# Chutzpah Test files |
||||||
|
_Chutzpah* |
||||||
|
|
||||||
|
# Visual C++ cache files |
||||||
|
ipch/ |
||||||
|
*.aps |
||||||
|
*.ncb |
||||||
|
*.opendb |
||||||
|
*.opensdf |
||||||
|
*.sdf |
||||||
|
*.cachefile |
||||||
|
*.VC.db |
||||||
|
*.VC.VC.opendb |
||||||
|
|
||||||
|
# Visual Studio profiler |
||||||
|
*.psess |
||||||
|
*.vsp |
||||||
|
*.vspx |
||||||
|
*.sap |
||||||
|
|
||||||
|
# Visual Studio Trace Files |
||||||
|
*.e2e |
||||||
|
|
||||||
|
# TFS 2012 Local Workspace |
||||||
|
$tf/ |
||||||
|
|
||||||
|
# Guidance Automation Toolkit |
||||||
|
*.gpState |
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in |
||||||
|
_ReSharper*/ |
||||||
|
*.[Rr]e[Ss]harper |
||||||
|
*.DotSettings.user |
||||||
|
|
||||||
|
# TeamCity is a build add-in |
||||||
|
_TeamCity* |
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool |
||||||
|
*.dotCover |
||||||
|
|
||||||
|
# AxoCover is a Code Coverage Tool |
||||||
|
.axoCover/* |
||||||
|
!.axoCover/settings.json |
||||||
|
|
||||||
|
# Coverlet is a free, cross platform Code Coverage Tool |
||||||
|
coverage*.json |
||||||
|
coverage*.xml |
||||||
|
coverage*.info |
||||||
|
|
||||||
|
# Visual Studio code coverage results |
||||||
|
*.coverage |
||||||
|
*.coveragexml |
||||||
|
|
||||||
|
# NCrunch |
||||||
|
_NCrunch_* |
||||||
|
.*crunch*.local.xml |
||||||
|
nCrunchTemp_* |
||||||
|
|
||||||
|
# MightyMoose |
||||||
|
*.mm.* |
||||||
|
AutoTest.Net/ |
||||||
|
|
||||||
|
# Web workbench (sass) |
||||||
|
.sass-cache/ |
||||||
|
|
||||||
|
# Installshield output folder |
||||||
|
[Ee]xpress/ |
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in |
||||||
|
DocProject/buildhelp/ |
||||||
|
DocProject/Help/*.HxT |
||||||
|
DocProject/Help/*.HxC |
||||||
|
DocProject/Help/*.hhc |
||||||
|
DocProject/Help/*.hhk |
||||||
|
DocProject/Help/*.hhp |
||||||
|
DocProject/Help/Html2 |
||||||
|
DocProject/Help/html |
||||||
|
|
||||||
|
# Click-Once directory |
||||||
|
publish/ |
||||||
|
|
||||||
|
# Publish Web Output |
||||||
|
*.[Pp]ublish.xml |
||||||
|
*.azurePubxml |
||||||
|
# Note: Comment the next line if you want to checkin your web deploy settings, |
||||||
|
# but database connection strings (with potential passwords) will be unencrypted |
||||||
|
*.pubxml |
||||||
|
*.publishproj |
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to |
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained |
||||||
|
# in these scripts will be unencrypted |
||||||
|
PublishScripts/ |
||||||
|
|
||||||
|
# NuGet Packages |
||||||
|
*.nupkg |
||||||
|
# NuGet Symbol Packages |
||||||
|
*.snupkg |
||||||
|
# The packages folder can be ignored because of Package Restore |
||||||
|
**/[Pp]ackages/* |
||||||
|
# except build/, which is used as an MSBuild target. |
||||||
|
!**/[Pp]ackages/build/ |
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed |
||||||
|
#!**/[Pp]ackages/repositories.config |
||||||
|
# NuGet v3's project.json files produces more ignorable files |
||||||
|
*.nuget.props |
||||||
|
*.nuget.targets |
||||||
|
|
||||||
|
# Microsoft Azure Build Output |
||||||
|
csx/ |
||||||
|
*.build.csdef |
||||||
|
|
||||||
|
# Microsoft Azure Emulator |
||||||
|
ecf/ |
||||||
|
rcf/ |
||||||
|
|
||||||
|
# Windows Store app package directories and files |
||||||
|
AppPackages/ |
||||||
|
BundleArtifacts/ |
||||||
|
Package.StoreAssociation.xml |
||||||
|
_pkginfo.txt |
||||||
|
*.appx |
||||||
|
*.appxbundle |
||||||
|
*.appxupload |
||||||
|
|
||||||
|
# Visual Studio cache files |
||||||
|
# files ending in .cache can be ignored |
||||||
|
*.[Cc]ache |
||||||
|
# but keep track of directories ending in .cache |
||||||
|
!?*.[Cc]ache/ |
||||||
|
|
||||||
|
# Others |
||||||
|
ClientBin/ |
||||||
|
~$* |
||||||
|
*~ |
||||||
|
*.dbmdl |
||||||
|
*.dbproj.schemaview |
||||||
|
*.jfm |
||||||
|
*.pfx |
||||||
|
*.publishsettings |
||||||
|
orleans.codegen.cs |
||||||
|
|
||||||
|
# Including strong name files can present a security risk |
||||||
|
# (https://github.com/github/gitignore/pull/2483#issue-259490424) |
||||||
|
#*.snk |
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components |
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) |
||||||
|
#bower_components/ |
||||||
|
|
||||||
|
# RIA/Silverlight projects |
||||||
|
Generated_Code/ |
||||||
|
|
||||||
|
# Backup & report files from converting an old project file |
||||||
|
# to a newer Visual Studio version. Backup files are not needed, |
||||||
|
# because we have git ;-) |
||||||
|
_UpgradeReport_Files/ |
||||||
|
Backup*/ |
||||||
|
UpgradeLog*.XML |
||||||
|
UpgradeLog*.htm |
||||||
|
ServiceFabricBackup/ |
||||||
|
*.rptproj.bak |
||||||
|
|
||||||
|
# SQL Server files |
||||||
|
*.mdf |
||||||
|
*.ldf |
||||||
|
*.ndf |
||||||
|
|
||||||
|
# Business Intelligence projects |
||||||
|
*.rdl.data |
||||||
|
*.bim.layout |
||||||
|
*.bim_*.settings |
||||||
|
*.rptproj.rsuser |
||||||
|
*- [Bb]ackup.rdl |
||||||
|
*- [Bb]ackup ([0-9]).rdl |
||||||
|
*- [Bb]ackup ([0-9][0-9]).rdl |
||||||
|
|
||||||
|
# Microsoft Fakes |
||||||
|
FakesAssemblies/ |
||||||
|
|
||||||
|
# GhostDoc plugin setting file |
||||||
|
*.GhostDoc.xml |
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio |
||||||
|
.ntvs_analysis.dat |
||||||
|
node_modules/ |
||||||
|
|
||||||
|
# Visual Studio 6 build log |
||||||
|
*.plg |
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file |
||||||
|
*.opt |
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) |
||||||
|
*.vbw |
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output |
||||||
|
**/*.HTMLClient/GeneratedArtifacts |
||||||
|
**/*.DesktopClient/GeneratedArtifacts |
||||||
|
**/*.DesktopClient/ModelManifest.xml |
||||||
|
**/*.Server/GeneratedArtifacts |
||||||
|
**/*.Server/ModelManifest.xml |
||||||
|
_Pvt_Extensions |
||||||
|
|
||||||
|
# Paket dependency manager |
||||||
|
.paket/paket.exe |
||||||
|
paket-files/ |
||||||
|
|
||||||
|
# FAKE - F# Make |
||||||
|
.fake/ |
||||||
|
|
||||||
|
# CodeRush personal settings |
||||||
|
.cr/personal |
||||||
|
|
||||||
|
# Python Tools for Visual Studio (PTVS) |
||||||
|
__pycache__/ |
||||||
|
*.pyc |
||||||
|
|
||||||
|
# Cake - Uncomment if you are using it |
||||||
|
# tools/** |
||||||
|
# !tools/packages.config |
||||||
|
|
||||||
|
# Tabs Studio |
||||||
|
*.tss |
||||||
|
|
||||||
|
# Telerik's JustMock configuration file |
||||||
|
*.jmconfig |
||||||
|
|
||||||
|
# BizTalk build output |
||||||
|
*.btp.cs |
||||||
|
*.btm.cs |
||||||
|
*.odx.cs |
||||||
|
*.xsd.cs |
||||||
|
|
||||||
|
# OpenCover UI analysis results |
||||||
|
OpenCover/ |
||||||
|
|
||||||
|
# Azure Stream Analytics local run output |
||||||
|
ASALocalRun/ |
||||||
|
|
||||||
|
# MSBuild Binary and Structured Log |
||||||
|
*.binlog |
||||||
|
|
||||||
|
# NVidia Nsight GPU debugger configuration file |
||||||
|
*.nvuser |
||||||
|
|
||||||
|
# MFractors (Xamarin productivity tool) working folder |
||||||
|
.mfractor/ |
||||||
|
|
||||||
|
# Local History for Visual Studio |
||||||
|
.localhistory/ |
||||||
|
|
||||||
|
# BeatPulse healthcheck temp database |
||||||
|
healthchecksdb |
||||||
|
|
||||||
|
# Backup folder for Package Reference Convert tool in Visual Studio 2017 |
||||||
|
MigrationBackup/ |
||||||
|
|
||||||
|
# Ionide (cross platform F# VS Code tools) working folder |
||||||
|
.ionide/ |
||||||
|
|
||||||
|
# Fody - auto-generated XML schema |
||||||
|
FodyWeavers.xsd |
@ -0,0 +1,198 @@ |
|||||||
|
#define OLC_PGE_APPLICATION |
||||||
|
#include "olcPixelGameEngine.h" |
||||||
|
|
||||||
|
using namespace olc; |
||||||
|
|
||||||
|
#define PI 3.14159 |
||||||
|
|
||||||
|
// Override base class with your custom functionality
|
||||||
|
class CardGameRef : public olc::PixelGameEngine |
||||||
|
{ |
||||||
|
enum class Color{ |
||||||
|
RED, |
||||||
|
GREEN, |
||||||
|
BLUE, |
||||||
|
YELLOW |
||||||
|
}; |
||||||
|
|
||||||
|
enum CardValue{ |
||||||
|
ZERO, |
||||||
|
ONE, |
||||||
|
TWO, |
||||||
|
THREE, |
||||||
|
FOUR, |
||||||
|
FIVE, |
||||||
|
SIX, |
||||||
|
SEVEN, |
||||||
|
EIGHT, |
||||||
|
NINE, |
||||||
|
SKIP, |
||||||
|
REVERSE, |
||||||
|
DRAWTWO, |
||||||
|
WILD, |
||||||
|
DRAWFOUR, |
||||||
|
}; |
||||||
|
|
||||||
|
struct Rect{ |
||||||
|
vf2d pos; |
||||||
|
vf2d size; |
||||||
|
}; |
||||||
|
|
||||||
|
std::vector<Decal*>IMAGES; |
||||||
|
Rect cardBorder,cardBack,skip,reverse,wild,drawTwo,drawFour; |
||||||
|
Decal*cardTilesheet; |
||||||
|
|
||||||
|
public: |
||||||
|
CardGameRef() |
||||||
|
{ |
||||||
|
// Name your application
|
||||||
|
sAppName = "Uno!"; |
||||||
|
} |
||||||
|
|
||||||
|
public: |
||||||
|
bool OnUserCreate() override |
||||||
|
{ |
||||||
|
// Called once at the start, so create things here
|
||||||
|
|
||||||
|
cardBorder={{0,0},{48,64}}; |
||||||
|
cardBack={{48,0},{48,64}}; |
||||||
|
skip={{0,64},{32,32}}; |
||||||
|
reverse={{32,64},{32,32}}; |
||||||
|
wild={{64,64},{32,32}}; |
||||||
|
drawTwo={{96,32},{32,32}}; |
||||||
|
drawFour={{96,64},{32,32}}; |
||||||
|
|
||||||
|
cardTilesheet = new Decal(new Sprite("CardGame.png")); |
||||||
|
|
||||||
|
SetPixelMode(Pixel::MASK); |
||||||
|
|
||||||
|
for(int color=0;color<4;color++){ |
||||||
|
for(int numb=0;numb<13;numb++){ |
||||||
|
Decal*card=new Decal(new Sprite(48,64)); |
||||||
|
SetDrawTarget(card->sprite); |
||||||
|
DrawPartialSprite({0,0},cardTilesheet->sprite,cardBack.pos,cardBack.size); |
||||||
|
Pixel targetCol; |
||||||
|
switch(Color(color)){ |
||||||
|
case Color::RED:{ |
||||||
|
targetCol={192,0,0}; |
||||||
|
}break; |
||||||
|
case Color::GREEN:{ |
||||||
|
targetCol={0,192,0}; |
||||||
|
}break; |
||||||
|
case Color::BLUE:{ |
||||||
|
targetCol={0,0,192}; |
||||||
|
}break; |
||||||
|
case Color::YELLOW:{ |
||||||
|
targetCol={192,192,0}; |
||||||
|
}break; |
||||||
|
} |
||||||
|
for(int y=0;y<64;y++){ |
||||||
|
for(int x=0;x<48;x++){ |
||||||
|
if(card->sprite->GetPixel(x,y)==Pixel{235,235,235}){ |
||||||
|
card->sprite->SetPixel({x,y},targetCol); |
||||||
|
} else
|
||||||
|
if(card->sprite->GetPixel(x,y)==Pixel{103,103,103}){ |
||||||
|
card->sprite->SetPixel({x,y},targetCol/2); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
DrawPartialSprite({0,0},cardTilesheet->sprite,cardBorder.pos,cardBorder.size); |
||||||
|
switch(numb){ |
||||||
|
case SKIP:{ |
||||||
|
DrawPartialSprite(vi2d{24,32}-skip.size/2,cardTilesheet->sprite,skip.pos,skip.size); |
||||||
|
}break; |
||||||
|
case REVERSE:{ |
||||||
|
DrawPartialSprite(vi2d{24,32}-reverse.size/2,cardTilesheet->sprite,reverse.pos,reverse.size); |
||||||
|
}break; |
||||||
|
case DRAWTWO:{ |
||||||
|
DrawPartialSprite(vi2d{24,32}-drawTwo.size/2,cardTilesheet->sprite,drawTwo.pos,drawTwo.size); |
||||||
|
}break; |
||||||
|
default:{ |
||||||
|
DrawString(vi2d{24,32}-GetTextSize(std::to_string(numb))/2*3,std::to_string(numb),WHITE,3); |
||||||
|
} |
||||||
|
} |
||||||
|
card->Update(); |
||||||
|
IMAGES.push_back(card); |
||||||
|
} |
||||||
|
} |
||||||
|
for(int i=0;i<3;i++){ |
||||||
|
Decal*card=new Decal(new Sprite(48,64)); |
||||||
|
SetDrawTarget(card->sprite); |
||||||
|
DrawPartialSprite({0,0},cardTilesheet->sprite,cardBack.pos,cardBack.size); |
||||||
|
switch(i){ |
||||||
|
case 0:{//Wild Card
|
||||||
|
DrawPartialSprite(vi2d{24,32}-wild.size/2,cardTilesheet->sprite,wild.pos,wild.size); |
||||||
|
}break; |
||||||
|
case 1:{//Draw Four Card
|
||||||
|
DrawPartialSprite(vi2d{24,32}-drawFour.size/2,cardTilesheet->sprite,drawFour.pos,drawFour.size); |
||||||
|
}break; |
||||||
|
} |
||||||
|
switch(i){//Two cards have black backs.
|
||||||
|
case 0: //Wild Card
|
||||||
|
case 1:{//Draw Four Card
|
||||||
|
for(int y=0;y<64;y++){ |
||||||
|
for(int x=0;x<48;x++){ |
||||||
|
if(card->sprite->GetPixel(x,y)==Pixel{235,235,235}){ |
||||||
|
card->sprite->SetPixel({x,y},BLACK); |
||||||
|
} else
|
||||||
|
if(card->sprite->GetPixel(x,y)==Pixel{103,103,103}){ |
||||||
|
card->sprite->SetPixel({x,y},BLACK/2); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
}break; |
||||||
|
default:{//This is the face down card.
|
||||||
|
for(int y=0;y<64;y++){ |
||||||
|
for(int x=0;x<48;x++){ |
||||||
|
if(card->sprite->GetPixel(x,y)==Pixel{235,235,235}){ |
||||||
|
card->sprite->SetPixel({x,y},BLACK); |
||||||
|
} else
|
||||||
|
if(card->sprite->GetPixel(x,y)==Pixel{103,103,103}){ |
||||||
|
card->sprite->SetPixel({x,y},{102,0,64}); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
DrawPartialSprite({0,0},cardTilesheet->sprite,cardBorder.pos,cardBorder.size); |
||||||
|
card->Update(); |
||||||
|
IMAGES.push_back(card); |
||||||
|
} |
||||||
|
SetDrawTarget(nullptr); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
Decal*GetCardImage(Color col,CardValue value,bool faceDown=false){ |
||||||
|
if(faceDown){ |
||||||
|
return IMAGES[IMAGES.size()-1]; |
||||||
|
} else |
||||||
|
if(value==WILD||value==DRAWFOUR){ |
||||||
|
return IMAGES[4*13+DRAWFOUR-value]; |
||||||
|
} else { |
||||||
|
return IMAGES[int(col)*13+value]; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
bool OnUserUpdate(float fElapsedTime) override |
||||||
|
{ |
||||||
|
// Called once per frame, draws random coloured pixels
|
||||||
|
float scale=256.f/(13*48); |
||||||
|
for(int color=0;color<4;color++){ |
||||||
|
for(int value=0;value<13;value++){ |
||||||
|
DrawRotatedDecal(vf2d{value*scale*48,color*scale*64}+scale*vf2d{24,32}/2,GetCardImage(Color(color),CardValue(value)),0,scale*vf2d{24,32},{scale,scale});
|
||||||
|
} |
||||||
|
} |
||||||
|
for (int value=0;value<3;value++){ |
||||||
|
DrawRotatedDecal(vf2d{value*scale*48,5*scale*64}+scale*vf2d{24,32}/2,GetCardImage(Color::RED,CardValue(value+13),value==2?true:false),0,scale*vf2d{24,32},{scale,scale});
|
||||||
|
} |
||||||
|
return true; |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
int main() |
||||||
|
{ |
||||||
|
CardGameRef demo; |
||||||
|
if (demo.Construct(256, 240, 4, 4)) |
||||||
|
demo.Start(); |
||||||
|
return 0; |
||||||
|
} |
After Width: | Height: | Size: 1.9 KiB |
@ -0,0 +1,138 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<ItemGroup Label="ProjectConfigurations"> |
||||||
|
<ProjectConfiguration Include="Debug|Win32"> |
||||||
|
<Configuration>Debug</Configuration> |
||||||
|
<Platform>Win32</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Release|Win32"> |
||||||
|
<Configuration>Release</Configuration> |
||||||
|
<Platform>Win32</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Debug|x64"> |
||||||
|
<Configuration>Debug</Configuration> |
||||||
|
<Platform>x64</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
<ProjectConfiguration Include="Release|x64"> |
||||||
|
<Configuration>Release</Configuration> |
||||||
|
<Platform>x64</Platform> |
||||||
|
</ProjectConfiguration> |
||||||
|
</ItemGroup> |
||||||
|
<PropertyGroup Label="Globals"> |
||||||
|
<VCProjectVersion>16.0</VCProjectVersion> |
||||||
|
<Keyword>Win32Proj</Keyword> |
||||||
|
<ProjectGuid>{96471df1-dbf3-4e2d-9167-b07f493bdf63}</ProjectGuid> |
||||||
|
<RootNamespace>CardGameRef</RootNamespace> |
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> |
||||||
|
</PropertyGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>true</UseDebugLibraries> |
||||||
|
<PlatformToolset>v143</PlatformToolset> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>false</UseDebugLibraries> |
||||||
|
<PlatformToolset>v143</PlatformToolset> |
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>true</UseDebugLibraries> |
||||||
|
<PlatformToolset>v143</PlatformToolset> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |
||||||
|
<ConfigurationType>Application</ConfigurationType> |
||||||
|
<UseDebugLibraries>false</UseDebugLibraries> |
||||||
|
<PlatformToolset>v143</PlatformToolset> |
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization> |
||||||
|
<CharacterSet>Unicode</CharacterSet> |
||||||
|
</PropertyGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
||||||
|
<ImportGroup Label="ExtensionSettings"> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="Shared"> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||||
|
</ImportGroup> |
||||||
|
<PropertyGroup Label="UserMacros" /> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||||
|
<ClCompile> |
||||||
|
<WarningLevel>Level3</WarningLevel> |
||||||
|
<SDLCheck>true</SDLCheck> |
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<ConformanceMode>true</ConformanceMode> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||||
|
<ClCompile> |
||||||
|
<WarningLevel>Level3</WarningLevel> |
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||||
|
<SDLCheck>true</SDLCheck> |
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<ConformanceMode>true</ConformanceMode> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||||
|
<OptimizeReferences>true</OptimizeReferences> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||||
|
<ClCompile> |
||||||
|
<WarningLevel>Level3</WarningLevel> |
||||||
|
<SDLCheck>true</SDLCheck> |
||||||
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<ConformanceMode>true</ConformanceMode> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||||
|
<ClCompile> |
||||||
|
<WarningLevel>Level3</WarningLevel> |
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||||
|
<SDLCheck>true</SDLCheck> |
||||||
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||||
|
<ConformanceMode>true</ConformanceMode> |
||||||
|
</ClCompile> |
||||||
|
<Link> |
||||||
|
<SubSystem>Console</SubSystem> |
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||||
|
<OptimizeReferences>true</OptimizeReferences> |
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation> |
||||||
|
</Link> |
||||||
|
</ItemDefinitionGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ClInclude Include="olcPixelGameEngine.h" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ClCompile Include="CardGame.cpp" /> |
||||||
|
</ItemGroup> |
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
||||||
|
<ImportGroup Label="ExtensionTargets"> |
||||||
|
</ImportGroup> |
||||||
|
</Project> |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue