]> O.S.I.I.S - jp/crow.git/commitdiff
SDL work in progress 7/head
authorjpbruyere <jp.bruyere@hotmail.com>
Tue, 21 Jun 2016 00:00:10 +0000 (02:00 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Tue, 21 Jun 2016 00:00:10 +0000 (02:00 +0200)
SDL2Crow/SDL2.cs
SDL2Crow/SDL2Crow.csproj
SDL2Crow/main.cs
SDL2Crow/packages.config

index 62a7c0e2765b7c56f77a9e41fdb7e5771a95b313..f9a64fb5f4c45030f0f3af3e6afa2d9400f03983 100644 (file)
  */
 #endregion
 
-#region Using Statements
 using System;
 using System.Runtime.InteropServices;
-#endregion
 
 namespace SDL2
 {
-       /// <summary>
-       /// Entry point for all SDL-related (non-extension) types and methods
-       /// </summary>
-       public static class SDL
+public static class SDL
        {
                #region SDL2# Variables
-
                /// <summary>
                /// Used by DllImport to load the native library.
                /// </summary>
index dc54f567f1eeb6627f41a980f914f82c71e82dbf..941e426f830f8c04f924f5c82d4328794c41b21a 100644 (file)
@@ -10,6 +10,7 @@
     <RootNamespace>SDL2Crow</RootNamespace>
     <AssemblyName>SDL2Crow</AssemblyName>
     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <ReleaseVersion>0.4</ReleaseVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Linux_x86' ">
     <DebugSymbols>true</DebugSymbols>
@@ -20,6 +21,7 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <ConsolePause>false</ConsolePause>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Linux_x86' ">
     <Optimize>true</Optimize>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <ConsolePause>false</ConsolePause>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
   </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="SDL2-CS">
+      <HintPath>..\packages\SDL2-CS.dll.2.0.0.0\lib\net20\SDL2-CS.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Xml" />
+    <Reference Include="atk-sharp">
+      <HintPath>..\packages\gtk-sharp.Linux.3.14.3.14.7\lib\net40\atk-sharp.dll</HintPath>
+    </Reference>
+    <Reference Include="cairo-sharp">
+      <HintPath>..\packages\gtk-sharp.Linux.3.14.3.14.7\lib\net40\cairo-sharp.dll</HintPath>
+    </Reference>
+    <Reference Include="gdk-sharp">
+      <HintPath>..\packages\gtk-sharp.Linux.3.14.3.14.7\lib\net40\gdk-sharp.dll</HintPath>
+    </Reference>
+    <Reference Include="gio-sharp">
+      <HintPath>..\packages\gtk-sharp.Linux.3.14.3.14.7\lib\net40\gio-sharp.dll</HintPath>
+    </Reference>
+    <Reference Include="glib-sharp">
+      <HintPath>..\packages\gtk-sharp.Linux.3.14.3.14.7\lib\net40\glib-sharp.dll</HintPath>
+    </Reference>
+    <Reference Include="gtk-dotnet">
+      <HintPath>..\packages\gtk-sharp.Linux.3.14.3.14.7\lib\net40\gtk-dotnet.dll</HintPath>
+    </Reference>
+    <Reference Include="gtk-sharp">
+      <HintPath>..\packages\gtk-sharp.Linux.3.14.3.14.7\lib\net40\gtk-sharp.dll</HintPath>
+    </Reference>
+    <Reference Include="pango-sharp">
+      <HintPath>..\packages\gtk-sharp.Linux.3.14.3.14.7\lib\net40\pango-sharp.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="main.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\Crow.csproj">
+      <Project>{C2980F9B-4798-4C05-99E2-E174810F7C7B}</Project>
+      <Name>Crow</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <Import Project="..\packages\gtk-sharp.Linux.3.14.3.14.7\build\net40\gtk-sharp.Linux.3.14.targets" Condition="Exists('..\packages\gtk-sharp.Linux.3.14.3.14.7\build\net40\gtk-sharp.Linux.3.14.targets')" />
 </Project>
\ No newline at end of file
index bc72e8e3e1ce223ccad62030aa0a4c62242bcf07..3bc4d2acbb218a2141a0fef0c1b99b31f08af90b 100644 (file)
 //  You should have received a copy of the GNU General Public License
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+using SDL2;
+using Cairo;
+
 namespace SDL2Crow
 {
-       public class main
+       public class SDL2Window : IDisposable
        {
-               public main ()
+               int width, height;
+               IntPtr win, rend;
+               SDL.SDL_Surface sdlSurface;
+
+               public SDL2Window (int _width = 800, int _height = 600) {
+                       width = _width;
+                       height = _height;
+
+                       SDL.SDL_Init (SDL.SDL_INIT_VIDEO);
+
+
+                       SDL.SDL_CreateWindowAndRenderer (width, height,
+                                                                                       SDL.SDL_WindowFlags.SDL_WINDOW_BORDERLESS, out win, out rend);
+
+                       IntPtr sdlSurfPtr = SDL.SDL_GetWindowSurface (win);
+                       sdlSurface = (SDL.SDL_Surface)Marshal.PtrToStructure (sdlSurfPtr, typeof (SDL.SDL_Surface));
+                       sdlSurface.
+                       //uint colorkey = SDL.SDL_MapRGB (sdlSurface.format, 0xFF, 0x00, 0xFF);
+                       //// Set all pixels of colour R(255), G(0), B(255) to be transparent
+                       //SDL.SDL_SetColorKey (sdlSurfPtr, 4, colorkey);
+
+                       //using (Cairo.Surface surf = new Cairo.ImageSurface (sdlSurface.pixels, Cairo.Format.ARGB32, sdlSurface.w, sdlSurface.h, sdlSurface.pitch)) {
+                       //      using (Context ctx = new Context (surf)) {
+                       //              ctx.Rectangle (0, 0, width, height);
+                       //              ctx.SetSourceRGBA (1, 0, 0, 0);
+                       //              ctx.Fill ();
+                       //      }
+                       //}
+
+                       //SDL.SDL_UpdateWindowSurface (win);
+
+               }
+               void Run () {
+                       SDL.SDL_Event e;
+
+                       while(true){
+                               SDL.SDL_PollEvent (out e);
+
+                               if (e.type == SDL.SDL_EventType.SDL_QUIT)
+                                       break;
+                               
+                               SDL.SDL_SetRenderDrawBlendMode (rend, SDL.SDL_BlendMode.SDL_BLENDMODE_BLEND);
+                               SDL.SDL_SetRenderDrawColor (rend, 0xFF, 0x00, 0x00, 0x20);
+                               SDL.SDL_RenderClear (rend);
+
+                               SDL.SDL_RenderPresent (rend);
+                       }
+               
+               }
+
+               [STAThread]
+               static void Main ()
+               {
+                       using (SDL2Window win = new SDL2Window ()) {
+                               win.Run ();
+                       }
+               }
+
+               public void Dispose ()
                {
+                       SDL.SDL_DestroyRenderer (rend);
+                       SDL.SDL_DestroyWindow (win);
+                       SDL.SDL_Quit ();
                }
        }
 }
index fb3df3d71b2620113af4222a964a31be2fe66f50..916a571cc1ec3923b38422bf697ba0f452648480 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
+  <package id="gtk-sharp.Linux.3.14" version="3.14.7" targetFramework="net45" />
   <package id="SDL2-CS.dll" version="2.0.0.0" targetFramework="net45" />
 </packages>
\ No newline at end of file