rinderon 0.0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 31ed2e8c99da2f2074f42f036e2122ef9ec5d9f0
4
+ data.tar.gz: 8bbf13b8553d027c3bce15480dbb754cc6952bda
5
+ SHA512:
6
+ metadata.gz: 5244229dad891a8fa680c494a6bb67a5d053917f0121252c4ed4b044a03de9b39459475bc978cb5b4a959918f036f1510254ff7446224f59755657064951008b
7
+ data.tar.gz: fb998b07cd47a25aad0777239cbef22261e6514147c145a6ebad37deaa63264dd590a43867a567d46bc4c02b7950d3dcbb620dc25a468e21fd06949df20be7fa
@@ -0,0 +1,23 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ *.dll
23
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rinderon.gemspec
4
+ gemspec
5
+ gem "rake-compiler"
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 myun2
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,34 @@
1
+ # Rinderon
2
+
3
+ **R**-uby for W-**ind**-ows App-**l**-icati-**on** with Dir **e** ctX
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'rinderon'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install rinderon
18
+
19
+ ## Usage
20
+
21
+ Window show example Code.
22
+
23
+ ```ruby
24
+ require 'rinderon'
25
+ Rinderon::Window.new("Window Test.", 640, 480)
26
+ ```
27
+
28
+ ## Contributing
29
+
30
+ 1. Fork it ( https://github.com/[my-github-username]/rinderon/fork )
31
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
32
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
33
+ 4. Push to the branch (`git push origin my-new-feature`)
34
+ 5. Create a new Pull Request
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/extensiontask"
3
+
4
+ Rake::ExtensionTask.new "rinderon" do |ext|
5
+ ext.lib_dir = "lib/rinderon"
6
+ end
@@ -0,0 +1,2 @@
1
+ all:
2
+ g++ -shared -o rinderon.dll rinderon.c -lgdi32
@@ -0,0 +1,37 @@
1
+ #include <windows.h>
2
+ #include <d3d9.h>
3
+
4
+ LPDIRECT3DDEVICE9 RinderonInitD3d9(HWND hWnd, UINT width, UINT height)
5
+ {
6
+ IDirect3D9* pD3d;
7
+ IDirect3DDevice9* pD3dDev;
8
+
9
+ pD3d = ::Direct3DCreate9(D3D_SDK_VERSION);
10
+ if ( pD3d == NULL )
11
+ return NULL;
12
+
13
+ D3DPRESENT_PARAMETERS d3dParams = {
14
+ width, height,
15
+ D3DFMT_UNKNOWN,
16
+ 0,
17
+ D3DMULTISAMPLE_NONE,
18
+ 0,
19
+ D3DSWAPEFFECT_DISCARD,
20
+ NULL,
21
+ TRUE,
22
+ TRUE,
23
+ D3DFMT_D24S8,
24
+ 0,
25
+ 0
26
+ };
27
+
28
+ if( FAILED( pD3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dParams, &pD3dDev ) ) )
29
+ if( FAILED( pD3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dParams, &pD3dDev ) ) )
30
+ if( FAILED( pD3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dParams, &pD3dDev ) ) )
31
+ if( FAILED( pD3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dParams, &pD3dDev ) ) )
32
+ {
33
+ pD3d->Release();
34
+ return NULL;
35
+ }
36
+ return pD3dDev;
37
+ }
@@ -0,0 +1,32 @@
1
+ #include <windows.h>
2
+ #include <d3d9.h>
3
+
4
+ void Rinderon9Clear(IDirect3DDevice9* d3dDev)
5
+ {
6
+ d3dDev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
7
+ }
8
+
9
+ void Rinderon9Fill(IDirect3DDevice9* d3dDev, D3DCOLOR cl)
10
+ {
11
+ d3dDev->Clear(0, NULL, D3DCLEAR_TARGET, cl, 1.0f, 0);
12
+ }
13
+
14
+ void Rinderon9FillRect(IDirect3DDevice9* d3dDev, D3DCOLOR cl, const RECT& rect)
15
+ {
16
+ d3dDev->Clear(0, &rect, D3DCLEAR_TARGET, cl, 1.0f, 0);
17
+ }
18
+
19
+ void Rinderon9EndScene(IDirect3DDevice9* d3dDev)
20
+ {
21
+ d3dDev->EndScene();
22
+ }
23
+
24
+ void Rinderon9BeginScene(IDirect3DDevice9* d3dDev)
25
+ {
26
+ d3dDev->BeginScene();
27
+ }
28
+
29
+ void Rinderon9Present(IDirect3DDevice9* d3dDev)
30
+ {
31
+ d3dDev->Present(NULL, NULL, NULL, NULL);
32
+ }
@@ -0,0 +1,8 @@
1
+ srcdir = File.expand_path("../",__FILE__)
2
+ outfile = "rinderon.so"
3
+
4
+ File.open("Makefile", "w") << <<"__Makefile_END__"
5
+ all:
6
+ gcc -shared -o #{outfile} #{srcdir}/rinderon.c -lgdi32
7
+ install: #{outfile}
8
+ __Makefile_END__
@@ -0,0 +1,59 @@
1
+ #include <windows.h>
2
+
3
+ LRESULT CALLBACK RinderonWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
4
+ {
5
+ switch (uMsg)
6
+ {
7
+ case WM_DESTROY:
8
+ PostQuitMessage(0);
9
+ return 0;
10
+
11
+ default:
12
+ break;
13
+ }
14
+ return DefWindowProc(hWnd, uMsg, wParam, lParam);
15
+ }
16
+
17
+ HWND RinderonCreateWindow(LPCSTR szWindowTitle, int nWidth, int nHeight)
18
+ {
19
+ WNDCLASSEX wc;
20
+ LPCSTR szWindowClassName = "__RinderonTemporaryWindowClass__";
21
+ HWND hWnd;
22
+ MSG msg;
23
+
24
+ wc.cbSize = sizeof(wc);
25
+ wc.style = CS_HREDRAW | CS_VREDRAW;
26
+ wc.lpfnWndProc = RinderonWindowProc;
27
+ wc.cbClsExtra = 0;
28
+ wc.cbWndExtra = 0;
29
+ wc.hInstance = NULL;
30
+ wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
31
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
32
+ wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
33
+ wc.lpszMenuName = NULL;
34
+ wc.lpszClassName = szWindowClassName;
35
+ wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
36
+ RegisterClassEx(&wc);
37
+
38
+ hWnd = CreateWindowEx(
39
+ WS_EX_APPWINDOW,
40
+ szWindowClassName,
41
+ szWindowTitle,
42
+ WS_OVERLAPPEDWINDOW,
43
+ CW_USEDEFAULT, CW_USEDEFAULT,
44
+ nWidth, nHeight,
45
+ NULL,
46
+ NULL,
47
+ NULL,
48
+ NULL);
49
+
50
+ ShowWindow(hWnd, SW_SHOWDEFAULT);
51
+ UpdateWindow(hWnd);
52
+
53
+ while (GetMessage (&msg,NULL,0,0)) {
54
+ TranslateMessage(&msg);
55
+ DispatchMessage(&msg);
56
+ }
57
+
58
+ return hWnd;
59
+ }
@@ -0,0 +1,6 @@
1
+ require "rinderon/version"
2
+ require "rinderon/window"
3
+
4
+ module Rinderon
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,3 @@
1
+ module Rinderon
2
+ VERSION = "0.0.0.1"
3
+ end
@@ -0,0 +1,8 @@
1
+ require "win32api"
2
+ module Rinderon
3
+ class Window
4
+ def initialize(name, width, height)
5
+ Win32API.new(File.expand_path('../../../ext/rinderon/rinderon.so', __FILE__), 'RinderonCreateWindow', %w(p i i), 'i').call(name, width, height)
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rinderon/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rinderon"
8
+ spec.version = Rinderon::VERSION
9
+ spec.authors = ["myun2"]
10
+ spec.email = ["myun2@nwhite.info"]
11
+ spec.summary = %q{Ruby for Windows Application with DirectX}
12
+ spec.description = %q{Ruby for Windows Application with DirectX}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["ext", "lib"]
20
+ spec.extensions = %w[ext/rinderon/extconf.rb]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.6"
23
+ spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "rspec"
25
+ end
@@ -0,0 +1,6 @@
1
+ require 'rinderon'
2
+
3
+ describe Rinderon::Window do
4
+ let(:window) { Rinderon::Window }
5
+ it { window.new("Window Test.", 640, 480) }
6
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rinderon
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - myun2
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Ruby for Windows Application with DirectX
56
+ email:
57
+ - myun2@nwhite.info
58
+ executables: []
59
+ extensions:
60
+ - ext/rinderon/extconf.rb
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - ext/rinderon/Makefile
69
+ - ext/rinderon/directx9.c
70
+ - ext/rinderon/directx9_utils.c
71
+ - ext/rinderon/extconf.rb
72
+ - ext/rinderon/rinderon.c
73
+ - lib/rinderon.rb
74
+ - lib/rinderon/version.rb
75
+ - lib/rinderon/window.rb
76
+ - rinderon.gemspec
77
+ - spec/window_spec.rb
78
+ homepage: ''
79
+ licenses:
80
+ - MIT
81
+ metadata: {}
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - ext
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 2.0.14
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: Ruby for Windows Application with DirectX
103
+ test_files:
104
+ - spec/window_spec.rb